vim配置vimrc详解

一、vim/gvim 环境变量

1. vimrc的存放位置: 
系统 vimrc 文件: "$VIM/vimrc" 
用户 vimrc 文件: "$HOME/.vimrc" 
用户 exrc 文件: "$HOME/.exrc" 
系统 gvimrc 文件: "$VIM/gvimrc" 
用户 gvimrc 文件: "$HOME/.gvimrc" 
系统菜单文件: "$VIMRUNTIME/menu.vim" 
$VIM 预设值: "/usr/share/vim" 


2.windows下:(例如gvim 安装在D:/vim/)

$VIMRUNTIME  : d:/vim/vim73

$VIM                  : d:/vim/

插件安装位置:

默认位置   :          $VIMRUNTIME

自定义插件目录: $VIM/vimfiles  (如果没有vimfiles就新建一个,建议将插件安装在这)


1). 上面插件安装管理目录还不是很清晰,可以用vim的vundle插件,每个插件会安装在各自的文件夹中,而不是像上面那样混合在一起,比如Tagbar插件就会在vundle文件夹下自动生成tagbar文件夹保存tagbar插件。同时vimrc文件要稍作修改可以自行baidu ,google很简单。

2). 如果要使用vundle更新插件,还要安装Git (当然也可以手动更新直接下载覆盖到 vundle/ 下对应插件文件夹里)


 


二、 vimrc文件内容


"是否兼容VI,compatible为兼容,nocompatible为不完全兼容 
"如果设置为compatible,则tab将不会变成空格 
set nocompatible 
 
source $VIMRUNTIME/vimrc_example.vim 
source $VIMRUNTIME/mswin.vim 
"设置鼠标运行模式为WINDOWS模式 
behave mswin 
 
" Multi-encoding setting, MUST BE IN THE BEGINNING OF .vimrc! 

if has("multi_byte") 
    " When 'fileencodings' starts with 'ucs-bom', don't do this manually 
    "set bomb 
    set fileencodings=ucs-bom,utf-8,chinese,taiwan,japan,korea,latin1 
    " CJK environment detection and corresponding setting 
    if v:lang =~ "^zh_CN" 
        " Simplified Chinese, on Unix euc-cn, on MS-Windows cp936 
        set encoding=chinese 
        set termencoding=chinese 
        if &fileencoding == '' 
            set fileencoding=chinese 
        endif 
    elseif v:lang =~ "^zh_TW" 
        " Traditional Chinese, on Unix euc-tw, on MS-Windows cp950 
        set encoding=taiwan 
        set termencoding=taiwan 
        if &fileencoding == '' 
            set fileencoding=taiwan 
        endif 
    elseif v:lang =~ "^ja_JP" 
        " Japanese, on Unix euc-jp, on MS-Windows cp932 
        set encoding=japan 
        set termencoding=japan 
        if &fileencoding == '' 
            set fileencoding=japan 
        endif 
    elseif v:lang =~ "^ko" 
        " Korean on Unix euc-kr, on MS-Windows cp949 
        set encoding=korea 
        set termencoding=korea 
        if &fileencoding == '' 
            set fileencoding=korea 
        endif 
    endif 
    " Detect UTF-8 locale, and override CJK setting if needed 
    if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" 
        set encoding=utf-8 
    endif 
else 
    echoerr 'Sorry, this version of (g)Vim was not compiled with "multi_byte"' 
endif 
 
"解决菜单乱码 
set encoding=utf-8 
"fileencodings需要注意顺序,前面的字符集应该比后面的字符集大 
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 
set langmenu=zh_CN.utf-8 
set imcmdline 
source $VIMRUNTIME/delmenu.vim 
source $VIMRUNTIME/menu.vim 
 
"解决consle输出乱码 
language messages zh_CN.utf-8 
 
"自动检测文件类型并加载相应的设置,snipMate插件需要打开这个配置选项 
filetype plugin indent on 
 
"语法高亮 
syntax on 
 
