"/Etc/vim/vimrc is the configuration of all users ,~ /. Vimrc only affects a single user. /Usr/share/vim/vimrc is a hard link of/etc/vim/vimrc ($ ll/usr/share/vim/vimrc can be seen). Generally, only ~ /. Vimrc.
"Colors, plugins, and docs are all in the VIMRUNTIME directory. You can enter echo $ VIMRUNTIME in vim command mode first (if you have not modified it yourself, usually/usr/share/vim/vim7x), and then download the molokai you downloaded. copy vim to the following colors folder.
"Color switching scheme: colorscheme molokai (only for once) can also be added to. vimrc (every time). It takes effect only after it is restarted.
Colorscheme sean "I put it in 74 xiamian, it should be in 73
"Set background = dark" background black
Set nu
"Set go = removed the toolbar:
Syntax on "code highlighting
Autocmd InsertLeave * se nocul "highlight the current line with a light color
Autocmd InsertEnter * se cul "highlight the current line with a light color
Set ruler "display ruler
Set showcmd "the input command is displayed, which is clear.
"Confirmation pops up when processing unsaved or read-only files
Set confirm
"Auto indent
Set autoindent
Set cindent
"Tab key width
Set tabstop = 4
"Unified indent to 4
Set softtabstop = 4
Set shiftwidth = 4
"Do not use spaces instead of tabs
Set noexpandtab
"Use a tab at the beginning of a row and segment
Set smarttab
"Display row number
Set number
"Number of historical records
Set history = 1000
"Do not generate temporary files
Set nobackup
Set noswapfile
"Case-insensitive search
Set ignorecase
"Search for highlighted characters by character
Set hlsearch
Set incsearch
"Intra-row replacement
Set gdefault
"Settings
"Set automatic loading when the file is changed
Set autoread
"Quickfix Mode
Autocmd FileType c, cpp map <buffer> <leader> <space>: w <cr>: make <cr>
"Code Completion
Set completeopt = preview, menu
"Allow plug-ins
Filetype plugin on
"Share clipboard
Set clipboard + = unnamed
Set smartindent "smart alignment
Set magic "magic
"Encoding settings
Set enc = UTF-8
Set fencs = UTF-8, ucs-bom, shift-jis, gb18030, gbk, gb2312, cp936
"Language settings
Set langmenu = zh_CN.UTF-8
Set helplang = cn
Set langmenu = zh_CN.UTF-8
Set helplang = cn
"Content displayed in my status line (including file type and decoding)
"Set statusline = % F % m % r % h % w \ [FORMAT = % {& ff}] \ [TYPE = % Y] \ [POS = % l, % v] [% p %] \%{ strftime (\ "% d/% m/% y \-\ % H: % M \")}
"Set statusline = [% F] % y % r % m % * % = [Line: % l/% L, Column: % c] [% p %]
"Always show status line
Set laststatus = 2
"The height of the command line (under the Status line). The default value is 1. Here is 2.
Set bytes Height = 2
"File type detection
Filetype on
"Load file type plug-in
Filetype plugin on
"Load indent files for a specific file type
Filetype indent on
"Save global variables
Set viminfo + =!
"Do not separate words with the following symbols by line breaks
Set iskeyword + =_, $, @, % ,#,-
"Number of pixel rows inserted between characters
Set linespace = 0
"The command line in enhanced mode automatically completes the operation
Set wildmenu
"Enable backspace to process indent, eol, start, and so on.
Set backspace = 2
"Allow backspace and cursor keys to span row boundaries
Set whichwrap + = <,>, h, l
"You can use the mouse anywhere in the buffer (similar to double-click the mouse in the workspace in office to locate the location)
Set mouse =
Set selection = exclusive
Set selectmode = mouse, key
"The commands command tells us which row of the file has been changed.
Set report = 0
"White space is displayed between Split windows for ease of reading
Set fillchars = vert: \, stl: \, stlnc :\
"Highlight matching brackets
Set showmatch
"Matching the time when brackets are highlighted (unit: 10 seconds)
Set matchtime = 1
"Move the cursor to the top and bottom of the buffer to keep the distance between three rows
Set scroloff = 3
"Provides automatic indentation for C Programs
Set novisualbell "Do Not flash (do not understand)
Set statusline = % F % m % r % h % w \ [FORMAT = % {& ff}] \ [TYPE = % Y] \ [POS = % l, % v] [% p %] \%{ strftime (\ "% d/% m/% y \-\ % H: % M \")} "status line display content
Set laststatus = 1 "Start display status line (1), always display status line (2)
Set foldenable "folding allowed
Set foldmethod = manual "manual folding
"Set background = dark" background black
Set nocompatible "removes the annoying vi consistency mode to avoid bugs and limitations in earlier versions.
"Show Chinese help
If version> = 603
Set helplang = cn
Set encoding = UTF-8
Endif
Set fencs = UTF-8, ucs-bom, shift-jis, gb18030, gbk, gb2312, cp936
Set termencoding = UTF-8
Set encoding = UTF-8
Set fileencodings = ucs-bom, UTF-8, cp936
Set fileencoding = UTF-8
"Create A. c,. h,. sh,. java file and insert the file header automatically.
Autocmd BufNewFile *. cpp, *. [ch], *. sh, *. java exec ": call SetTitle ()"
"" Defines the SetTitle function to automatically insert a file header.
Func SetTitle ()
"If the file type is. sh
If & filetype = 'sh'
Call setline (1, "\###################################### ###################################")
Call append (line ("."), "# File Name:". expand ("% "))
Call append (line (".") + 1, "# Author: yubo ")
Call append (line (".") + 2, "# mail: yuzibode@126.com ")
Call append (line (".") + 3, "\ # Created Time:". strftime ("% c "))
Call append (line (". ") + 4, "\###################################### ###################################")
Call append (line (".") + 5 ,"\#! /Bin/bash ")
Call append (line (".") + 6 ,"")
Else
Call setline (1, "/************************************** ***********************************")
Call append (line ("."), "File Name:". expand ("% "))
Call append (line (".") + 1, "Author: yubo ")
Call append (line (".") + 2, "Mail: yuzibode@126.com ")
Call append (line (".") + 3, "Created Time:". strftime ("% c "))
Call append (line (". ") + 4, "*************************************** *********************************/")
Call append (line (".") + 5 ,"")
Endif
If & filetype = 'cpp'
Call append (line (".") + 6, "# include <iostream> ")
Call append (line (".") + 7, "using namespace std ;")
Call append (line (".") + 8 ,"")
Endif
If & filetype = 'C'
Call append (line (".") + 6, "# include <stdio. h> ")
Call append (line (".") + 7 ,"")
Endif
"After a new file is created, it is automatically located at the end of the file.
Autocmd BufNewFile * normal G
Endfunc
"""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""
"Keyboard Command ????
"""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""
"Nmap <leader> w: w! <Cr>
"Nmap <leader> f: find <cr>
"Select all ing + copy ctrl +
Map <C-A> ggVGY
Map! <C-A> <Esc> ggVGY
Map <F12> gg = G
"Ctrl + c copy in selected state
Vmap <C-c> "+ y
"In the command line, press F2
Nnoremap <F2>: g/^ \ s * $/d <CR>
"Compare files
Nnoremap <C-F2>: vert diffsplit
"New tag
Map <M-F2>: tabnew <CR>
"List current directory files
Map <F3>: tabnew. <CR>
"Open the tree file directory
Map <C-F3> \ be
"C, C ++ compile and run by F5
Map <F5>: call CompileRunGcc () <CR>
Func! CompileRunGcc ()
Exec "w"
If & filetype = 'C'
Exec "! G ++ %-o % <"
Exec "! ./% <"
Elseif & filetype = 'cpp'
Exec "! G ++ %-o % <"
Exec "! ./% <"
Elseif & filetype = 'java'
Exec "! Javac %"
Exec "! Java % <"
Elseif & filetype = 'sh'
:!. /%
Endif
Endfunc
Debugging of "C, C ++
Map <F8>: call Rungdb () <CR>
Func! Rungdb ()
Exec "w"
Exec "! G ++ %-g-o % <"
Exec "! Gdb./% <"
Endfunc
"""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""
"" Practical settings
Debugging of "C, C ++
Map <F8>: call Rungdb () <CR>
Func! Rungdb ()
Exec "w"
Exec "! G ++ %-g-o % <"
Exec "! Gdb./% <"
Endfunc
"Auto-completion
: Inoremap () <ESC> I
: Inoremap) <c-r> = ClosePair (') <CR>
: Inoremap {<CR >}< ESC> O
: Inoremap} <c-r >= ClosePair ('}') <CR>
: Inoremap [[] <ESC> I
: Inoremap] <c-r> = ClosePair (']') <CR>
: Inoremap "" <ESC> I
: Inoremap ''' <ESC> I
Function! ClosePair (char)
If getline ('.') [col ('.')-1] = a: char
Return "\ <Right>"
Else
Return a: char
Endif
Endfunction
Filetype plugin indent on
"Enable the file type check. You can use this sentence to complete it intelligently.
Set completeopt = longest, menu
"CTags settings
"""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""
Let Tlist_Sort_Type = "name" "sorted by name
Let Tlist_Use_Right_Window = 1 "display the window on the right
Let Tlist_Compart_Format = 1 "compression mode
Let Tlist_Exist_OnlyWindow = 1 "if there is only one buffer, the kill window also kill the buffer.
Let Tlist_File_Fold_Auto_Close = 0 "do not close the tags of other files
Let Tlist_Enable_Fold_Column = 0 "do not display the folding tree
Autocmd FileType java set tags + = D: \ tools \ java \ tags
"Autocmd FileType h, cpp, cc, c set tags + = D: \ tools \ cpp \ tags
"Let Tlist_Show_One_File = 1" does not display the tags of multiple files at the same time, only displays
"Set tags
Set tags = tags
"Set autochdir
"Other things
"""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""
"Open Taglist by default
Let Tlist_Auto_Open = 1
""""""""""""""""""""""""""""""
"Tag list (ctags)
""""""""""""""""""""""""""""""""
Let Tlist_Ctags_Cmd = '/usr/bin/ctags'
Let Tlist_Show_One_File = 1 "the tag of multiple files is not displayed at the same time, only
Let Tlist_Exit_OnlyWindow = 1 "if the taglist window is the last window, exit vim
Let Tlist_Use_Right_Window = 1 "display the taglist window on the right
Plug-ins: