Vim + vundle configuration, vimvundle

Source: Internet
Author: User
Tags egrep

Vim + vundle configuration, vimvundle

Although there is no IDE for writing code in Linux, it is also useful to configure several plug-ins for vim. Commonly used plug-ins mainly include the following types: file search, definition or declaration of search symbols (functions, variables, etc.), and automatic complementing. The general process is to download the required tool, and then configure the loading tool option in the vimrc file, so I have never thought of it. However, we recently found that the vundle tool can easily manage multiple plug-ins, which is very convenient for you to introduce.

1. Install vim

./configure --prefix=/usr \--with-features=huge \--enable-pythoninterp \--enable-rubyinterp --enable-luainterp \--enable-multibyte --enable-sniff --enable-fontset \--with-features=huge \--enable-pythoninterp \--enable-rubyinterp \--enable-luainterp \--enable-multibyte \--enable-sniff \--enable-cscopemakesudo make install

2. install and configure vundle
(1). the vundle code is all hosted on git. First download the source code

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

(2). Configure the. vimrc File

set rtp+=~/.vim/bundle/vundle/call vundle#rc()Bundle 'gmarik/vundle'Bundle 'Valloric/YouCompleteMe'Bundle 'ctrlpvim/ctrlp.vim'

Each Bundle declares a plug-in to be installed with Vundle. The above content configures the plug-ins YouCompleteMe and ctrlp. vim.
(3). Use vundle
Run the command BundleList to view the configured plug-ins. Run the command BundleInstall to install all the plug-ins displayed by BundleList. This process is fully performed by vundle. To delete a plug-in, first go ~ /. Remove the plug-in declaration from vimrc, and then execute the command: BundleClean. The command for the vundle management plug-in is as follows:
: BundleList-lists all plug-ins configured in the. vimrc table.
: BundleInstall-all plug-ins in the installation list
: BundleInstall! -Update all plug-ins in the list
: BundleSearch foo-find the foo plug-in
: BundleClean-clear plug-ins not in the list

3. Configure cssag/ctags/taglist
(1) install and configure Ctags
Download and install the source code. Run the ctags-R * command in the source code directory to generate the index file. If you only want to output the file list for some file types, run the find command first, then, use the ctags-L parameter to generate tags, for example:

find . -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.ic" > tags.filesctags -L tags.files

(2) install and configure Taglist
The taglistdependency depends on the ctags. The actual content contains only a few configuration files. Copy taglist.txt and taglist. vim to the specified directory.

$cd taglist/$cp doc/taglist.txt ~/.vim/doc$cp plugin/taglist.vim ~/.vim/plugin/ 

(3) Associate ctags and taglist
Add the following code to. vimrc:

let Tlist_Ctags_Cmd="/usr/bin/ctags"

Run in vim: If Tlist is available in the tag list, the installation is OK.

(4) install and configure csflood

find . -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.ic" > cscope.filescscope -bkq -i cscope.files

-R: Search for the code in the subdirectory tree when generating the index file
-B: Only the index file is generated, and the cssag interface is not displayed.
-Q: generate the cssag. in. out and cssag. po. out files to speed up the cssag index.
-K: when the index file is generated, the/usr/include directory is not searched.

(5). Common shortcut keys

Cs add path/cscope. out (load the cscope index file) cs find c | d | e | f | g | I | s | t name

S: Find the C language symbol, that is, find the place where the function name, Macro, enumerated value, and so on appear
G: Find the locations defined by functions, macros, and enumeration, similar to the functions provided by ctags.
T: Find the specified string
E: Find the egrep mode, which is equivalent to the egrep function, but the search speed is much faster.
D: Find the function called by this function.
C: Find the function that calls this function.
F: find and open the file, similar to the find function of vim.
I: Find the file that contains this file

(6). Set shortcut key ing

nmap ffs :cs find s <C-R>=expand("<cword>")<CR><CR>nmap ffg :cs find g <C-R>=expand("<cword>")<CR><CR>nmap fft :cs find t <C-R>=expand("<cword>")<CR><CR>nmap ffe :cs find e <C-R>=expand("<cword>")<CR><CR>

4. Common vim shortcut keys
(1) Jump
% Jump to matching brackets
$ Jump to the end of a row
0: 0. Jump to the beginning of the line
[] Jump to the ending braces of the previous function (in the middle of the function, adjust to the function header)
] [Jump to the end braces of the next function (in the middle of the function, it is adjusted to the end of the function)
Ctrl + B flip back one page
Ctrl + f Turn one page forward
Gg jump to File Header
GG jump to the end of the file

(2). Edit
Set cursorline)
Set shiftwidth = 2 (block operation, select a block, press> to move two columns to the right, and press <to move two columns to the left)
Ndd (N is a number, indicating to delete N rows, similar to the cut function)
Nyy (N is a number that indicates copying N rows)

(3). Multiple tags
: Vsplit (Vertical Split Window, refer to the Code)
Ctrl + w (window switch)

(4). Common shortcut keys
Ngt (switch to the tags)
: Tabc (close the current tab)
: Tabo (close all other tabs)
: Tablast (last tab)
: Tabfirst (first tab)
: Tabnext (next tab)
: Tabpre (previous tab)
Gt, gT (switch between tabs)

(5). Shortcut Key ing

nmap ff1 1gtnmap ff2 2gtnmap ff3 3gtnmap ff4 4gtnmap ff5 5gtnmap ff6 6gtnmap ff7 7gtnmap ff8 8gtnmap ff9 9gtnmap ffc :tabc<CR>nmap ffo :tabo<CR>nmap fff :tabfirst<CR>nmap ffl :tablast<CR>nmap ffn :tabnext<CR>nmap ffp :tabpre<CR>

(6). Others
: So ~ /. Vimrc (dynamic loading of vimrc changes)
: Shell (switch between vim and shell)
: Exit (vim is returned)

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.