"自动缩进 
set autoindent 
"设置 Backspace 和 Delete 的灵活程度,backspace=2 则没有任何限制 
"设置在哪些模式下使用鼠标功能,mouse=a 表示所有模式 
set mouse=a 
set backspace=2 
"不自动换行 
set nowrap 
"设置超过100字符自动换行 
"set textwidth=100 
"设置超过100列的字符带下划线 
"au BufWinEnter * let w:m2=matchadd('Underlined', '\%>100v.\+', -1) 
"syn match out80 /\%80v./ containedin=ALL 
"hi out80 guifg=white guibg=red 
"智能对齐方式 
set smartindent 
"一个tab是4个字符 
set tabstop=4 
"按一次tab前进4个字符 
set softtabstop=4 
"用空格代替tab 
set expandtab 
"设置自动缩进 
set ai! 
"缩进的字符个数 
set cindent shiftwidth=4 
"set autoindent shiftwidth=2 
 
"设置折叠模式 
set foldcolumn=4 
"光标遇到折叠,折叠就打开 
"set foldopen=all 
"移开折叠时自动关闭折叠 
"set foldclose=all 
"zf zo zc zd zr zm zR zM zn zi zN 
"依缩进折叠 
"   manual  手工定义折叠 
"   indent  更多的缩进表示更高级别的折叠 
"   expr    用表达式来定义折叠 
"   syntax  用语法高亮来定义折叠 
"   diff    对没有更改的文本进行折叠 
"   marker  对文中的标志折叠 
set foldmethod=syntax 
"启动时不要自动折叠代码 
set foldlevel=100 
"依标记折叠 
set foldmethod=marker 
 
"显示行号 
set number 
 
"打开光标的行列位置显示功能 
set ruler 
 
"显示中文引号 
set ambiwidth=double 
 
"行高亮 
set cursorline 
"列高亮,与函数列表有冲突 
set cursorcolumn 
 
"设置命令行的高度 
set cmdheight=2 
 
"高亮搜索的关键字 
set hlsearch 
 
"搜索忽略大小写 
set ignorecase 
 
"设置命令历史行数 
set history=100 
 
"启动的时候不显示那个援助索马里儿童的提示 
"set shortmess=atI 
 
"不要闪烁 
"set novisualbell 
 
"显示TAB健 
set list 
set listchars=tab:>-,trail:- 
 
"高亮字符,让其不受100列限制 
":highlight OverLength ctermbg=red ctermfg=white guibg=grey guifg=white 
":match OverLength '\%101v.*' 
 
"设置VIM状态栏 
set laststatus=2 "显示状态栏(默认值为1, 无法显示状态栏) 
set statusline= 
set statusline+=%2*%-3.3n%0*\ " buffer number 
set statusline+=%f\ " file name 
set statusline+=%h%1*%m%r%w%0* " flag 
set statusline+=[ 
if v:version >= 600 
    set statusline+=%{strlen(&ft)?&ft:'none'}, " filetype 
    set statusline+=%{&fileencoding}, " encoding 
endif 
set statusline+=%{&fileformat}] " file format 
set statusline+=%= " right align 
"set statusline+=%2*0x%-8B\ " current char 
set statusline+=0x%-8B\ " current char 
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset 
if filereadable(expand("$VIM/vimfiles/plugin/vimbuddy.vim")) 
    set statusline+=\ %{VimBuddy()} " vim buddy 
endif 
"状态行颜色 
"highlight StatusLine guifg=SlateBlue guibg=Yellow 
"highlight StatusLineNC guifg=Gray guibg=White 
 
"设置路径,多个路径用逗号分隔 
set path=.,"E:/Web/htdocs",, 
 
"去掉有关vi一致性模式,避免以前版本的一些bug和局限 
set nocp 
 
"增强模式中的命令行自动完成操作 
set wildmenu 
 
"执行 Vim 缺省提供的 .vimrc 文件的示例,包含了打开语法加亮显示等最常用的功能 
source $VIMRUNTIME/vimrc_example.vim 
 
"缺省不产生备份文件 
set nobackup 
"在输入括号时光标会短暂地跳到与之相匹配的括号处,不影响输入 
set showmatch 
"正确地处理中文字符的折行和拼接 
set formatoptions+=mM 
 
