Vim configuration file

Source: Internet
Author: User
Tags define function imap set background

Back up a bit more handy configuration file

Set sw=4
Set ts=4
Set ET
Set Smarttab
Set Smartindent
Set LBR
Set FO+=MB
Set SM
Set selection=inclusive
Set Wildmenu
Set Mousemodel=popup

Au FileType php setlocal dict+=~/.vim/dict/php_funclist.dict
Au FileType css setlocal dict+=~/.vim/dict/css.dict
Au FileType c setlocal dict+=~/.vim/dict/c.dict
Au FileType cpp setlocal dict+=~/.vim/dict/cpp.dict
Au FileType scale setlocal dict+=~/.vim/dict/scale.dict
Au FileType javascript setlocal dict+=~/.vim/dict/javascript.dict
Au FileType html setlocal dict+=~/.vim/dict/javascript.dict
Au FileType html setlocal dict+=~/.vim/dict/css.dict

"
"Syntastic Related
Execute Pathogen#infect ()
Let g:syntastic_python_checkers=[' Pylint ']
Let g:syntastic_php_checkers=[' php ', ' phpcs ', ' PHPMD '
"Golang
"Processing ...% (CTRL + C to stop)
Let g:fencview_autodetect=0
Set rtp+= $GOROOT/misc/vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
The show related
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Syntax on
Set CUL "highlight cursor in the row
Set CUC
Set Shortmess=ati "does not display the reminder to help Ugandan children when it starts
Set go= "Do not graph button
"Color Desert" setting background theme
Color Ron Set Background theme
"Color torte" setting background theme
Set Guifont=courier_new:h10:cansi font
"Autocmd insertleave * se nocul" highlight as you move forward with light
Autocmd insertenter * se cul "highlight when moving forward with light
Set ruler "show ruler
Set showcmd "Input command displayed, see clearly
"Set Whichwrap+=<,>,h,l" allows backspace and cursor keys to span line boundaries (not recommended)
Set scrolloff=3 "The cursor moves to the top and bottom of buffer to maintain 3 lines of distance
Set statusline=%f%m%r%h%w\ [format=%{&ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\%{strftime (\ "%d/%m/%y\-\%H:%M\")} " What the status line displays
Set laststatus=2 "Start Display status line (1), always show status line (2)
"Set Foldenable" allows folding
"Set foldmethod=manual" manual folding
Set nocompatible "Remove nasty about VI consistency mode, avoid some bugs and limitations of previous versions
The show Chinese help
If version >= 603
Set HELPLANG=CN
Set Encoding=utf-8
endif
The Auto Indent
Set Autoindent
Set Cindent
The width of the TAB key
Set tabstop=4
"Unified Indentation is 4
Set softtabstop=4
Set shiftwidth=4
"Do not use spaces instead of tabs
Set Expandtab
Use tabs at the beginning of rows and segments
Set Smarttab
The Display line number
Set number
"Number of historical records
Set history=1000
"Search for verbatim Fugauliang
Set Hlsearch
Set Incsearch
The Language settings
Set LANGMENU=ZH_CN. UTF-8
Set HELPLANG=CN
"Always Show status lines
Set cmdheight=2
"Detect file Types
FileType on
"Load file type plug-in
FileType plugin on
"Loading related indentation files for a specific file type
FileType indent on
"Save Global variables
Set viminfo+=!
"Words with the following symbols are not separated by line breaks
Set iskeyword+=_,$,@,%,#,-
The number of pixel lines inserted by the word putting

The markdown Configuration
Au bufread,bufnewfile *. {MD,MDOWN,MKD,MKDN,MARKDOWN,MDWN} set FILETYPE=MKD
Au bufread,bufnewfile *. {Go} set Filetype=go
Au bufread,bufnewfile *. {JS} set Filetype=javascript
"Rkdown to HTML
Nmap MD:!~/.vim/markdown.pl% >%.html <CR><CR>
Nmap fi:!firefox%.html & <CR><CR>
Nmap \ \CC
VMAP \ \CC

"Replace the tab with a space
Nmap TT:%s/\t//g<cr>

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" "" "New file title
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Create a new. c,.h,.sh,.java file, insert the file header automatically
Autocmd bufnewfile *.cpp,*. [ch],*.sh,*.java,*.py exec]: Call Settitle () "
"" Define function Settitle, insert file header automatically
Func Settitle ()
"If the file type is. sh file
if &filetype = = ' sh '
Call Setline (1, "\#!/bin/bash")
Call Append ("."), "")
ElseIf &filetype = = ' Python '
Call Setline (1, "#!/usr/bin/env python")
Call Append ("."), "# Coding=utf-8")
Call Append (".") +1, "")
"ElseIf &filetype = = ' MKD '
"Call Setline (1," Else
Call Setline (1, "/*************************************************************************")
Call Append ("."), "> File Name:" Expand ("%"))
Call Append (".") +1, "> author:ma6174")
Call Append (".") +2, "> Mail: [email protected]")
Call Append (".") +3, "> Created time:". Strftime ("%c"))
Call Append (".") +4, "************************************************************************/")
Call Append (".") +5, "")
endif
if &filetype = = ' cpp '
Call Append (".") +6, "#include <iostream>")
Call Append (".") +7, "using namespace std;")
Call Append (".") +8, "")
endif
if &filetype = = ' C '
Call Append (".") +6, "#include <stdio.h>")
Call Append (".") +7, "")
endif
"If &filetype = = ' java '
"Call Append (". ") +6, "public class". Expand ("%"))
"Call Append (". ") +7, "")
"EndIf
"Automatically navigates to the end of a file after you create a new file
Endfunc
Autocmd Bufnewfile * Normal G


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
The keyboard command
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
: Nmap <silent> <F9> <ESC>:Tlist<RETURN>
map! <C-Z> <esc>zzi
map! <C-O> <c-y>
Map <C-A> ggvg$ "+y
Map <F12> gg=g
Map <C-w> <c-w>w
IMAP <C-k> &LT;C-Y&GT;
IMAP <C-j> <ESC>
"CTRL + C copy in selected state
"Map <C-v>" *pa
IMAP <C-v> <Esc> "*pa
IMAP <C-a> <esc>^
IMAP <C-e> <esc>$
Vmap <C-c> "+y
Set Mouse=v
The Set clipboard=unnamed
"Go empty line
Nnoremap <F2>:g/^\s*$/d<cr>
The Compare files
Nnoremap <C-F2>: Vert diffsplit
"Nnoremap <Leader>fu:CtrlPFunky<Cr>
"Nnoremap <C-n>:ctrlpfunky<cr>
"Lists the current directory files
Map <F3>:nerdtree<cr>
"Open the tree-like file directory
Map <C-F3> \be
: Autocmd bufread,bufnewfile *.dot map <F5>: w<cr>:!dot-tjpg-o%<.jpg% && EOG%<.jpg <cr&gt ;<cr> && Exec "redr!"
"C,c++ Press F5 to compile and run
Map <F5>: Call COMPILERUNGCC () <CR>
func! COMPILERUNGCC ()
Exec "W"
if &filetype = = ' C '
Exec "!g++%-O%<"
Exec "!time ./%<"
ElseIf &filetype = = ' cpp '
Exec "!g++%-O%<"
Exec "!time ./%<"
ElseIf &filetype = = ' java '
Exec "!javac%"
exec "!time java%<"
ElseIf &filetype = = ' sh '
:!time Bash%
ElseIf &filetype = = ' Python '
Exec "!time python2.7%"
ElseIf &filetype = = ' html '
Exec "!firefox% &"
ElseIf &filetype = = ' Go '
"Exec"!go build%< "
Exec "!time Go run%"
ElseIf &filetype = = ' MKD '
Exec "!~/.vim/markdown.pl% >%.html &"
Exec "!firefox%.html &"
endif
Endfunc
"Commissioning of the C,c++
Map <F8>: Call Rungdb () <CR>
func! Rungdb ()
Exec "W"
Exec "!g++%-g-o%<"
Exec "!gdb ./%<"
Endfunc


