Requirements: Use VIM to develop Python for simple configuration
CD to the user host directory vim. VIMRC paste the following:
Version One:
Set Encoding=utf-8
"Remove the consistency of VI"
Set nocompatible
"Show line number"
Set number
Set Nobackup
Set NOWB
Set Noswapfile
Set Noundofile
Set ShowCmd
"Hide scroll bar"
The Set Guioptions-=r
The Set Guioptions-=l
The Set Guioptions-=b
"Hide Top tab Bar"
The Set showtabline=0
"Set Font"
The Set Guifont=monaco:h13
Syntax on "Turn on syntax highlighting"
"Let g:solarized_termcolors=256" solarized theme settings under Terminal Settings "
Set Background=dark "Setting background color"
"ColorScheme Ron
"ColorScheme Peaksea
Set nowrap "Do not fold rows"
Set Fileformat=unix "Settings to save files in UNIX format"
Set cindent "format C-style indent"
Set tabstop=4 "Setting table Length"
Set softtabstop=4
Set Noexpandtab
Set shiftwidth=4 "ditto"
Set Showmatch "Show matching parentheses"
Set scrolloff=5 "distance from top and bottom 5 rows"
Set laststatus=2 "command behavior two lines"
Set fenc=utf-8 "File Encoding"
Set backspace=2
Set mouse=c "Enable Mouse"
Set selection=exclusive
Set Selectmode=mouse,key
The Set matchtime=5
Set ignorecase "Ignore case"
The Set Incsearch
Set Hlsearch "Highlight Search Items"
"Set Noexpandtab" does not allow extended table "
Set Whichwrap+=<,>,h,l
Set Autoread
"Set Cursorline" highlights the current line "
"Set Cursorcolumn" highlights the current column "
The C + + part
Set EXRC
Set secure
Augroup Project
autocmd!
Autocmd bufread,bufnewfile *.h,*.c Set Filetype=c.doxygen
Autocmd bufread,bufnewfile *.hpp,*.cpp Set Filetype=cpp.doxygen
Augroup END
Set makeprg=make\-c\-j64
Nnoremap <F3>:make!<cr>
"Vundle
FileType off
Set Rtp+=~/.vim/bundle/vundle.vim
Call Vundle#begin ()
Plugin ' Vundlevim/vundle.vim '
Plugin ' Valloric/youcompleteme '
Plugin ' Lokaltog/vim-powerline '
Plugin ' Scrooloose/nerdtree '
Plugin ' Yggdroot/indentline '
Plugin ' Jiangmiao/auto-pairs '
Plugin ' TELL-K/VIM-AUTOPEP8 '
Plugin ' Scrooloose/nerdcommenter '
Call Vundle#end ()
FileType plugin indent on
"Run Python by F5"
Map <F5>:autopep8<cr>:w<cr>: Call Runpython () <CR>
function Runpython ()
Let MP = &MAKEPRG
Let EF = &errorformat
Let Exefile = expand ("%:t")
Setlocal makeprg=python\-U
Set efm=%c\%.%#,%a\ \ file\ \ "%f\" \\,\ line\%l%.%#,%z%[%^\]%\ \@=%m
Silent Make%
Copen
Let &MAKEPRG = MP
Let &errorformat = EF
Endfunction
"Run Python debugging by F9"
Map <F9>:autopep8<cr>:w<cr>: Call Runpythondebug () <CR>
function Runpythondebug ()
Let MP = &MAKEPRG
Let EF = &errorformat
Let Exefile = expand ("%:t")
setlocal makeprg=python\-m\ PDB
Set efm=%c\%.%#,%a\ \ file\ \ "%f\" \\,\ line\%l%.%#,%z%[%^\]%\ \@=%m
Silent Make%
Copen
Let &MAKEPRG = MP
Let &errorformat = EF
Endfunction
"Youcompleteme
"Default profile Path"
Let g:ycm_global_ycm_extra_conf = ' ~/.vim/bundle/youcompleteme/third_party/ycmd/examples/.ycm_extra_conf.py '
"No longer asks whether to load ycm_extra_conf.py configuration when Vim is turned on"
Let G:ycm_confirm_extra_conf=0
Set Completeopt=longest,menu
"Python Interpreter Path"
Let g:ycm_path_to_python_interpreter= '/usr/bin/python '
"Whether semantic completion is turned on"
Let G:ycm_seed_identifiers_with_syntax=1
"Do you want to turn on completion in comments?"
Let G:ycm_complete_in_comments=1
Let g:ycm_collect_identifiers_from_comments_and_strings = 0
"Number of characters to start the completion"
Let g:ycm_min_num_of_chars_for_completion=2
Auto Power off preview window after completion
Let G:ycm_autoclose_preview_window_after_completion=1
"Disable cache matches, regenerate matches every time"
Let g:ycm_cache_omnifunc=0
"The complement is also turned on in the string"
Let g:ycm_complete_in_strings = 1
"Automatically close preview window after leaving insert mode"
Autocmd Insertleave * If pumvisible () = = 0|pclose|endif
"Enter to select the current item"
"Inoremap <expr> <CR> pumvisible ()?" <C-y> ': ' \<cr> '
"Up and down key behavior"
Inoremap <expr> <Down> pumvisible ()? ' \<c-n> ': ' \<down> '
Inoremap <expr> <Up> pumvisible ()? ' \<c-p> ': ' \<up> '
Inoremap <expr> <PageDown> pumvisible ()? ' \<pagedown>\<c-p>\<c-n> ': ' \<pagedown> '
Inoremap <expr> <PageUp> pumvisible ()? ' \<pageup>\<c-p>\<c-n> ': ' \<pageup> '
"Youcompleteme clang settings
Let g:clang_format#style_options = {
\ "Accessmodifieroffset":-4,
\ "Allowshortifstatementsonasingleline": "true",
\ "Alwaysbreaktemplatedeclarations": "true",
\ "Standard": "C++11"}
Let G:clang_format#auto_format=1
"Nerd Tree
"F2 open and close the tree"
Map <F2>:nerdtreetoggle<cr>
Let nerdtreechdirmode=1
"Show Bookmarks"
Let Nerdtreeshowbookmarks=1
"Set Ignore file Types"
Let nerdtreeignore=[' \~$ ', ' \.pyc$ ', ' \.swp$ ']
"Window Size"
Let nerdtreewinsize=25
Indent indicator Line
Let g:indentline_char= ' ┆ '
Let g:indentline_enabled = 1
"Autopep8 Settings"
Let G:autopep8_disable_show_diff=1
Autocmd Filetype python noremap <buffer> <F8>: Call AUTOPEP8 () <CR>
Map <F4> <leader>ci <CR>
Version two:
"Highlight Current LineSet Cursorline"set TAB to a width of four spacesSet tabstop=4"Auto IndentSet Autoindent"Auto indent of four spacesSet shiftwidth=4"use spaces instead of TABSet Expandtab"define the Pythonheader () function to automatically insert a Python file headerfunctionPythonheader () Call Setline (1,"#-*-Coding:utf-8-*-") Normal Gnormal onormal oendfunc"automatically call the Pythonheader () function when creating a file with the end of the PYAutocmd Bufnewfile *. PY call Pythonheader ()"Press F5 to automatically execute the current Python fileMap <F5>:!Clear;p Ython% <CR>
Version three:
"Remove the consistency of VI"
Set nocompatible
"Show line number"
Set number
"Hide scroll bar"
Set Guioptions-=r
Set Guioptions-=l
Set Guioptions-=b
"Hide Top tab Bar"
Set showtabline=0
"Set Font"
Set Guifont=monaco:h13
Syntax on "Turn on syntax highlighting"
Let g:solarized_termcolors=256 "solarized theme settings under Terminal Settings"
Set Background=dark "Setting background color"
"ColorScheme solarized"
Set nowrap "Do not fold rows"
Set Fileformat=unix "Settings to save files in UNIX format"
Set cindent "format C-style indent"
Set tabstop=4 "Setting table Length"
Set shiftwidth=4 "ditto"
Set Showmatch "Show matching parentheses"
Set scrolloff=5 "distance from top and bottom 5 rows"
Set laststatus=2 "command behavior two lines"
Set fenc=utf-8 "File Encoding"
Set backspace=2
Set mouse=a "Enable Mouse"
Set selection=exclusive
Set Selectmode=mouse,key
Set matchtime=5
Set ignorecase "Ignore case"
Set Incsearch
Set Hlsearch "Highlight Search Items"
Set Noexpandtab "Do not allow extended table"
Set Whichwrap+=<,>,h,l
Set Autoread
Set Cursorline "Highlight Current Line"
Set Cursorcolumn "Highlight Current Column"
"Run Python by F5"
Map <F5>:autopep8<cr>:w<cr>: Call Runpython () <CR>
function Runpython ()
Let MP = &MAKEPRG
Let EF = &errorformat
Let Exefile = expand ("%:t")
Setlocal makeprg=python\-U
Set efm=%c\%.%#,%a\ \ file\ \ "%f\" \\,\ line\%l%.%#,%z%[%^\]%\ \@=%m
Silent Make%
Copen
Let &MAKEPRG = MP
Let &errorformat = EF
Endfunction
Vim Development Configuration