首页 > 代码库 > Vim的配置
Vim的配置
刚安装的Vim,可能界面并不是十分友好,这就需要我们去更改vim的配置文件,按照我们的需求去修改它。
在命令行下,输入命令:sudo vim /etc/vim/vimrc
必须加上sudo,否则你是没有权限编辑vimrc的。
以下是小编的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 " #set ts = 4 " 12 " #set sw = 4 " 13 " Uncomment the next line to make Vim more Vi-compatible 14 " NOTE: debian.vim sets ‘nocompatible‘. Setting ‘compatible‘ changes numerous 15 " options, so any other options should be set AFTER setting ‘compatible‘. 16 "set compatible 17 18 " Vim5 and later versions support syntax highlighting. Uncommenting the next 19 " line enables syntax highlighting by default. 20 if has("syntax") 21 syntax on 22 endif 23 24 " If using a dark background within the editing area and syntax highlighting 25 " turn on this option as well 26 "set background=dark 27 28 " Uncomment the following to have Vim jump to the last position when 29 " reopening a file 30 "if has("autocmd") 31 " au BufReadPost * if line("‘\"") > 1 && line("‘\"") <= line("$") | exe "normal! g‘\"" | endif 32 "endif 33 34 " Uncomment the following to have Vim load indentation rules and plugins 35 " according to the detected filetype. 36 "if has("autocmd") 37 " filetype plugin indent on 38 "endif 39 40 " The following are commented out as they cause vim to behave a lot 41 " differently from regular Vi. They are highly recommended though. 42 "set showcmd " Show (partial) command in status line. 43 "set showmatch " Show matching brackets. 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 set nu 56 set tabstop=4 57 set nobackup 58 set cursorline 59 set ruler 60 set autoindent
1、 在这个文件中,会有这么一句:
syntax on
意思是语法高亮,如果您的被注释掉了,请“让它出来”。
2、 请在您的VIM的最后一行,输入他们,可以让您的VIM变得更漂亮、舒服。
set nu // 在左侧行号
set tabstop //tab 长度设置为 4
set nobackup //覆盖文件时不备份
set cursorline //突出显示当前行
set ruler //在右下角显示光标位置的状态行
set autoindent //自动缩进
保存之后,配置完毕。
上面的配置,其实是非常简单的,比如一些配色方案等,小编并没有写入,如果您还有其他需求的话,建议百度。
Vim的配置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。