My vim is on the road

Source: Internet
Author: User

Objective

From the sophomore time began to contact with the Linux, and thus also contact the VI, right, at that time not quite understand, do not know there is a vim, really feel that the introduction is not simple, online about vim compared to other editor's learning curve, looked daunting. At that time, there is not much to use, so has been in the naked run state, only the basic operation, here I prefer a blog website cool Shell in a concise article of VIM practice level raiders. This blog post basically summarizes the daily use of Vim's 90% command, and the bare-Ben is enough.

Of course, it is recommended that a vim game vim adventure, also from the cool shell. Many of the posts on this site I think are well written. When I wrote this blog post, I saw a more interesting command.
Try typing in vim: h! What will you find? Input: H 42? Isn't it funny?

Also, here to say a more, about VIM,EMACS, etc., two camps can be endless debate on who is more excellent. I as a vimer, I quote only one sentence:

Emacs is the editor of God, and Vim is the god of the editor.

Gossip, the beginning of the text, this is my initial contact with Vim to now nearly 3 years, and finally decided not to run naked.

What is a plugin

Vim is an editor that supports a rich plug-in extension, so what is a plugin? Can simply understand, plug-ins is a configuration, just need to put the plug-ins in the corresponding directory, such as
~/.vim/plugin, then make the appropriate configuration in the ~/.VIMRC. It is understood that the configuration of vim will be relatively clear. So, for adding plug-ins, it is the process of constantly putting plugins in the ~/.vim/plugin directory.

Of course, there are some differences in the use of the plug-in manager. I'm using vundle here myself. This way you do not have to manage plugins, delete, update, install plug-ins will become very simple, very easy.

Installation of the plug-in manager vundle

Follow the Vundle tutorial on GitHub to install Vundle. Then you'll find the ~/.vim/directory with the bundle directory, and the ~/.vim/bundle/directory will be the directory where the plugin is going to be installed. That is, the plugins installed through Vundle will all exist in this directory.
I'll put a vundle on my own:

Corresponding, I use the Vim plugin as follows:

