路径:/etc/vim/vimrc
打开终端:Ctrl+Alt+T
输入:sudo vim或gedit /etc/vim/vimrc (推荐用gedit,更好操作)
以下是我的配置:
1 "我的配置 2 "显示行号 3 set nu 4 set number 5 "更改缩进大小 6 set tabstop=2 7 "颜色主题 8 color koehler 9 "显示标尺 10 set ruler 11 "去空行 12 nnoremap <F2> :g/^\s*$/d<CR> 13 "激活鼠标 14 set mouse=a 15 "新建标签 16 map <M-F2> :tabnew<CR> 17 "列出当前目录文件 18 map <F3> :tabnew .<CR> 19 "打开树状文件目录 20 map <C-F3> \be 21 "C,C++ 按F5编译运行 22 map <F5> :call CompileRunGcc()<CR> 23 func! CompileRunGcc() 24 exec "w" 25 if &filetype == ‘c‘ 26 exec "!g++ % -o %<" 27 exec "! ./%<" 28 elseif &filetype == ‘cpp‘ 29 exec "!g++ % -o %<" 30 exec "! ./%<" 31 elseif &filetype == ‘java‘ 32 exec "!javac %" 33 exec "!java %<" 34 elseif &filetype == ‘sh‘ 35 :!./% 36 endif 37 endfunc 38 "C,C++的调试 39 map <F8> :call Rungdb()<CR> 40 func! Rungdb() 41 exec "w" 42 exec "!g++ % -g -o %<" 43 exec "!gdb ./%<" 44 endfunc 45 "自动缩进 46 set autoindent 47 set cindent 48 "统一缩进为4 49 set softtabstop=2 50 set shiftwidth=2