Play with Vim's heavily armed vim
Lazy cancer at the end of my seemingly a long time did not write a blog, has owed many in the planned blog I have already embarrassed to say. OK, so, in the first three, after introducing vim as the code editor, someone might say, is it really better to learn so many instructions than a real IDE? In the IDL has automatic completion, there is automatic generation of various formats of code, it is not very convenient, high efficiency vim several streets good? But also can adjust the background color and the code color can be convenient to debug Blablabla 、、、 Well, I just want to say it's because you don't really know the legendary vim, do you think it's not auto-complete highlighting the spelling checker? Too naïve ~ also ask you to open the IDE when you can open more than n other software without card? In short, I just love vim. Here's how to make Vim a work artifact.
Theme
The first step is to talk about the theme, anyway, a good-looking background and code color is not only pleasing to the eye and can also indirectly improve work efficiency, so, change the theme of the mood ~ because the coding work preference Sublime Text 2 background color, so I found a similar to this vim theme, Name is Monokai. Favorite friends can be downloaded from here. Friends who don't like can search the Web for their favorite themes to configure. Here's how to configure the Vim theme:
- First you need to create a folder. Vim, under the root directory (skip to step 2nd if you have one). Here's how:
mkdir ~/.vim
- Next, create a directory named colors under the. Vim directory and place the downloaded theme file *.vim in this directory.
- The last step, edit the. vimrc file, use the downloaded directory:
$vim ~/.VIMRC
Add the following two lines of code:
1 syntax Enable 2 ColorScheme Monokai
To open the file again with Vim you will see the following interface:
plug-in management artifact on vim-vundle
As for why not first introduced a variety of powerful plug-ins, which of course there is a reason. As we all know, the power of vim is not only reflected in the operation of high efficiency, more powerful and abundant plug-ins to do support, after the rich plug-in, the face of the search and management problems. If each plug-in is to be installed manually, then it will be a very time-consuming work, trouble and meaningless, because others use the Vundle plug-in management artifact after minute automatic installation, you are manually installed, I can only say: Hello diligent! I don't do that kind of lazy man anyway. OK, next, how to use Vundle to manage various plugins. First, make sure that Git is already installed on your computer and that you will use some of its simple instructions. Students who do not know can look here. Then execute the following command to clone the Vundle project locally. The instructions are as follows:
1 $ git clone https://github.com/gmarik/vundle.vim.git ~/.vim/bundle/vundle.vim
After OK, do some configuration in your ~/.VIMRC, the configuration list is as follows:
1Set nocompatible"must be2FileType off"must be3 4 "set the run environment containing and initializing the Vundle5Set rtp+=~/.vim/bundle/Vundle.vim6 Call Vundle#begin ()7 8Plugin'Gmarik/vundle.vim'9 TenPlugin'tpope/vim-fugitive' One ACall Vundle#end ()"Required -FileType plugin indent on"Required - "Brief Help the ":P luginlist-lists configured plugins - ":P lugininstall-installs plugins, append '! ' to update or just:P luginupdate - ":P luginsearch foo-searches for foo, append '! ' to refresh local cache - ":P luginclean-confirms removal of unused plugins; Append '! ' to auto-approve removal + " - "see:h Vundle For more details or wiki for FAQ + "Put your non-plugin stuff after this line
Now for a quick look at how to use this plugin to manage artifacts, first you need to put the plugins you want to install between the two lines below.
1 Call Vundle#begin () 2 call Vundle#end ()
The 8th line of the time must be installed plugin, so as to let Vundle management plug-in, and finally a brief introduction of the use of the method (in fact, just put out the inside already has a simple help in English).
- :P luginlist lists the configured plugins.
- :P Lugininstall installed in the plug-in between Vundle#begin () and Vundle#end ().
- :P Luginclean Uninstall plug-ins that are not between Vundle#begin () and Vundle#end () code Snippets.
The basic situation is jiangzi. The two best plugins are highlighted below.
Auto-complete Artifact-ycm
Listen to the name to know is why, many people say that the IDE high efficiency, because there is automatic completion, in fact, I would like to say, in fact, Vim is also some, YCM contains the following several plug-in features, so the following plug-ins can not be installed, the address here:
1 Clang_complete 2 Autocomplpop 3 Supertab 4 Neocomplcache 5 Jedi (full complement to Python)
Another common shortcut key for YCM is as follows:
1 Ctrl+ J Select Next complement 2 Ctrl +K Select Previous complement 34 Ctrl +n Select Next completion 5 Ctrl +p Select Previous completion 6 Enter select 7 , JD jumps to function definition, split screen opens a buffer (very useful!!!!!!!!! )8 , GD cpp, OBJC, objcpp, python valid (less useful)
as follows:
Directory tree Artifact-nerdtree
Sometimes I find it troublesome to open another file while editing a file, unlike the IDE, which has a directory on the left side, does not have a function such as a VIM plugin that needs so much? You are wrong, of course. That's nerdtree.
More powerful is the Nerdtree also have a variety of convenient features you do not think of, commonly used shortcut keys are as follows:
common operations in the Nerdtree window: (lowercase current, capital root) x ... Close the current directory tree X .... Recursively pick up the current directory tree r .... Refresh current directory R .... Refresh root tree p .... Jumps to the parent node of the current node P .... Skip to root node k/J ..... Move up and down K .... To the first node of the same directory J .... Last node o ..... Open files, directories and bookmarks s.......split sub-screen [Original is I, change key] V.......vsplit left and right sub-screen [original is S, modifier] C ....... Set the current directory to the root node q .... Close
The following previous:
For more plugins please see here. Well, quickly use the plugin to arm your vim. Another advice: plug-ins are not the more the better, enough on the line ~
Play vim with the plugin to create artifacts