Serial Number plug-in name function
1 Delimitmate Auto-Complete quotation mark (single quote/double quotation mark/back quote), brackets (() []{})
2 Vim-surround Conveniently insert various symbols on both sides of the character (I don't need to)
3 Indentline Code indent ID
4 Nerdtree File directory tree
5 TagList Code Structure Overview
6 Syntastic Grammar check
7 Youcompleteme Ultimate Artifact, code completion

Currently use these plug-ins temporarily, follow up if there is a new utility plug-in will be updated.

Delimitmate Installation

Auto-Complete quotation mark (single quote/double quotation mark/back quote), brackets (() []{})

Just add a sentence to the. vimrc file:

Bundle ‘Raimondi/delimitMate‘

Demo Effect:

Vim-surround Installation

Easy to insert various symbols on both sides of the character

Add a sentence to the. vimrc file:

Bundle "tpope/vim-surround"

Demo effect: (Borrowed from other bloggers ' pictures, Invasion and deletion)

Indentline Installation

Code indent ID

Add the following sentence to the. vimrc file:

Demo Effect:

Nerdtree Installation

File directory tree

Add in the. vimrc file:

Bundle ‘scrooloose/nerdtree.git‘"NERD-tree  

Demo Effect:

TagList Installation

Code Structure Overview

Add in the. vimrc file:

Bundle ‘vim-scripts/taglist.vim.git‘ map <silent> <F1> :TlistToggle<CR> `

Demo Effect:

Combined with Cscope will be able to implement the code browsing under Linux, although not compared to the Windows platform Sourceinsight (personally, it may be that they have not been familiar with the shortcut keys), will be dedicated to write a blog post about Cscope, here blank

Ultimate Artifact Youcompleteme

Why do you say the ultimate artifact? I went from Windows to Linux, the university has been using VS, then still a dead-end programming, a code of a code to knock, until one day I found the visual assist X, this virtual assistant simply let me go, it can automatically complete. And the efficiency is very high. Of course, if you want to start to despise me, there is no way, I am not a great God, the great god of course do not use these automatic complete artifact, reduce identity. After going to Linux, have been using the bare-Ben Vim, so also did not meet Youcompleteme this kind of artifact. Until one day, finally unbearable, I will continue to use VIM, the Internet on the vim of the great God with Vim to send and receive mail, listen to MP3, brewed coffee legend has let me doubt, and let me be tempted, and vim has not used a few plug-ins how to say their vimer, even linuxer? Finally began to mash up their vim configuration.

Work in the first to start with centos5, but with the release of the GCC version, vim version, Python version is too low, all the way, I compiled the Vim 7.4 version, GCC 4.8 version, Python3 version, In compiling Libclang (Youcompleteme is dependent on clang for completion and lexical analysis) or not through, tossing a fast two weeks later, finally decided to give up Centos5, fought Centos7. This process is very painful, to say the truth, Google a lot of previous solutions, but still failed to compile youcompleteme, the process is a waste of time, but also learn nothing, so suggest if possible, try to use a higher version of the system bar. This is an understatement, but the place where the most time is wasted is this step. Here are a few of the URLs that were collected at the time to solve the problem, but as a record, I couldn't use it, but I still thank the bloggers.

Getting Started with the LLVM system:http://llvm.org/docs/gettingstarted.html

CentOS Installation vim7.4:http://www.cnblogs.com/nhlinkin/p/3545509.html

CentOS Upgrade Python3.4.3 version: http://www.centoscn.com/image-text/config/2015/0320/4931.html

CentOS 6.5 x64 compiled with Python VIM7.4-YANTZE:HTTP://WWW.TUICOOL.COM/ARTICLES/RUNFMBJ

Vim Installation Youcompleteme plugin http://www.cnblogs.com/junnyfeng/p/3633697.html

[Note]ubuntu 13.04 configuration youcompleteme:http://blog.csdn.net/zhuliting/article/details/20055715

Vim Auto complete artifact: http://blog.marchtea.com/archives/161

Install Youcompleteme plugin for vim under Ubuntu 15.04: http://www.linuxidc.com/Linux/2015-07/120352.htm

Linux under compile install Youcompleteme plugin http://hahaya.github.io/build-YouCompleteMe/

Building LLVM with cmake:http://llvm.org/docs/cmake.html

Install Llvm+clang under CentOS:

Http://ilovers.sinaapp.com/article/centos%E4%B8%8B%E5%AE%89%E8%A3%85llvmclang

How to Install LLVM and Clang on CentOS 6:

Https://www.vultr.com/docs/how-to-install-llvm-and-clang-on-centos-6

RPM Resource libclang.so () (64bit):

http://rpmfind.net/linux/rpm2html/search.php?query=libclang.so%28%29%2864bit%29++centos&submit=Search+ ... &system=&arch=

Index of/gnu/gcc/: http://mirrors.kernel.org/gnu/gcc/

http://howiefh.github.io/2015/05/22/vim-install-youcompleteme-plugin/

http://howiefh.github.io/2015/05/22/vim-install-youcompleteme-plugin/

OK, then I replaced Linux with Centos7, and then refer to the Youcompleteme on the tutorial, very easy to install the Youcompleteme, do not need to compile clang, do not need to bother Google.

Demo Effect:

So tell me. VIMRC configuration:

"Youcompleteme configuration let g:ycm_global_ycm_extra_conf = '/home/niki/.ycm_extra_conf.py '" Let g:ycm_global_ycm_extra_conf = '/home/niki/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py ' let G:ycm_seed_identifiers_ With_syntax=1 "Syntax keyword complete let g:ycm_confirm_extra_conf=0" when you open vim no longer ask whether to load ycm_extra_conf.py configuration "youcompleteme default Tab S -tab and auto-complete conflict "let g:ycm_key_list_select_completion = [' <Down> ']" let g:ycm_key_list_previous_completion = [' < Up> '] "can also complement let g:ycm_complete_in_comments = 1" In the input of a string can also be complete let g:ycm_complete_in_strings = 1 " The text in the comments and strings will also be revenue-g:ycm_collect_identifiers_from_comments_and_strings = 0 Let G:ycm_error_symbol = ' >> ' let G: Ycm_warning_symbol = ' >* ' "Enter to select the current item Inoremap <expr> <CR> pumvisible ()? "\<c-y>": "\<cr>" set Completeopt=longest,menu "let Vim's complement menu behavior be consistent with the General IDE (reference VimTip1228)" The next Key behavior will show additional information inore Map <expr> <Down> pumvisible ()? ' <C-n> ': ' <Down> ' Inoremap <expr> < Up> pumvisible ()? ' <C-p> ': ' <Up> ' Inoremap <expr> <PageDown> pumvisible ()? ' <PageDown><C-p><C-n> ': ' <PageDown> ' Inoremap <expr> <PageUp> pumvisible ()? ' <PageUp><C-p><C-n> ': ' <PageUp> ' Vim calls this ' prefix ' key The ' leader '. Can set your leader key to "whatever you like.let Mapleader =", "Nnoremap <leader>gj:ycmcompleter gotodeclaratio N<cr>nnoremap <leader>gf:ycmcompleter Gotodefinition<cr>nnoremap <leader>gg:ycmcompleter Gotodefinitionelsedeclaration<cr>nmap <F4>:ycmdiags<cr>

The above configuration information, if you do not understand the map or NNOREMAP, leader do not understand, recommend you see this learn Vimscript the hard.

Syntastic Installation

It is said that Youcompleteme integrates the syntastic, which may not be necessary. I was installed on my own.
This can be very real-time check your code syntax, lexical, errors and so on. should be very useful.

Added in. VIMRC:

"syntastic  语法错误检查 execute pathogen#infect()set statusline+=%#warningmsg#set statusline+=%{SyntasticStatuslineFlag()}set statusline+=%*"每次自动调用 :SyntasticSetLocList, 将错误覆盖 **quickfix**let g:syntastic_always_populate_loc_list = 1" 自动拉起/关闭错误窗口, 不需要手动调用 :Errorslet g:syntastic_auto_loc_list = 1let g:syntastic_check_on_open = 1let g:syntastic_check_on_wq = 1map <F2> :SyntasticToggleMode<CR>

The configuration should also be relatively simple, mapping to the F2 key to activate/deactivate the syntastic Syntax Check window.
Demo Effect:

Vundle Install, update, uninstall plugins

The advantage of using the plugin manager is that it is convenient.
Open VIM:

To install the plugin:

: Bundleinstall

Update plugin:

: Bundleupdate

Uninstall Plug-ins: (Comment out the plugins that need to be uninstalled in the. vimrc file first)

: Bundleclean
Demo Effect:

When it comes to the use of each plug-in, you need to carefully study the function of each line of the configuration file, understand and familiarize yourself with the use of shortcut keys. If you are unfamiliar with shortcut keys, efficiency will be much slower.

Other

So far, I used the plug-in basically on the above several, although also encountered some good plug-ins, but it is not practical for me. I am mainly engaged in the development of Linux on C + +, the temporary use of these can meet my needs, if there are more fun more useful plug-ins, I will continue to update. As a record, it might help someone else.

Now back in writing this blog, the general view of the next, and feel good simple ah, at that time how to feel quite toss it? Perhaps this is the process of growth. When I go back, I always feel so silly, then I should be able to do better.

This is strictly my first blog post, my own self-built blog based on GitHub pages, for the time being to use GitHub pages, if I can stick to blogging, then consider buying domain names and servers.

Related Posts

Study with Me vim-the life changing Editor

My VIM configuration and description "K-vim"

Ultra-detailed vim+cscope of the use of the rules reproduced

The End

Jiaomh_cat (reboot_cat to buy this domain)

Email:[email protected]

blog:http://linxi4linux.github.io/

2016-6-7 in Hangzhou

My vim path

Related Article

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.