"设定文件浏览器目录为当前目录 
set bsdir=buffer 
"自动切换当前目录为当前文件所在的目录 
set autochdir 
"自动重新加载外部修改内容 
"set autoread 
 
"使PHP识别EOT字符串 
hi link phpheredoc string 
 
"允许在有未保存的修改时切换缓冲区 
set hidden 
 
"选中一段文字并全文搜索这段文字 
vmap <silent> ,/ y/<C-R>=escape(@", '\\/.*$^~[]')<CR><CR> 
vmap <silent> ,? y?<C-R>=escape(@", '\\/.*$^~[]')<CR><CR> 
 
"进入当前编辑的文件的目录 
autocmd BufEnter * exec "cd %:p:h" 
 
"保存文件的格式顺序 
set fileformats=dos,unix 
 
"配色(更多的配色见colors目录和http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-c.html) 
"colorscheme peacock_light 
colorscheme peacock_desert 
 
"设置字体 
if has("gui") 
    if has("win32") 
        "启动时会弹出字体选择框,如果取消,则采用系统默认字体 
        "set guifont=* 
        "Windows默认使用的字体,字体较粗 
        "set guifont=Fixedsys 
        "中文显示变形,字体较粗 
        "set guifont=Monospace:h9 
        "中文显示变形,字体较细 
        "set guifont=Consolas:h9 
        "中文显示变形,字体较细 
        "set guifont=Lucida\ Console:h9 
        "中文显示变形,字体较细 
        set guifont=Monaco:h9 
        "中文显示变形,字体较细 
        "set guifont=Andale\ Mono:h10 
        "中文显示变形,字体较细 
        "set guifont=Bitstream\ Vera\ Sans\ Mono:h9 
        "需要运行修改版的gvim才能识别 
        "set guifont=YaHei\ Consolas\ Hybrid:h9 
        "如果guifontwide采用中文字体,汉字将自动使用guifontwide,英文自动使用guifont 
        set guifontwide=YaHei\ Consolas\ Hybrid:h9 
    else 
        set guifont=SimSun:h10 
    endif 
    "set columns=128 lines=36 
endif 
 
"启动后最大化 
au GUIEnter * simalt ~x 
 
"置粘贴模式,这样粘贴过来的程序代码就不会错位了。 
"set paste 
 
"设置帮助信息 
set helplang=cn 
 
"自动保存session和viminfo 
"缺省的sessionoptions选项包括:blank,buffers,curdir,folds,help,options,tabpages,winsize 
"也就是会话文件会恢复当前编辑环境的空窗口、所有的缓冲区、当前目录、折叠(fold)相关的信息、帮助窗口、所有的选项和映射、所有的标签页(tab)、窗口大小 
"set sessionoptions-=curdir 
"au VimLeave * mksession! $VIMRUNTIME/Session.vim 
"au VimLeave * wviminfo! $VIMRUNTIME/_viminfo 
"source $VIMRUNTIME/Session.vim 
"rviminfo $VIMRUNTIME/_viminfo 
 
"记录上次关闭的文件及状态 
set viminfo='10,\"100,:20,%,n$VIMRUNTIME/_viminfo 
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif 
 
"设置插件SuperTab 
"设置按下<Tab>后默认的补全方式, 默认是<C-P>, 
"现在改为<C-X><C-O>. 关于<C-P>的补全方式, 
"还有其他的补全方式, 可以看看下面的一些帮助: 
":help ins-completion 
":help compl-omni 
let g:SuperTabRetainCompletionType=2 
"0 - 不记录上次的补全方式 
"1 - 记住上次的补全方式,直到用其他的补全命令改变它 
"2 - 记住上次的补全方式,直到按ESC退出插入模式为止 
let g:SuperTabDefaultCompletionType="<C-X><C-O>" 
 
set diffexpr=MyDiff() 
function! MyDiff() 
    let opt = '-a --binary ' 
    if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif 
    if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif 
    let arg1 = v:fname_in 
    if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif 
    let arg2 = v:fname_new 
    if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif 
    let arg3 = v:fname_out 
    if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif 
    let eq = '' 
    if $VIMRUNTIME =~ ' ' 
        if &sh =~ '\<cmd' 
            let cmd = '""' . $VIMRUNTIME . '\diff"' 
            let eq = '"' 
        else 
            let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' 
        endif 
    else 
        let cmd = $VIMRUNTIME . '\diff' 
    endif 
    silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq 
endfunction 
 
"phpDocumentor 
"this includes the script and maps the combination <ctrl> + p 
"to the doc functions. 
source $VIM\vimfiles\plugin\php-doc.vim 
imap <A-/> <ESC>:call PhpDocSingle()<CR>i 
nmap <A-/> :call PhpDocSingle()<CR> 
vmap <A-/> :call PhpDocRange()<CR> 
 
"You can obtain the completion dictionary file from: 
"http://cvs.php.net/viewvc.cgi/phpdoc/funclist.txt 
set dictionary+=$VIM\vimfiles\syntax\function.txt 
 
"Use the dictionary completion 
set complete-=k complete+=k 
 
"Alt + -> 打开下一个文件 
map <M-right> <ESC>:bn<RETURN> 
"Alt + <- 打开上一个文件 
map <M-left> <ESC>:bp<RETURN> 
 
"使用TAB键自动完成 
"This function determines, wether we are on 
"the start of the line text(then tab indents) 
"or if we want to try auto completion 
function! InsertTabWrapper() 
    let col=col('.')-1 
    if !col || getline('.')[col-1] !~ '\k' 
        return "\<TAB>" 
    else 
        return "\<C-N>" 
    endif 
endfunction 
"使用SuperTab之后,就可以关闭该设置了 
"inoremap <TAB> <C-R>=InsertTabWrapper()<CR> 
 
"平台判断 
function! GetSystem() 
    if (has("win32") || has("win95") || has("win64") || has("win16")) 
        return "windows" 
    elseif has("unix") 
        return "linux" 
    elseif has("mac") 
        return "mac" 
    endif 
endfunction 
 
"取得光标处的匹配 
function! GetPatternAtCursor(pat) 
    let col = col('.') - 1 
    let line = getline('.') 
    let ebeg = -1 
    let cont = match(line, a:pat, 0) 
    while (ebeg >= 0 || (0 <= cont) && (cont <= col)) 
        let contn = matchend(line, a:pat, cont) 
        if (cont <= col) && (col < contn) 
            let ebeg = match(line, a:pat, cont) 
            let elen = contn - ebeg 
            break 
        else 
            let cont = match(line, a:pat, contn) 
        endif 
    endwh 
    if ebeg >= 0 
        return strpart(line, ebeg, elen) 
    else 
        return "" 
    endif 
endfunction 
 
"打开链接 
function! OpenUrl() 
    let s:url = GetPatternAtCursor('\v(https?://|ftp://|file:/{3}|www\.)((\w|-)+\.)+(\w|-)+(:\d+)?(/(\w|[~@#$%^&+=/.?-])+)?') 
    "echo s:url 
    if s:url == "" 
        echohl WarningMsg 
        echomsg '在光标处未发现URL!' 
        echohl None 
    else 
        if GetSystem() == "windows" 
            call system("explorer " . s:url) 
        else 
            call system("firefox " . s:url . " &") 
        endif 
    endif 
    unlet s:url 
endfunction 
nmap <C-LeftMouse> :call OpenUrl()<CR> 
 
"放大字体 
function <SID>FontSize_Enlarge() 
    if GetSystem() == "linux" 
        let pattern = '\<\d\+$' 
    elseif GetSystem() == "windows" 
        let pattern = ':h\zs\d\+\ze:' 
    endif 
    let fontsize = matchstr(&gfn, pattern) 
    let cmd = substitute(&gfn, pattern, string(fontsize + 1), 'g') 
    let &gfn=cmd 
    let fontsize = matchstr(&gfw, pattern) 
    let cmd = substitute(&gfw, pattern, string(fontsize + 1), 'g') 
    let &gfw=cmd 
endfunction 
nnoremap <A-+> :call <SID>FontSize_Enlarge()<CR> 
 
"缩小字体 
function <SID>FontSize_Reduce() 
    if GetSystem() == "linux" 
        let pattern = '\<\d\+$' 
    elseif GetSystem() == "windows" 
        let pattern = ':h\zs\d\+\ze:' 
    endif 
    let fontsize = matchstr(&gfn, pattern) 
    let cmd = substitute(&gfn, pattern, string(fontsize - 1), 'g') 
    let &gfn=cmd 
    let fontsize = matchstr(&gfw, pattern) 
    let cmd = substitute(&gfw, pattern, string(fontsize - 1), 'g') 
    let &gfw=cmd 
endfunction 
nnoremap <A--> :call <SID>FontSize_Reduce()<CR> 
 
"html自动输入匹配标签,输入>之后自动完成匹配标签 
au FileType xhtml,xml so ~/.vim/ftplugin/html_autoclosetag.vim 
 
"能够漂亮的显示.NFO文件 
function! SetFileEncodings(encodings) 
    let b:myfileencodingsbak=&fileencodings 
    let &fileencodings=a:encodings 
endfunction 
function! RestoreFileEncodings() 
    let &fileencodings=b:myfileencodingsbak 
    unlet b:myfileencodingsbak 
endfunction 
au BufReadPre *.nfo call SetFileEncodings('cp437')|set ambiwidth=single 
au BufReadPost *.nfo call RestoreFileEncodings() 
 
"""""""""""""""""""""""""""""" 
" 设置lookupfile插件 
"""""""""""""""""""""""""""""" 
let g:LookupFile_MinPatLength = 2               "最少输入2个字符才开始查找 
let g:LookupFile_PreserveLastPattern = 0        "不保存上次查找的字符串 
let g:LookupFile_PreservePatternHistory = 1     "保存查找历史 
let g:LookupFile_AlwaysAcceptFirst = 1          "回车打开第一个匹配项目 
let g:LookupFile_AllowNewFiles = 0              "不允许创建不存在的文件 
if filereadable("./filenametags")               "设置tag文件的名字 
    let g:LookupFile_TagExpr = '"./filenametags"' 
endif 
"映射LookupFile为,lf 
nmap <silent> ,lf <Plug>LookupFile<CR> 
"映射LUBufs为,lb 
nmap <silent> ,lb :LUBufs<CR> 
"映射LUWalk为,lw 
nmap <silent> ,lw :LUWalk<CR> 
"映射LUPath为,lp 
nmap <silent> ,lp :LUPath<CR> 
 
"F2处理行尾的空格以及文件尾部的多余空行 
"Automatically remove trailing spaces when saving a file. 
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif 
"Remove indenting on empty line 
map <F2> :w<CR>:call CleanupBuffer(1)<CR>:noh<CR> 
function! CleanupBuffer(keep) 
    " Skip binary files 
    if (&bin > 0) 
        return 
    endif 
    " Remove spaces and tabs from end of every line, if possible 
    silent! %s/\s\+$//ge 
    " Save current line number 
    let lnum = line(".") 
    " number of last line 
    let lastline = line("$") 
    let n        = lastline 
    " while loop 
    while (1) 
        " content of last line 
        let line = getline(n) 
        " remove spaces and tab 
        if (!empty(line)) 
            break 
        endif 
        let n = n - 1 
    endwhile 
    " Delete all empty lines at the end of file 
    let start = n+1+a:keep 
    if (start < lastline) 
        execute n+1+a:keep . "," . lastline . "d" 
    endif 
    " after clean spaces and tabs, jump back 
    exec "normal " . lnum . "G" 
endfunction 
 
"快速查找(插件grep插件,需要grep软件) 
"nnoremap <silent> <F3> :Grep<CR> 
"给n映射一个快捷键,习惯上喜欢用F3 
nmap <F3> n 
"给n映射一个快捷键,习惯上喜欢用F3 
nmap <S-F3> N 
 
"PHP语法检查 
"map <F4> :!E:/Web/Server/PHP/php.exe -l %<CR> 
function! CheckPHPSyntax() 
    setlocal makeprg=E:/Web/Server/PHP/php.exe\ -l\ -n\ -d\ html_errors=off 
    setlocal shellpipe=> 
    " Use error format for parsing PHP error output 
    setlocal errorformat=%m\ in\ %f\ on\ line\ %l 
    make % 
endfunction 
" Perform :PHP_CheckSyntax() 
map <F4> :call CheckPHPSyntax()<CR> 
 
"PHP代码美化 
"map <C-A-F4> :!ZendCodeAnalyzer.exe %<CR> 
 
"PHP代码通过Zend加密 
function! ZendEncodePHP() 
    let currentfile=fnamemodify(bufname("%"), ":p") 
    let newfile=fnamemodify(bufname("%"), ":p:h") . "\\" . fnamemodify(bufname("%"), ":t:r") . ".zend." . fnamemodify(bufname("%"), ":e") 
    execute "!\"E:\\Web\\Tools\\ZendGuard\\bin\\zendenc.exe\"" . ' ' . currentfile . ' ' . newfile 
endfunction 
map <C-F4> :call ZendEncodePHP()<CR> 
 
"使用IE预览网页 
function! BrowseWebPage() 
    let filepath=substitute(getcwd()."\\".bufname("%"), 'E:\\Web\\htdocs\\', "http://localhost/", "g") 
    let filepath=substitute(filepath,"\\","\/","g") 
    silent execute "!\"explorer\""." ".filepath 
endfunction 
map <S-F4> :call BrowseWebPage()<CR> 
 
"F6打开或关闭nerd_tree和taglist 
"由于nerd_tree和taglist采用了trinity插件打开 
"所以具体的设置以trinity.vim为准 
nmap <F6>  :TrinityToggleTagListAndNERDTree<CR> 
 
"F7单独切换打开nerd_tree(nerd_tree插件) 
let g:NERDChristmasTree = 1              "色彩显示 
let g:NERDTreeShowHidden = 1             "显示隐藏文件 
let g:NERDTreeWinPos = 'left'            "窗口显示位置 
let g:NERDTreeHighlightCursorline = 0    "高亮当前行 
nmap <F7>  :TrinityToggleNERDTree<CR> 
 
"netrw设置(自带目录树插件) 
let g:netrw_winsize=30 
let g:netrw_liststyle=1 
let g:netrw_timefmt='%Y-%m-%d %H:%M:%S' 
nmap <silent> <C-F7> :Sexplore!<cr> 
 
"Ctrl + F7打开project插件 
nmap <silent> <A-F7>  :Project<CR> 
 
"F8单独切换打开taglist(taglist插件) 
if GetSystem() == "windows"                    "设定Windows系统中ctags程序的位置 
    let g:Tlist_Ctags_Cmd = $VIMRUNTIME.'\ctags' 
else 
    let g:Tlist_Ctags_Cmd = '/usr/bin/ctags' 
endif 
"let g:Tlist_Sort_Type = 'name'          "以名称顺序排序,默认以位置顺序(order) 
let g:Tlist_Show_One_File = 1           "不同时显示多个文件的tag,只显示当前文件的 
let g:Tlist_Exit_OnlyWindow = 1         "如果taglist窗口是最后一个窗口,则退出vim 
lef g:Tlist_File_Fold_Auto_Close = 1    "当光标不在编辑文件里面的时候全部折叠 
let g:Tlist_Use_Right_Window = 1        "在右侧窗口中显示taglist窗口 
let g:Tlist_Enable_Fold_Column = 1      "显示折叠边栏 
nmap <F8>  :TrinityToggleTagList<CR> 
 
"F11查看打开的文件列表(bufexplorer插件) 
let g:bufExplorerDefaultHelp = 1 
let g:bufExplorerDetailedHelp = 0 
nmap <F11> :BufExplorer <CR> 
 
"F12生成/更新tags文件 
set tags=tags; 
set autochdir 
function! UpdateTagsFile() 
    silent !ctags -R --fields=+ianS --extra=+q 
endfunction 
nmap <F12> :call UpdateTagsFile()<CR> 
 
"Ctrl + F12删除tags文件 
function! DeleteTagsFile() 
    "Linux下的删除方法 
    "silent !rm tags 
    "Windows下的删除方法 
    silent !del /F /Q tags 
endfunction 
nmap <C-F12> :call DeleteTagsFile()<CR> 
"退出VIM之前删除tags文件 
"au VimLeavePre * call DeleteTagsFile() 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/509566.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

CentOS 使用iso镜像安装本地 yum 源

文章目录下载服务器镜像挂载iso镜像修改yum源挂载iso到系统中查看挂载状态挂载完成后清缓存安装服务测试下载服务器镜像 下载与我们服务器相同版本的服务器镜像。 查看当前服务器版本 [rootiZot101s4kxuygvttz67vjZ yum.repos.d]# cat /etc/redhat-release CentOS Linux re…

refresh的停车场

题目描述 refresh最近发了一笔横财&#xff0c;开了一家停车场。由于土地有限&#xff0c;停车场内停车数量有限&#xff0c;但是要求进停车场的车辆过多。当停车场满时&#xff0c;要进入的车辆会进入便道等待&#xff0c;最先进入便道的车辆会优先 进入停车场&#xff0c;而且…

vim目录说明

plugin、autoload、ftplugin有什么区别 很多初用vim的朋友在安装插件时都会有些疑惑。同样的插件&#xff0c;有些教程说安装在plugin目录&#xff0c;有些说安装在ftplugin目录&#xff0c;有些说安装在autoload目录&#xff0c;到底这些目录的区别是什么呢&#xff1f;今天阿…

Grafana Prometheus 服务安装部署(Linux服务器监控)

文章目录一、概述二、安装Prometheus1.安装node_exporter2.安装Prometheus三、安装Grafana展示监控监控进程一、概述 Prometheus 介绍 Prometheus是一套开源的监控&报警&时间序列数据库的组合&#xff0c;起始是由SoundCloud公司开发的。随着发展&#xff0c;越来越多…

加法变乘法(蓝桥杯)

题意&#xff1a; 我们都知道&#xff1a;123 … 49 1225 现在要求你把其中两个不相邻的加号变成乘号&#xff0c;使得结果为2015 比如&#xff1a; 123…10*1112…27*2829…49 2015 就是符合要求的答案。 请你寻找另外一个可能的答案&#xff0c;并把位置靠前的那个乘…

离散事件模拟-银行管理

题目描述 现在银行已经很普遍&#xff0c;每个人总会去银行办理业务&#xff0c;一个好的银行是要考虑 平均逗留时间的&#xff0c;即&#xff1a; 在一定时间段内所有办理业务的人员逗留的时间的和/ 总的人数。逗留时间定义为 人员离开的时间减去人员来的时间。银行只有考虑了…

Vim升华之树形目录插件NERDTree安装图解

无意中看到实验室的朋友使用的vim竟然能在左边显示树形目录&#xff0c;感觉很方便&#xff0c;这样子文件夹有什么文件一目了然。她说是一个插件叫NERDTree&#xff0c;安装执行后的效果如下&#xff0c;不是你想要的效果就别安了。我的系统是Ubuntu12.04&#xff0c;版本不同…

Grafana Prometheus Process-Exporter 服务进程监控

文章目录一、process-exporter安装二、Grafana展示离线导入在线导入之前介绍到Grafana Prometheus 安装部署并监控Linux服务器状态 https://datamining.blog.csdn.net/article/details/122671215 &#xff0c;这里我们介绍服务进程的通用监控。一、process-exporter安装 GitHu…

计算机学生的未来

计算机专业毕业后大致的工作方向是软、硬、网、图 四大类 尤其以软件、网络为现今的首选 从岗位上分&#xff0c;又可以分为技术道路、营销道路两大方向 if 你选择作技术&#xff0c;then 从现在开始&#xff0c;牢记&#xff1a; 天道酬勤&#xff01;&#xff01;&#xff…

linux 目录结构+常用命令+压缩命令+vim使用+及一些基础知识(非常好)

linux目录架构 / 根目录 /bin 常用的命令 binary file 的目录 /boot 存放系统启动时必须读取的档案&#xff0c;包括核心 (kernel) 在内 /boot/grub/menu.lst GRUB设置 /boot/vmlinuz 内核 /boot/initrd 核心解压缩所需 RAM Disk /dev 系统周边设备 …

【Kafka启动报错】Caused by: java.lang.OutOfMemoryError: Map failed

参考&#xff1a;https://stackoverflow.com/questions/43042144/kafka-server-failed-to-start-java-io-ioexception-map-failed 报错日志 [2022-02-15 16:50:40,558] ERROR Error while deleting the clean shutdown file in dir /home/es/kafka_2.11-2.2.1/logs (kafka.se…

饮料换购(蓝桥杯)

饮料换购 乐羊羊饮料厂正在举办一次促销优惠活动。乐羊羊C型饮料&#xff0c;凭3个瓶盖可以再换一瓶C型饮料&#xff0c;并且可以一直循环下去&#xff0c;但不允许赊账。 请你计算一下&#xff0c;如果小明不浪费瓶盖&#xff0c;尽量地参加活动&#xff0c;那么&#xff0c…

算法6:只有五行的Floyd最短路算法

暑假&#xff0c;小哼准备去一些城市旅游。有些城市之间有公路&#xff0c;有些城市之间则没有&#xff0c;如下图。为了节省经费以及方便计划旅程&#xff0c;小哼希望在出发之前知道任意两个城市之前的最短路程。上图中有4个城市8条公路&#xff0c;公路上的数字表示这条公路…

vim的强大,vim设置和插件的使用,脱离windows才是王道

map <C-F12> :!ctags -R --c-kindsp --fieldsiaS --extraq .<CR> let Tlist_Show_One_File1 let Tlist_Exit_OnlyWindow1 let Tlist_Auto_Open1 set nocompatible """"""""""界面""&quo…

CloudCanal 部署使用教程

文章目录 CloudCanal官方说明文档CloudCanal安装Docker安装docker-compose安装下载安装包解压安装包启动CloudCanal确认启动是否成功使用教程(必读)创建同步任务Mysql同步到ElasticSearch添加数据源创建集群(服务器)名称创建集群生成唯一节点标识安装新 sidecar 容器启动sideca…

DFS全排列

第一种方法&#xff1a; package com.tjrac_java_2;import java.util.Scanner;public class Fun {public static int s0;static int[] anew int[100000];public static void main(String[] args) {int n;Scanner sc new Scanner(System.in);nsc.nextInt();for (int i 1; i &…

Apache Kylin从入门到精通

Kylin 文章目录Kylin一、概述1.1 Kylin定义1.2 Kylin架构1.3 Kylin特点1.4 Apache Kylin4 概述为什么选择 Parquet 替换 HBase?预计算结果在 Kylin4.0 中如何存储?Kylin 4.0 的构建引擎Kylin 4.0 的查询引擎Kylin 4.0 与 Kylin 3.1 功能对比Kylin 4.0 性能表现如何升级Kylin …

排序分析

九大基础排序总结与对比 标签&#xff1a; 数据结构排序算法九大排序2016-06-07 15:43 12646人阅读 评论(6) 收藏 举报分类&#xff1a;data structure版权声明&#xff1a;本文为博主原创文章&#xff0c;未经博主允许不得转载。 目录(?)[] 请尊重个人劳动成果&#xff0c;转…

分巧克力(蓝桥杯)

标题&#xff1a; 分巧克力 儿童节那天有K位小朋友到小明家做客。小明拿出了珍藏的巧克力招待小朋友们。 小明一共有N块巧克力&#xff0c;其中第i块是Hi x Wi的方格组成的长方形。为了公平起见&#xff0c;小明需要从这 N 块巧克力中切出K块巧克力分给小朋友们。切出的巧克力…

Flume 实战开发指南

Flume 文章目录FlumeFlume介绍Flume核心概念Flume NG的体系结构SourceChannelSinkFlume的部署类型单一流程多代理流程&#xff08;多个agent顺序连接&#xff09;流的合并&#xff08;多个Agent的数据汇聚到同一个Agent &#xff09;多路复用流&#xff08;多级流&#xff09;l…