"Code format optimization

Map <F6>: Call FORMARTSRC () <CR><CR>

"Define FORMARTSRC ()
Func formartsrc ()
Exec "W"
if &filetype = = ' C '
Exec "!astyle--style=ansi-a--suffix=none%"
ElseIf &filetype = = ' cpp ' | | &filetype = = ' HPP '
Exec "R!astyle--style=ansi--one-line=keep-statements-a--suffix=none%>/dev/null 2>&1"
ElseIf &filetype = = ' Perl '
Exec "!astyle--style=gnu--suffix=none%"
ElseIf &filetype = = ' py ' | | &filetype = = ' Python '
Exec "R!autopep8-i--aggressive%"
ElseIf &filetype = = ' java '
Exec "!astyle--style=java--suffix=none%"
ElseIf &filetype = = ' jsp '
Exec "!astyle--style=gnu--suffix=none%"
ElseIf &filetype = = ' xml '
Exec "!astyle--style=gnu--suffix=none%"
Else
Exec "Normal gg=g"
Return
endif
EXEC "E! %"
Endfunc
"End Definition Formartsrc

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Utility settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
If has ("Autocmd")
Autocmd Bufreadpost *
\ If line ("' \" ") > 0 && line (" ' \ "") <= Line ("$") |
\ exe "normal g ' \" "|
\ endif
endif
"Automatically opens Nerdtree when Vim is turned on and no files are open
Autocmd Vimenter * If!ARGC () | Nerdtree | endif
"Automatically shuts down when only Nerdtree is left
Autocmd Bufenter * if (WINNR ("$") = = 1 && exists ("B:nerdtreetype") && B:nerdtreetype = = "PRIMARY") | Q | endif

"Set to automatically load when files are changed
Set Autoread
"Quickfix mode
Autocmd FileType c,cpp map <buffer> <leader><space>:w<cr>:make<cr>
The Code completion
Set Completeopt=preview,menu
The Allow plugins
"FileType plugin on
The Share clipboard
The Set clipboard+=unnamed
The Auto Save
Set Autowrite
"Set ruler" to open the status bar ruler
"Set Cursorline" highlights when moving forward
Set Magic
Set Guioptions-=t "Hide the toolbar
Set guioptions-=m "Hide Menu bar
"" Set foldcolumn=0
"" Set Foldmethod=indent
"" Set foldlevel=3
"Don't use VI's keyboard mode, but Vim's own
Set nocompatible
"Remove the sound of input errors
Set Noeb
"When working with unsaved or read-only files, pop-up confirmation
Set confirm
"Prohibit generation of temporary files
Set Nobackup
Set Noswapfile
"Search ignores case
Set ignorecase


Set linespace=0
"Command-line auto-complete operation in enhanced mode
Set Wildmenu
"Make the Back bar (BACKSPACE) normal handling indent, EOL, start, etc.
Set backspace=2
"Allow backspace and cursor keys to span line boundaries
Set Whichwrap+=<,>,h,l
"You can use the mouse anywhere in the buffer (similar to the workspace in office, double-click the mouse to navigate)
Set Mouse=a
Set selection=exclusive
Set Selectmode=mouse,key
"By using: Commands command, tell us which line of the file has been changed
Set report=0
"Display whitespace between split windows for easy reading
Set Fillchars=vert:\, Stl:\, Stlnc:\
"Highlight matching parentheses
Set Showmatch
"Matches the time of the parentheses highlighting (in a very second)
Set matchtime=1
"Keep 3 lines away when the cursor moves to the top and bottom of the buffer
Set scrolloff=3
"Provides automatic indentation for C programs
"Auto-complete
"": 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
"Open File type detection, add this sentence can be used to complete the smart
Set Completeopt=longest,menu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"The setting of the Ctags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Let Tlist_sort_type = "name" "Sort by name"
Let Tlist_use_right_window = 1 "Display window on the right
Let Tlist_compart_format = 1 "compression mode
Let Tlist_exist_onlywindow = 1 "Kill buffer if only one buffer,kill window is killed
"Let Tlist_file_fold_auto_close = 0" Do not close other files of tags
"Let Tlist_enable_fold_column = 0" Do not show collapsed tree
"Let tlist_show_one_file=1" does not display the tag of multiple files at the same time, only displays the current file's
The Set tags
The Set Tags=tags
The Set Autochdir

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Other Stuff
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
The default open TagList
Let Tlist_auto_open=0
""""""""""""""""""""""""""""""
"Tag list (ctags)
""""""""""""""""""""""""""""""""
Let Tlist_ctags_cmd = '/usr/local/bin/ctags '
Let Tlist_show_one_file = 1 "does not display the tag of multiple files at the same time, only displays the current file's
Let Tlist_file_fold_auto_close = 1
Let Tlist_exit_onlywindow = 1 "If the TagList window is the last window, exit vim
Let Tlist_use_right_window = 1 "Displays the TagList window in the right window
"General settings for the MINIBUFEXPL plugin
Let G:minibufexplmapwindownavvim = 1
Let G:minibufexplmapwindownavarrows = 1
Let G:minibufexplmapctabswitchbufs = 1
Let G:minibufexplmodseltarget = 1
Nmap tl:tlist<cr>

The Input Method
: Let g:vimim_map= ' c-/'
": Let g:vimim_cloud= ' Sougou '" QQ cloud input
: Let g:vimim_punctuation=0 "do not use Chinese punctuation
: Set pastetoggle=<c-h>
: Let G:vimim_cloud=-1


The Python complement
Let g:pydiction_location = ' ~/.vim/after/complete-dict '
Let G:pydiction_menu_height = 20
Let tlist_ctags_cmd= '/usr/local/bin/ctags '
Let G:minibufexplmapwindownavvim = 1
Let G:minibufexplmapwindownavarrows = 1
Let G:minibufexplmapctabswitchbufs = 1
Let G:minibufexplmodseltarget = 1


Set iskeyword+=.
Set Termencoding=utf-8
Set Encoding=utf8
Set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030

Autocmd FileType python set Omnifunc=pythoncomplete#complete

"Set nocompatible" be improved
"FileType off" required!

Set rtp+=~/.vim/bundle/vundle/
Call VUNDLE#RC ()

"Let Vundle manage Vundle
"Required!
Bundle ' Gmarik/vundle '

My Bundles here:
"
" original repos on GitHub
Bundle ' tpope/vim-fugitive '
Bundle ' rstacruz/sparkup ', {' RTP ': ' vim/'}
Bundle ' yggdroot/indentline '
let G:indentline_char = ' ┊ '
' ndle ' tpope/vim-rails.git '
' Vim-scripts Repos
Bundle ' L9 '
Bundle ' fuzzyfinder '
' non github repos
Bundle ' git://git.wincent.com/ Command-t.git '
Bundle ' auto-pairs '
Bundle ' python-imports.vim '
Bundle ' captureclipboard '
Bundle ' Ctrlp-modified.vim '
Bundle ' last_edit_marker.vim '
Bundle ' synmark.vim '
' bundle ' Python-mode-klen '
Bundle ' Sqlcomplete.vim '
Bundle ' javascript-omnicompletion-with-yui-and-j '
' bundle ' javascript-indent '
' Bundle ' better-javascript-indentation '
Bundle ' jslint.vim '
Bundle ' pangloss/vim-javascript '
Bundle ' Vim-script-updater '
Bundle ' ctrlp.vim '
Bundle ' tacahiroy/ctrlp-funky '
Bundle ' jsbeautify '
Bundle ' The-nerd-commenter '
' Django
Bundle ' Django_templates.vim '
Bundle ' django-projects '

"Bundle ' Fredkschott/covim '
"Bundle ' Djangojump '
" ...
Let g:html_indent_inctags = "Html,body,head,tbody"
Let G:HTML_INDENT_SCRIPT1 = "Inc"
Let G:html_indent_style1 = "Inc"

FileType plugin indent on "required!
"
"Brief Help
": Bundlelist-list configured Bundles
": Bundleinstall (!) -Install (update) Bundles
": Bundlesearch (!) Foo-search (or refresh cache first) for Foo
": Bundleclean (!) -Confirm (or auto-approve) removal of unused bundles
"
"See:h Vundle for more details or wiki for FAQ
"Note:comments after Bundle command is not allowed.
"
"
The CTRLP settings
"
Set Wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.png,*.jpg,*.gif "Macosx/linux
Set Wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe,*.pyc,*.png,*.jpg,*.gif "Windows

Let G:ctrlp_custom_ignore = ' \v[\/]\. (GIT|HG|SVN) $ '
Let G:ctrlp_custom_ignore = ' \v\. (Exe|so|dll) $ '
Let g:ctrlp_extensions = [' Funky ']

Let nerdtreeignore=[' \.pyc ']

Vim configuration file

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.