vim的一些基本配置

  本文介绍了一些使用vim的基本配置,具体参见配置文件注释。

  vim很强大,关键还要看应用场景,这个配置只是我用来编写一些编程题的时候用的。至于代码目录结构、智能提示和自动补全,这个配置并没有涉及。

 1 " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
 2 " the call to :runtime you can find below.  If you wish to change any of those
 3 " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
 4 " will be overwritten everytime an upgrade of the vim packages is performed.
 5 " It is recommended to make changes after sourcing debian.vim since it alters
 6 " the value of the 'compatible' option.
 7 
 8 " This line should not be removed as it ensures that various options are
 9 " properly set to work with the Vim-related packages available in Debian.
10 runtime! debian.vim
11 
12 " Uncomment the next line to make Vim more Vi-compatible
13 " NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
14 " options, so any other options should be set AFTER setting 'compatible'.
15 " set compatible
16 
17 " Vim5 and later versions support syntax highlighting. Uncommenting the next
18 " line enables syntax highlighting by default.
19 if has("syntax")
20   syntax on
21 endif
22 
23 " If using a dark background within the editing area and syntax highlighting
24 " turn on this option as well
25 "set background=dark
26 
27 " Uncomment the following to have Vim jump to the last position when
28 " reopening a file
29 "if has("autocmd")
30 "  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
31 "endif
32 
33 " Uncomment the following to have Vim load indentation rules and plugins
34 " according to the detected filetype.
35 "if has("autocmd")
36 "  filetype plugin indent on
37 "endif
38 
39 " The following are commented out as they cause vim to behave a lot
40 " differently from regular Vi. They are highly recommended though.
41 set showcmd        " Show (partial) command in status line.
42 set showmatch        " Show matching brackets.
43 set hlsearch        " 搜索高亮显示
44 "set ignorecase        " Do case insensitive matching
45 "set smartcase        " Do smart case matching
46 "set incsearch        " Incremental search
47 "set autowrite        " Automatically save before commands like :next and :make
48 "set hidden        " Hide buffers when they are abandoned
49 "set mouse=a        " Enable mouse usage (all modes)
50 
51 " Source a global configuration file if available
52 if filereadable("/etc/vim/vimrc.local")
53   source /etc/vim/vimrc.local
54 endif
55 
56 set nu              "设置行号
57 set cursorline      "突显当前行
58 set cursorcolumn    "突显当前列
59 set autoread        "文件改动后自动加载修改后的文件
60 set autoindent      "换行后自动缩进
61 set tabstop=4       "Tab键的空格个数
62 set encoding=utf-8  "编码格式
63 set t_Co=256        "配色
64 
65 " 命令模式下,底部操作指令按下 Tab 键自动补全。第一次按下 Tab,会显示所有匹配的操作指令的清单;第二次按下 Tab,会依次选择各个指令。
66 set wildmenu
67 set wildmode=longest:list,full
68 
69 set lines=55 columns=100 "设置窗口大小

 

posted @ 2021-03-07 18:03  Reqaw  阅读(262)  评论(0编辑  收藏  举报