For linux configuration, use VIM to open files by default. Method 1: change all files opened by gedit to vim. This method is flawed. Method 2 is recommended to specify which type of file is opened by VIM by default. Both methods enable convenient file opening and get rid of using VIM encoding to open the file and enter a long path. The configuration is as follows: Method 1: replace all files opened with gedit by default with VIM. However, if you feel that a file is easy to edit by gedit, you can specify it as opened by gedit again, in the open mode option of file properties, you can set a file to open by default for gedit. use vim to open ults. list, put all gedit. use vim for desktop. to replace. Command: sudo vim/etc/gnome/defaults. list: % s/gedit. desktop/vim. desktop/g 2. create a vim under/usr/share/applications. desktop file command: sudo vim/usr/share/applications/vim. the Edit content in desktop is as follows: [Desktop Entry] Encoding = UTF-8 Type = Application Exec = vim % f Icon =/usr/share/vim/vim48x48.png (here the Icon is defined by yourself) name = Vim Terminal = true NoDisplay = true. In this way, you can select vim from the shortcut menu. method 2 is recommended: this method is simpler and the custom configuration is better. I just accidentally discovered that the method above has a defect, according to the process of method 1. After the operation, the file encoding can be directly opened with VIM, but the first method is to replace all the files opened with gedit by default in the system with VIM, in method 1, I also mentioned that you can switch back to a file and continue to use gedit to open it by default. The problem lies in this. A metaphor: The a.txt file is originally opened with gedit by default. After you repeat the process in method 1, double-click a.txt again to enable it. By default, vim is enabled. B. php is also enabled by default by gedit. Now, VIM is enabled by default. Well, the current situation has reached your ideal usage. However, A. txt file is only a text file. Its file type is "plain text document (text/plain)" (you can see it by right-clicking the attribute) and does not belong to your own encoding file, it should be easy to use the system's default gedit to open it by default. Then let's modify the open method of the example, right-click the.txt file and choose "open mode", and click "set as default" in gedit. After you click the "set as default" button, do you find that the VIM option is missing. Now the problem occurs. You can open the default gedit in a.txt. Open B. php (the file mentioned above) is incorrect. The default open mode is no longer vim, and gedit is switched back to the default open mode, however, you can still see the VIM option by right-clicking the file. Although it can be used, it is not our ideal method. Now the solution is:/home/linux /. local/share: Go to this folder to see if there is an additional folder application. In the applications folder, there is a file mimeapps. list, applications/mimeapps. list records the records opened by the system based on the file type set by the individual, this application/mimeapps. by default, a list is generated only when you change the open mode of a file. If you do not have such a directory structure, you can create one by yourself. Mimeapps. the list content format is as follows: [Default Applications] text/plain = gedit. desktop [Added Associations] text/plain = gedit. desktop; this definition is quite flexible. You can directly add the file type opened by vim to mimeapps. list file. Anyone who has performed a procedure in method 1 can create vim in method 1. the desktop file has been modified by/etc/gnome/defaults. please restore the list file to the original. Why is it mimeapps. the list file system should first check which file type is set in this file to open and which program is used if the file type you open is not in mimeapps. list, the system will select/etc/gnome/defaults. list. Now let's try to add content to mimeapps. list. For example, the above analogy shows that the file B. php is compiled with its code which should be opened by VIM by default. Right-click Properties in the B. php file. B. in linux, the php file type is application/x-php. We can add this type to [Default Applications] text/plain = gedit. export topapplication/x-php = vim. desktop [Added Associations] text/plain = gedit. desktop; application/x-php = vim. desktop OK to open B. the PHP file OK is opened by vim by default. right-click the php file and you can see the right-click drop-down menu. The first item is "Open with vim". Now that the test has been completed, this VIM open method should be regarded as the best way for our coders to use vim. My local environment, ubuntu 12.10 VIM, is the best way to use it. I have already elaborated that I have played a very good role in writing. It should be very detailed, for the first two steps, follow the steps mentioned in method 1 to create vim. create vim. the second part of the desktop file/home/linux /. local/share this directory to see if there are applications/mimeapps. if the directory file structure such as list is not set up, you can directly open mimeapps. list to add content. PS: VIM's default method of opening a file is even depressing. It is complicated to open a file on the command line for one day. No matter how google searches, Baidu is a solution of method 1, which cannot be an ideal solution. However, I finally got method 2 on the basis of method 1. The problem is settled, and I want to help my friends who search for solutions on the Internet, next, I learned about VIM in VIM. I like the encoding environment provided by VIM. I feel uncomfortable with my eyes. Hey hey, I have a very simple reason. What do you like about VIM? The article mentions that/linux refers to the username of the Local Machine. When you follow the configuration in this article, find applications/mimeapps. list or create this directory/file structure. It is under your current user name, for example,/home/"your user"/. local/share