Set the color scheme, Font, use tabs, and simulate Emacs Key Binding in gvim

Source: Internet
Author: User
The default document plug-in of the company is based on VIM. gvim is used to write documents every day. If you do not set gvim, it is really uncomfortable.
1) color scheme and font setting
First, gvim cannot automatically save the current settings, such as fonts and color schemes. So we need to modify the gvim configuration file so that we can load the settings we want every time.
Modify the _ vimrc file in the vim installation directory, set the color scheme to my favorite Koehler, and set the font size to 14, which won't be too hard:
Colo koehlerset guifont = courier_new: H14: cansi
Set the font in the graphic interface. You can use the following method to obtain the name and size of the font you like. You can click "edit"-> "select font", select the font and font size you like in the dialog box, and press the appropriate number of ESC commands to confirm that the font is in normal mode, then run the following command: ": Set guifont? ". After you press enter, the name and size of the current font will be displayed at the bottom of the gvim screen. Write the obtained result to the configuration file according to the preceding statement. Note that if the font name contains spaces, you must add a backslash "\" before all spaces to escape the text.
If you use your own plug-ins, for example, if I use our company's plug-ins here, there is a set of Font types and sizes, you need to comment out this line in your plug-in first.
2) It is recommended that a single line of documents should not exceed 80 characters, so as to facilitate reading in all readers. However, this rule does not require strict requirements for emails or references. So I used the following line to highlight all the words after 80 characters:
: Match diffadd' \ %> 80 v .*'
In this way, it is clear which rows contain more than 80 characters.
3) set and enable spelling check, and set the language to en.
Setlocal spell spelllang = en
4) Multi-tab applications
Vim has been supporting the tab application since 7.0. With tabs, you can save a lot of trouble in opening and editing windows. However, by default, gvim does not use tabs to open files. Of course, you can use the: tabnew filename command to open the file, but I believe you prefer to double-click it. In this case, you can use the following method (from shuimu Community Vim version ):
In Linux, you can enable $ gvim-remote-tab-silent filename.
In Windows, DOS can also be opened as above. In the case of double-click, you can modify the Registry hkey_classes_root \ applications \ gvim.exe \ shell \ edit \ command:
"C: \ Program Files \ Vim \ vim70 \ gvim.exe"-p-remote-tab-silent "% 1 ″
If you right-click "Edit with vim", delete hkey_classes_root \ * \ shellex \ contextmenuhandlers \ gvim in the registry, and manually add the right-click menu,
Two methods:
A. go directly to the Registry, add the item "Edit with vim" under hkey_classes_root \ * \ shell, and then add the subitem "command" under the item "Edit with vim ", in the window on the right, set the key value to "C: \ Program Files \ Vim \ vim70 \ gvim.exe"-p-remote-tab-silent "% 1 ″
B. Save the following content as the file gvim. Reg and import it to the Registry.
Windows Registry Editor Version 5.00 [hkey_classes_root \ * \ shell \ edit with & Vim] [hkey_classes_root \ * \ shell \ edit with & Vim \ command] @ = "\" C: \ Program Files \ Vim \ vim70 \ gvim.exe \ "-p-remote-tab-silent \" % 1 \""
In addition, you can also right-click "send" to go to the directory c: \ Documents ents and Settings \ USERNAME \ sendto, right-click gvim-New-shortcut, and click browse in the dialog box to find the gvim location. In this way, a shortcut of gvim is created, right-click the shortcut file-properties-shortcut and write "C: \ Program Files \ Vim \ vim70 \ gvim.exe "-p-remote-tab-silent" % *"
Note: gvim is installed by default. If it is not the default address, modify it.
5) Emacs Mode
I prefer to use Emacs to write things, but I don't have time to transplant the company's vim plug-in to Emacs, so I have to use vimacs plug-in to simulate an Emacs first in Vim.
The vimacs plug-in is only available in the vim Insert state. Simulate the basic Emacs key binding, such as C-F and c-e. The installation is very simple, and the vimacs package is downloaded, and then the "C: \ Program Files \ Vim \ vimfiles \ doc" file directory is added to your vim file directory. copy Vim files to the vim plug-in directory (the default value is "C: \ Program Files \ Vim \ vimfiles \ plugin ").
If you encounter some key errors during use, you need to check whether your existing plug-in conflicts with vimacs on keymapping.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.