linux下开发总是坑爹的,特别是纯命令行的服务器机子。连个gui的编译器都没,无奈之下只能用vim凑合了。vim也不那么让人省心,有些东西还是需要设置才行。
配置文件:
这个是目前用的vim配置文件,我是直接修改的/etc/vimrc,这是全局配置文件。如果只想针对某个用户可以在用户文件夹下~/.vimrc文件配置。
01 |
" If using a dark background within the editing area and syntax highlighting |
02 |
" turn on this option as well |
05 |
" Uncomment the following to have Vim jump to the last position when |
08 |
" au BufReadPost * if line("'"") > 1 && line("'"") <= line("$") | exe "normal! g'"" | endif |
11 |
" Uncomment the following to have Vim load indentation rules and plugins |
12 |
" according to the detected filetype. |
14 |
" filetype plugin indent on |
17 |
" The following are commented out as they cause vim to behave a lot |
18 |
" differently from regular Vi. They are highly recommended though. |
19 |
set nocompatible "支持方向键 |
20 |
set backspace=2 "支持backsapce前删键 |
21 |
autocmd FileType python setlocal et sta sw=4 sts=4 "缩进四个空格,用四个空格替换tab |
34 |
set showcmd " Show (partial) command in status line. |
35 |
set showmatch " Show matching brackets. |
36 |
set ignorecase " Do case insensitive matching |
37 |
set smartcase " Do smart case matching |
38 |
"set incsearch " Incremental search |
39 |
"set autowrite " Automatically save before commands like :next and :make |
40 |
"set hidden " Hide buffers when they are abandoned |
41 |
"set mouse=a " Enable mouse usage (all modes),注释掉使得可以在putty上右键粘贴。 |
43 |
" Source a global configuration file if available |
44 |
if filereadable("/etc/vim/vimrc.local") |
45 |
source /etc/vim/vimrc.local |
参数解释:
02 |
set nocompatible "支持方向键 |
03 |
set backspace=2 "支持backsapce前删键 |
06 |
"注释后,右键可以粘贴内容(在putty中) |
09 |
autocmd FileType python setlocal et sta sw=4 sts=4 "因为是用于python编写,所以缩进四个空格,并用四个空格替换tab |
11 |
"et expandtab,将tab键展开成空格 |
12 |
"sta smartab,在行首按TAB将加入sw个空格 |
13 |
"sw shiftwidth,自动缩进插入的空格数 |
14 |
"sts softabstop,使用<Tab>或<BS>自动插入或删除相应的空格数 |
转载请注明:旅途@KryptosX » VIM设置记录