Create your own high-performance vim programming environment

Source: Internet
Author: User
Tags set background


about Vim
Vim is a text editor developed from VI. Code completion, compilation and error jumps and other convenient programming features are particularly rich, in the programmer is widely used. And Emacs are a favorite editor for Unix-like system users.

Vim Function Overview

Can be fully compatible with the original VI according to the setting
Multi-buffered editing
Any number of split windows (horizontal, vertical)
scripting language with list and dictionary capabilities
You can call Perl,ruby,python,tcl,mzscheme in the script
Word abbreviation function
Dynamic Word Completion
Multiple undo and Redo
Syntax highlighting for more than 400 types of text files
Automatic indentation of more than 40 languages such as C/c++,perl,java,ruby,python
Use the Ctags tab to jump
File recovery after crash
Save restore of cursor position and open buffering State (Session function)
Diff mode for two files with differential, synchronous function
Remote file editing
Omni Complement (context-dependent completion)




vim command plot:




vim after loading the plug-in:




Here is the plugin: #================================================1.ctags (1). The function ctags is very convenient to browse the code, can jump to jump between function, variable and so on. (2). Install first, download the Ctags installation package exuberant Ctags, then unzip and install the command as follows: $ TAR-XZVF ctags-5.7.tar.gz$ cd ctags-5.7$./configure# make# Make in Stall (3). Use the way to your source directory, if your source code is a multi-level directory, go to the top-level directory, run the command in this directory: Ctags-r, at this time in the source directory will generate a tags file I now use my C source directory to do a demo $ cd ~/c/c_project/graph $ ctags-r now use vim to open ~/c/c_project/graph/main.c$vi ~/c/c_project/graph/main.c and then run the command in VIM:: Set Tags=~/c/c_project/graph /tags This command to add the tags file to vim, you can also put this sentence into the ~/.VIMRC, for often programming between different projects, can be set in the. VIMRC: Set tags=tags;// ; Cannot have no set Autochdir (4). Use the method to position the cursor to a function name, press Ctar +], VIM can automatically switch to the definition of the functions! To return simply press CTRL + T. #================================================#= ===============================================2.taglist (1). Features efficient browsing of the source code, which functions like the workpace in Vc/eclipse/netbeans, which lists all the macros in the current file, global variables, function names, and so on. (2). Install download TagList package, and then put the extracted two files Taglist.vim and taglist.txt respectively into the $home/.vim/plugin and $HOME/.vim/doc directory. (3). How to use first add the following statement to your ~/.VIMRC file: Let tlist_ctags_cmd= '/bin/ctags ' at this time, use vim to open a C source file try: Vim ~/vim/src/ MAIN.C enter vim with the following command to open the TagList window.: tlist for easier use, you can join the. vimrc file: Map <silent> <leader>tl:TlistToggle< Cr> This allows you to easily switch between opening and closing the TagList window with the ", tl" command. Here's the "," Is me. VIMRC set leader, you can also set to other, modify in. VIMRC, like my: Let mapleader= "," #======================================== ========#================================================3. Winmanager (1). Functions manage each window, or integrate each window. (2). Install download Winmanager.zip package, unzip the *.vim file into the $HOME/.vim/plugin directory, put the *.txt file in the $HOME/.vim/doc (Help file) directory. (3). Use the method to add the following settings to the. VIMRC: Let G:winmanagerwindowlayouT= ' fileexplorer| Taglist| Bufexplorer ' Nmap <silent> <leader>wm:WMToggle<cr> (4). Use the method in the terminal input vim start vim: $vim in normal mode, type ", WM" can see, Vim left a new two windows: FileExplorer and Bufexplorer, So that we can easily in the FileExplorer window to view the directory, editing and other operations; In the Bufexplorer window, view the current vim already open those files. #================================================#============================== ==================4. C.vim (1). function C/c++-ide for Vim. To put it simply, if the installation is configured, VIM is an IDE that is a C/s + + program that functions like a VC commonly used in Windows. (2). After installing the download Cvim.zip package, copy the archive to the $HOME/.vim directory unzip cvim.zip  Unzip the command (3). Use the method in the terminal with VIM open a C file: $vim hello.c into vim, typing "\im" can find a main function frame so fast and easy to write perfectly. #======================================= ========= attached to my. ~/vimrc file and ~/.vim file tree: ~/VIMRC file: "Syntax enable" supports custom syntax ": Helptags ~/.vim/doc" Generate Help-tags (VIM) set Number "Set Showmode" display mode set nocompatible "Remove annoying about VI consistency mode, avoid some bugs and limitations of the previous version set history=1000" record the number of rows in history set background= Dark "background using black set Autoindent" Vim uses automatic alignment, that is, the current row of the format applied to the next line set Smartindent "according to the above format, intelligent selection of the mode set tabstop=4" Set the TAB key to 4 spaces set shiftwidth=4 "set to use 4 spaces set Showmatch when staggered between rows" sets the matching pattern, similar to when an opening parenthesis is entered matches the corresponding right parenthesis set ruler "during the editing process, In the lower right corner, the status line of the cursor position is displayed filetype on "Reconnaissance file type filetype plugin on" Loading file type plug-in filetype indent on "Loading the relevant indentation file for a specific file type let G:c_mapleader= ', ' "****** ctags start ******" ctags-r "Generate tags file set tags=tags;" Import tags file to vimset autochdirlet mapleader= "," "****** ctags end ******" ****** Taglist start ******map <silent> < Leader>tl:tlisttoggle<cr> "with", tl "command to switch between opening and closing of taglist window let tlist_ctags_cmd = '/usr/bin/ctags ' let Tlist_ Exit_onlywindow = 1let Tlist_show_one_file=1let tlist_onlywindow=1let tlist_use_right_window=0let Tlist_Process_File _always = 1let tlist_sort_type= ' name ' Let Tlist_exit_onlywindow=1let tlist_show_menu=1let tlist_max_submenu_items= 10let tlist_max_tag_length=20let tlist_use_singleclick=0let tlist_auto_open=0let tlist_close_on_select=0let Tlist_ File_fold_auto_close=1let Tlist_gainfocus_on_toggleopen=0let Tlist_process_file_always=1let Tlist_WinHeight=10let Tlist_winwidth=18let tlist_use_horiz_window=0 "Let G:minibufexplmapctabswitchBufs = 1 "****** Taglist end ******" ****** winmanage start ****** "Nmap <silent> <leader>f:firstexplorerwindow <cr> "Jump to Fileexplorerwindow" Nmap <silent> <leader>b:BottomExplorerWindow<cr> " Skip to Taglistwindownmap <silent> <leader>w:WMToggle<cr> "Open Winmanagerlet g:winmanagerwindowlayout=" fileexplorer| Taglist| Bufexplorer ' let G:persistentbehaviour=0let g:winmanagerwidth=25let g:defaultexplorer=1 ' ****** Winmanage end ******~/ . vim file Tree: ~/.vim$ tree.├──colors├──compiler├──c-support│├──codesnippets││├──calloc_double_matrix.c││├──calloc_int_matrix.c││├──main.c││├──main.cc││├──makefile││├──makefile.multi-target.template││├──print_array.cc.noindent││├──print_double_array.c.noindent││└──print_int_array.c.noindent│├──doc││├──changelog││├──c-hotkeys.pdf││└──c-hotkeys.tex│├──rc││├──customization.ctags││├──customization.gvimrc││├──customization.indent.pro││└──customization.vimrc│├──scripts││└──wrapper.sh│├──templates││├──c.comments.template││├──c.cpp.template││├──c.idioms.template││├──cpp.comments.template││├──cpp.cpp.template││├──cpp.idioms.template││├──cpp.preprocessor.template││├──cpp.statements.template││├──c.preprocessor.template││├──c.statements.template││└──templates│└──wordlists│├──c-c++-keywords.list│├──k+r.list│└──stl_index.list├──doc│├──bufexplorer.txt│├──csupport.txt│├──taglist.txt│├──tags│└──winmanager.txt├──ftplugin│├──c.vim│└──make.vim├──indent├──keymap├──plugin│├──bufexplorer.vim│├──c.vim│├──taglist.vim│├──winfileexplorer.vim│├──winmanager.vim│└──wintagexplorer.vim├──readme.csupport└──syntax


Create your own high-performance vim programming environment


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.