Gvim and Vim

Source: Internet
Author: User

Use Gvim and Vim to decompress the compressed package to/home/hostname/, including. vimrc ,. gvimrc file and. the vim folder overwrites the existing one. Then install the ctags and cs.pdf command: sudoapt-get install exuberant-ctagssudoapt-get install cs.pdf (in. gvimrc and. in vimrc) define your own shortcut command method. In vim normal mode, directly press the required command "common abbreviated command! There must be a space next to nmapcd: cdnmapls :! Ls note: In vim normal mode, enter ": ls" to view the list of all files opened at the same time, different from ":! Ls "nmapgcc :! Gccnmapgl :! Gcc-lGL-lGLU-lglunmapw: wnmapwq: wqnmapmk :! Mkdirnmaptch :! Touchnmapcp :! Cpnmaprm :! Rmnmapmake :! Make lookup function, variable definition: ctags (not powerful in csags) to generate the tags file: in the source code "root directory" you want to view ", run ctags-R -- c ++-kinds = + px -- fields = + iaS-extra = + q or press the "Ctrl + F12" shortcut to generate the tags file, the file size is similar to the total size of the source code of the Project. Use: Case "Ctrl +]" to jump to the function or variable definition, press "Ctrl + t" to jump back to the upper level, similar to the stack Operation Note: if you do not find the function you want (for the reason that there is a function with the same name), type ": ts" to view all functions with the same name, select the function you want to view ts <==> tagslist in. generate tags in the corresponding folders of vim/sourceCode so that the function you want to search for is no longer used in your project, such as the Standard C library, C ++ library, or Java library; then. run the following command in vimrc: settags = tagssettags + =. /tags ,.. /tags,. /*/Tagssettags + =/home/hostname /. vim/sourceCode/glibc-2.16.0/tagssettags + =/home/hostname /. vim/sourceCode/stdcpp_for_ctags/tags the first line is to find the tags file in the current directory of the open source file; the second line is to find the tags file in the parent directory or in the more advanced parent path; three or four rows are used to load the tags file in a specific directory (in the function library you need). According to the above method, construct the function library you need to press F2 to open and close the "File Browser" and "member variables and (member) function Browser" to find the function. variable definition: cs.pdf press F5 to generate cs.pdf. files, csfiles. in. out, csflood. out, csflood. po. the tags shortcut key is also generated at the same time. (press Ctrl + \ and then press another letter. You can change the shortcut key in the configuration file and note the conflict.) Ctrl + \ s: Find the C language symbol, that is, find the location where the function name, Macro, enumeration value, and so on appear Ctrl + \ g: Find the location defined by function, Macro, enumeration, etc, similar to the function Ctrl + \ d provided by ctags: Find the function Ctrl + \ c called by this function: Find the function Ctrl + \ t called by this function: find the specified string Ctrl + \ e: Find the egrep mode, equivalent to the egrep function, but the search speed is much faster Ctrl + \ f: Find and open the file, similar to the find function of vim Ctrl + \ I: find the text that contains this file and continue to press Ctrl +]. The search results will be displayed in QuickFix, you can press the F3 key to directly call up the configuration file in the QuickFix window, and search for csfix from the subdirectory to the parent directory. out to automatically load csflood. when you press F4. When you press F4. When you press F4. When you press F4. When you press F4. When you press F6. when you press F6. when you press F6, grep cannot be used. Press Ctrl + Up, Ctrl + Down, or Ctrl + Left, Ctrl + Right (Ctrl + arrow) switch the buffer position in the window where the cursor is located, equivalent to Ctrl + w. However, the F9 key is better for one-click compilation, ctrl is the function of compiling and running. It is only valid for simple projects. We recommend that you do not use it. You can write your own Makefile to implement the auto-completion function {}, [], '',". If you do not want to use it, can be removed. gvimrc and. in vimrc, "{} []'' "" and other auto-Completions "is used to configure the block OmniCppComplete (class member or namespace complementing function:-> ,. note: When writing a Class header file, be sure to generate the tags file again (this is a waste of time for a large project) to manage multiple file columns of this function "minibufexpl. use of vim: bn open the next buffer of the Current buffer: bp open the previous buffer of the Current buffer: ls currently open buf: e <filename> open file: B <Tab> auto-completion: bd deletes the bufd and stops the cursor on the buffer bar. Delete the buffer where the cursor is located: bnum to open the specified buffer. num refers to the number starting with the buffer. For example, I want to open a file whose buffer value is 7. Input "b7" and set the shortcut key "nmapvim: e". In vim, only one file can be opened each time and multiple files cannot be opened, in gvim, The nmapbd: bd F10 key is used to annotate the row where the cursor is located, and F11 is used to cancel the comment (the row where the cursor is located) and "space" to fold and open a block, including {},/**/, and other snippets plug-ins (Quick insertion of common structures). The specific language is ~ /. In the vim/snippets/directory, open the files in the corresponding language and view the common structure For use. Structure Features: note the usage method # For Loopsnippetforfor ($ {1: I} = 0; $1 <$ {2: count}; $1 $ {3: ++}) {4 {4:/* code */}}# If Conditionsnippetifif ($ {1: /* condition */}) {$ {2:/* code */} snippetefelseif ($ {1:/* condition */}) {$ {2: /* code */} snippetelelse {$ {1} and above are examples: for Loop: Type: for and press the Tab key, the program inserts the for code block for (I = 0; I <count; I ++) {/* code */} corresponding to the original structure: press the tab key to jump to the corresponding block {}. The order is numerical order for ($ {1: I} = 0; $1 <$ {2: co Unt}; $1 $ {3: ++}) {$ {4:/* code */} if structure: Type: if and press the Tab key, the program inserts the if code block if (/* condition */) {/* code */}. Type: ef and press the Tab key, the program inserts the elseif code block elseif (/* condition */) {/* code */}. Type: el and press the Tab key, the program inserts the else code block, else {}, and other structures to view ~ /. File Content in the vim/snippets/directory 15. the prompt of the function parameter list and the implementation of the complete function; code_complete.vim is also implemented based on the tags file. For example, the ITutorial class contains the member function declaration: boolframeRenderingQueued (const Ogre :: frameEvent & evt); Purpose 1: Re-generate the tags file when writing the header file during function definition, and then in the implementation file boolframeRenderingQueued (stay at the brackets, (In vim insert mode) press Ctrl +] to display the list of complete parameters of the function. If there are multiple parameters, select the one you want. Purpose 2: when calling a function (in vim insertion mode), press Ctrl + j to display the list of prompt parameters for the function. If there are multiple parameters, select the one you want; pay attention to the difference and press Ctrl + j again. The cursor will jump to: Enter the parameter as prompted. If there are multiple parameters, enter one parameter, and then press Ctrl + j ", jump to another place, and so on; until the parameter is specified

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.