vim 安裝解析
vim 配置
http://linux-wiki.cn/wiki/zh-hans/%E7%94%A8Vim%E7%BC%96%E7%A8%8B%E2%80%94%E2%80%94%E9%85%8D%E7%BD%AE%E4%B8%8E%E6%8A%80%E5%B7%A7
自己的配置的vim
winpos 5 5set lines=30 columns=100set nuset go=syntax onautocmd insertLeave *se noculautocmd insertEnter *seS culset rulerset showcmdset cmdheight=1set novisualbellset nocompatibleautocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" func SetTitle() if &filetype == 'sh' call setline(1,"\#########################################################################") call append(line("."), "\# File Name: ".expand("%")) call append(line(".")+1, "\# Author: yangshuo") call append(line(".")+2, "\# mail: 1115332213@qq.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: yangshuo") call append(line(".")+2, " > Mail: 1115332213@qq.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, "#include<stdio.h>")call append(line(".")+8, "#include<cmath>") call append(line(".")+9, "#include<algorithm>")call append(line(".")+10,"#include<string.h>")call append(line(".")+11, "using namespace std;") call append(line(".")+12, "int main()")call append(line(".")+13, "{") call append(line(".")+14, "")call append(line(".")+15, " return 0;")call append(line(".")+16, "}") endif if &filetype == 'c' call append(line(".")+6, "#include<stdio.h>") call append(line(".")+7, "") endif autocmd BufNewFile * normal Gendfunc " 映射全選+複製 ctrl+amap <C-A> ggVGYmap! <C-A> <Esc>ggVGYmap <F12> gg=G" 選中狀態下 Ctrl+c 複製vmap <C-c> "+y"去空行 nnoremap <F2> :g/^\s*$/d<CR> "比較檔案 nnoremap <C-F2> :vert diffsplit "建立標籤 map <M-F2> :tabnew<CR> "列出目前的目錄檔案 map <F3> :tabnew .<CR> "開啟樹狀檔案目錄 map <C-F3> \be "C,C++ 按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' :!./% endifendfunc"C,C++的調試map <F8> :call Rungdb()<CR>func! Rungdb() exec "w" exec "!g++ % -g -o %<" exec "!gdb ./%<"endfunc" 自動縮排set autoindentset cindent" Tab鍵的寬度set tabstop=4" 高亮顯示匹配的括弧set showmatch" 匹配括弧高亮的時間(單位是十分之一秒)set matchtime=1" 游標移動到buffer的頂部和底部時保持3行距離set scrolloff=3" 可以在buffer的任何地方使用滑鼠(類似office中在工作區雙擊滑鼠定位)set mouse=aset selection=exclusiveset selectmode=mouse,key