VIM series:. vimrc configuration file and project management script

Source: Internet
Author: User
VIM series :. vimrc configuration file and project management script 1 ,. the powerful personalized customization of vimrc configuration file vim depends on its configuration file and plug-in mechanism. the configuration file is the basis for ensuring the efficient use of plug-ins, so it is very important. The vim configuration file is usually. vimrc, placed in the user's $... VIM series :. vimrc configuration file and project management script 1 ,. the powerful personalized customization of vimrc configuration file vim depends on its configuration file and plug-in mechanism. the configuration file is the basis for ensuring the efficient use of plug-ins, so it is very important. The vim configuration file is usually. vimrc, which is placed in the user's $ HOME directory, can be very simple, or even not (use the default), it can be very complicated, hundreds of rows of settings, dazzling. Next I will first post my. vimrc File: 01 set nu "show 02 set ts = 4" set tabstop, that is, the number of spaces occupied by the tab key,: help tabstop03set sw = 4 "set shiftwidth, that is,> how many spaces are moved at a time,: help shiftwidth04set cindent "C language Smart indent 05 set textwidth = 80" sets the width of one line to 06 set comments = sl:/*, mb :**, elx: * "automatic completion annotation symbol 07 filetype plugin indent on" enable automatic file type detection 08 set completeopt = longest, menu "set word auto-completion option 09 set autoindent" set auto-indent 10 set encoding = UTF-8 fileencodings = ucs-bom, UTF-8, cp936 "set encoding, the correct encoding is used to display the Chinese 11 set OFDM = indent. the folding mode is set to auto folding based on indentation.: help fdm12set hlsearch ,: help hlsearch13 14 "======================================== =====================================15 "taglist option, set the taglist plug-in options, customize 16 "================================================= ==================================== 17let Tlist_Show_One_File = 1 "show only tags18let Tlist_Exit_OnlyWindow = 1 "when the taglist window is the last window, exit vim19let Tlist_Use_Right_Window = 1 "the taglist window is displayed on the right side of 20let mapleader =", "" change the boot character to ",", the default is "\", the modified value 21 noremap is used later. : TlistToggle "Equivalent to defining the shortcut key 22 noremap Tt: TlistToggle "Define the second shortcut key 23 24 25" ============================== ========================================================== === 26 "BufExplore setting, set the options of the bufexplorer plug-in, customize 27 "==================================================== ====================================================== 28let g: bufExplorerShowRelativePath = 129let g: BufExplorerSplitRight = 030let g: BufExplorerSplitVertical = letting let g: BufExplorerSplitBelow = 032 noremap Be: BufExplorer 33 noremap Bs: BufExplorerHorizontalSplit 34 noremap Bv: bufpolicerverticalsplit 35 36 "============================================ ========================================================== = 37 "csope settings, set the parameter content of csflood, automatically add a database at startup. ========================================================== ===== 39if has ("CSAs ") 40 set csprg =/usr/local/bin/cscope41 set csto = 042 set cst43 set nocsverb44 "add any database in current directory45 if filereadable (" cs.pdf. out ") 46 cs add cscope. out47 "else Add database pointed to by environment48 elseif $ CSCOPE_DB! = "" 49 cs add $ CSCOPE_DB50 endif51 set csverb52endif53 54 "================== ===============55 "NERDTree settings56" =================== ================================= 57 noremap Nt: NERDTree58 59 60 "==================================== =============================61 "lookupfile setting62" ==== ========================================================== =======================================63 let g: lookupFile_MinPatLength = 2 "enter at least 2 characters to start searching 64 let g: LookupFile_PreserveLastPattern = 0" do not save the string 65 let g: lookupFile_PreservePatternHistory = 1 "save query history 66 let g: LookupFile_AlwaysAcceptFirst = 1" press enter to open the first matching item 67 let g: lookupFile_AllowNewFiles = 0 "creation of nonexistent files is not allowed 68 if filereadable (". /lookup. files ")" set the tag file name 69 let g: LookupFile_TagExpr = '". /lookup. files "'70 endif71 72 nmap Lf LookupFile 73 nnoremap Lb: LUBufs 74 nnoremap Lw: LUWalk 75 nnoremap Lt: LUTags This configuration file is a bit complicated, with 75 lines. Fortunately, it's not as easy as a hundred lines. In fact, the main content in the configuration file is the options setting of the plug-in and the definition of the shortcut keys (re- ing of commands). These contents are the foundation of personalized customization, modify their settings to content that you like, are familiar with, and is highly efficient to use. Vim has many option parameters. I think that only the author knows all the options ~, However, we only need to get what we need, and all the options can be understood and used through online help, as shown in the note above: help OFDM. If you have prepared the options, parameters, and ING of the plug-in, you can use the: help command to find and understand the details of the plug-in. If you use this configuration file by referring to the previous steps, you can copy and use this configuration file. 2. the Project Management script mentioned earlier that the cssag tool needs to index the source file to create a tag database, and the ctags tool also needs to index the source file, the lookupfile plug-in also needs to search for all files in the project. all of these files need to be extracted from the project file list as the input source of tools and plug-ins to get the desired output content. Another important point is that during project development, the number and content of files must be constantly increased and modified, which means that the related data and tags must be constantly updated, to ensure that you can index the added symbols and files and perform the correct redirection. These jobs can be better competent by writing a simple script. below is my script project. sh: 01 #! /Bin/bash02 03cscope_file = "cs.pdf. files "# csparts input source, file list, name can be customized 04lookup_file =" lookup. files "# The Index File list of the lookupfile plug-in. the name can be customized. used in vimrc and must be consistent. for details, see the preceding section 05 06 # Source File list 07 find of C language project. -name \*. c-o-name \*. h> $ cscope_file08 # cssag creates a database through the file list 09 cs1_brq-I $ cscope_file 2 &>/dev/null10 11 # The ctags tool recursively creates the tags file of the entire project, the default file name is tags12ctags-R * 2 &>/dev/null13 14 # Create a file index list for the lookupfile plug-in. the following content can be found in the help document: help lookupfile-tag S15 # (echo "! _ TAG_FILE_SORTED 2/2 = foldcase/"; (find. -type f-printf "% f \ t % p \ t1 \ n" | \ 16 # sort-f)>. /filenametags17echo "! _ TAG_FILE_SORTED 2/2 = foldcase/"> $ lookup_file18find. \ (-name. git-o-name. svn-o-path. /classes \)-prune-o-not-iregex '. *\. \ (jar \ | gif \ | jpg \ | class \ | exe \ | dll \ | pdd \ | sw [op] \ | xls \ | doc \ | pdf \ | zip \ | tar \ | ico \ | ear \ | war \ | dat \). * '-type f-printf "% f \ t % p \ t1 \ n" | sort-f> $ lookup_file my project is only developed in C language, therefore, the source file is relatively simple. if the project uses another development language, you need to modify the script accordingly. After each development process ends or in the middle, manually run scripts to ensure consistency of database and tags files, so as to ensure efficient and correct development.

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.