1、VIM配置

  Vim强大的配置与功能,其来源基本上就两个地方:Vim插件以及Vim配置文件
  Vim本身的系统配置文件夹是在/usr/share/vim/和/etc/vim/两个文件夹下。一般情况下,我们不需要改变这两个文件夹下的配置文件,只需在自身用户文件夹/home/username(其中,username为用户名,我的用户名是xiaoku)下建立自己的配置文件(.vimrc)。

  一个具有语法高亮的.vimrc配置文件参考内容如下:

 1 " This line should not be removed as it ensures that various options are
 2 " properly set to work with the Vim-related packages available in Debian.
 3 " debian.vim
 4 
 5 " Uncomment the next line to make Vim more Vi-compatible
 6 " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
 7 " options, so any other options should be set AFTER setting 'compatible'.
 8 set nocompatible
 9 
10 " Vim5 and later versions support syntax highlighting. Uncommenting the
11 " following enables syntax highlighting by default.
12 if has("syntax")
13     syntax on            " 语法高亮
14 endif
15 colorscheme ron        " elflord ron peachpuff default 设置配色方案,vim自带的配色方案保存在/usr/share/vim/vim72/colors目录下
16 
17 " detect file type
18 filetype on
19 filetype plugin on
20 
21 " If using a dark background within the editing area and syntax
22 "    highlighting
23 " turn on this option as well
24 set background=dark
25 
26 " Uncomment the following to have Vim jump to the last position when
27 " reopening a file
28 if has("autocmd")
29     au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
30     "have Vim load indentation rules and plugins according to the detected
31     filetype
32     filetype plugin indent on
33 endif
34 
35 " The following are commented out as they cause vim to behave a lot
36 " differently from regular Vi. They are highly recommended though.
37 
38 "set ignorecase        " 搜索模式里忽略大小写
39 "set smartcase        " 如果搜索模式包含大写字符,不使用 'ignorecase'
40 "    选项。只有在输入搜索模式并且打开 'ignorecase' 选项时才会使用。
41 set autowrite        " 自动把内容写回文件: 如果文件被修改过,在每个
42 "    :next、:rewind、:last、:first、:previous、:stop、:suspend、:tag、:!、:make、CTRL-]
43 "    和 CTRL-^命令时进行;用 :buffer、CTRL-O、CTRL-I、'{A-Z0-9} 或 `{A-Z0-9}
44 "    命令转到别的文件时亦然。
45 set autoindent        "设置自动对齐(缩进):即每行的缩进值与上一行相等;使用 noautoindent
46 "    取消设置
47 "set smartindent        " 智能对齐方式
48 set tabstop=4        " 设置制表符(tab键)的宽度
49 set softtabstop=4     " 设置软制表符的宽度    
50 set shiftwidth=4    " (自动) 缩进使用的4个空格
51 set cindent            " 使用 C/C++ 语言的自动缩进方式
52 set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
53 "设置C/C++语言的具体缩进方式
54 "set backspace=2    " 设置退格键可用
55 set showmatch        " 设置匹配模式,显示匹配的括号
56 set linebreak        " 整词换行
57 set whichwrap=b,s,<,>,[,] " 光标从行首和行末时可以跳到另一行去
58 "set hidden " Hide buffers when they are abandoned
59 set mouse=a            " Enable mouse usage (all modes)    "使用鼠标
60 set number            " Enable line number    "显示行号
61 "set previewwindow    " 标识预览窗口
62 set history=50        " set command history to 50    "历史记录50条
63 
64 "
65 "    "--状态行设置--
66 set laststatus=2 "
67 "    总显示最后一个窗口的状态行;设为1则窗口数多于一个的时候显示最后一个窗口的状态行;0不显示最后一个窗口的状态行
68 set ruler            "
69 "    标尺,用于显示光标位置的行号和列号,逗号分隔。每个窗口都有自己的标尺。如果窗口有状态行,标尺在那里显示。否则,它显示在屏幕的最后一行上。
70 "
71 "    "--命令行设置--
72 set showcmd            " 命令行显示输入的命令
73 set showmode        " 命令行显示vim当前模式
74 "
75 "    "--find setting--
76 set incsearch        " 输入字符串就显示匹配点
77 set hlsearch      
View Code

相关文章:

  • 2021-12-09
  • 2021-09-14
  • 2021-08-18
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2021-09-12
  • 2022-02-06
猜你喜欢
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2021-09-02
相关资源
相似解决方案