" 底部操作指令Tab自动补全setwildmenusetwildmode=longest:list,fullsetsmarttabsetshowmodesetnumbersetnocompatible" 设置tab符长度为4个空格settabstop=4" 设置换行自动缩进长度为4个空格setshiftwidth=4" 设置tab符自动转换为空格setexpandtab" 设置智能缩进,其他可选缩进方式:autoindent, cindent, indentexprsetsmartindentsetautoindentsethlsearch" 快捷键letmapleader=';'nnoremap<Leader>aviw<esc>bi"<esc>ea"<esc>nmap<Leader>f^i# <Esc>nmap<Leader>j^2x<Esc>map<Leader>mo<ESC>:callsetline(".","if __name__ == '__main__':")<ESC>map<Leader>bo<ESC>:callsetline(".","import pdb; pdb.set_trace()")<ESC>nmap<Leader>e:callCmd()<ESC>nmap<Leader>h:callappend(0,["#!/usr/bin/python3","#-*- coding:utf-8 -*-"])<ESC>nmap<Leader>w:w<Esc>nmap<Leader>z:qa!<CR>nmap<Leader>x:wqa!<CR>nmap<Leader>To<ESC>:callsetline(".","# TODO ^?^")<ESC>nmap<Leader>t:callTest()<ESC>nmap<Leader>d:Gvdiffsplit!<ESC>nmap<F5>:callCmd()<ESC>nmap<F6>:!timepython3-mpdb%<ESC>nmap<F10>:callOpenTestFile()<ESC>nmap<cr>jfunction!OpenTestFile()if!isdirectory('tests')exec"silent !mkdir tests"endifexec"vsp tests/test_%"endfunction" 缩进setfoldmethod=indentsetfoldlevel=99" 函数跳转settags=tags" set autochdir" set laststatus=2" set incsearch" 自动换行" set textwidth=100syntaxoncolorschemedesert" let g:solarized_termcolors=256" 定义函数,做条件映射function!Cmd()ifexpand('%:e')=='py'exec"!time python3 %"elseifexpand('%:e')=='rkt'exec"!time racket %"elseifexpand('%:e')=='lua'exec"!time lua %"elseechoexpand('%:e')endifendfunctionfunction!Test()ifsplit(getcwd(),'/')[-1]=='tests'exec"!time cd ..;pytest -v tests/%;cd -"elseexec"!time pytest -v %"endifendfunctionfunction!RelativeCmd(cmd)ifeval('&'.a:cmd)==1lettmp="set "."no".a:cmdelselettmp="set ".a:cmdendifechom':'.tmpexectmpendfunctionfunction!DirOrClose()ifgetline(1)=="../"lettmp="q!"elselettmp="Vex"endifechom":".tmpexectmpendfunctionnmap<M-P>:callRelativeCmd("paste")<CR>imap<M-P><ESC>:setpaste<CR>inmap@r:callRelativeCmd("relativenumber")<CR>nmap<C-N>:callRelativeCmd("number")<CR>nmap<C-L>:callRelativeCmd("cursorline")<CR>"nmap <C-J> :call RelativeCmd("cursorcolumn")<CR>nmap<C-K>:callDirOrClose()<CR>nmap<S-F>:Rg<CR>nmap<C-P>:Files<CR>nmap<C-M>:NERDTreeFind<CR>nmap<C-B>:NERDTree<CR>hiSearchterm=standoutctermfg=0ctermbg=3if!has("gui_running")sett_Co=256endif" 设置窗口的行和列" set lines=35 columns=118" 设置目录树letg:netrw_liststyle=4letg:netrw_alto=1letg:netrw_browse_split=3letg:netrw_altv=1letg:netrw_winsize=15letg:netrw_banner=0" svn-blame - Show SVN blame annotation for the current file." Maintainer: Paul Nechifor <paul@nechifor.net>" Version: 0.1"" This was originally copied from here:" https://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/vim/vim-blame.vimrcifexists("g:loaded_svnblame")||&cp||v:version<700finishendifletg:loaded_svnblame=1function!s:svnBlame()letline=line(".")setlocalnowrap" Create a new window at the left-hand side.aboveleft18vnew" Blame, ignoring white space changes.%!svnblame-x-w"#"setlocalnomodifiedreadonlybuftype=nofilenowrapwinwidth=1setlocalnonumberifhas('&relativenumber')|setlocalnorelativenumber|endif" Return to original line.exec"normal ".line."G"" Synchronize scrolling, and return to original window.setlocalscrollbindwincmdpsetlocalscrollbindsyncbindendfunctioncommandBlamecalls:svnBlame()"ommi completionsetofu=syntaxcomplete#Completeimap<C-A><C-X><C-O>" 状态栏setlaststatus=2" 总是显示状态栏" highlight StatusLine cterm=bold ctermfg=blue ctermbg=black" 获取当前路径,将$HOME转化为~" function! CurDir()" let curdir = substitute(getcwd(), $HOME, "~", "g")" return curdir" endfunction" set statusline=[%n]\ %f%m%r%h\ \|\ \ pwd:\ %{CurDir()}\ \|%=\ %l,%c\ %p%%\ functionAddAuthor()letn=1whilen<5letline=getline(n)ifline=~'^\s#\#\s#\S#Last\s#modified\s#:\s#\S#.#$'callUpdateTitle()returnendifletn=n+1endwhilecallAddTitle()endfunctionfunctionUpdateTitle()normalm'execute'/# Last modified\s#:/s@:.#$@\=strftime(": %Y-%m-%d %H:%M")@'normal"normalmkexecute'/# Filename\s#:/s@:.#$@\=": ".expand("%:t")@'execute"noh"normal'kechohlWarningMsg|echo"Successful in updating the copy right."|echohlNoneendfunctionfunctionAddTitle()callappend(1,"##########################################################")callappend(2,"# Author : luyangong")callappend(3,"# Email : luyangong@moojing.com")callappend(4,"# Last modified : ".strftime("%Y-%m-%d %H:%M"))callappend(5,"# Filename : ".expand("%:t"))callappend(6,"# Description : ")callappend(7,"# #######################################################")echohlWarningMsg|echo"Successful in adding the copyright."|echohlNoneendfunction" python from powerline.vim import setup as powerline_setup" python powerline_setup()" python del powerline_setupsetrtp+=~/.vim/vundle.git/callvundle#rc()" Auto generate tags file on file write of *.c and *.h files" autocmd BufWritePost *.py silent! !ctags . &callplug#begin()Plug'preservim/nerdtree',{'on':'NERDTreeToggle'}Plug'junegunn/fzf',{'do':{->fzf#install() } }Plug'junegunn/fzf.vim'Plug'gabrielelana/vim-markdown'Plug'~/lyg/learn/open_terminal_plugin'Plug'tpope/vim-fugitive'Plug'MattesGroeger/vim-bookmarks'Plug'ludovicchabant/vim-gutentags'Plug'puremourning/vimspector'callplug#end()" Bookmarks per working directoryletg:bookmark_save_per_working_dir=1letg:bookmark_auto_save=1letg:vimspector_enable_mappings='HUMAN'letg:vimspector_base_dir='/home/luyangong/.vim/plugged/vimspector'