技术技巧:一些有用的 Vim 选项
发布于 2009年7月27日
Vim 是 Linux 上最流行的文本编辑器之一。 对于 vim,有一些非默认选项可能很有用,无论您是在编辑配置文件还是用您喜欢的语言编写脚本。
vim 的全局选项在vimrc文件中启用,该文件可能位于/etc或/etc/vim,具体取决于您使用的发行版。 请注意,vimrc文件使用双引号 (") 来开始注释。
您可能会发现以下部分或全部选项很有用,只需将它们复制并粘贴到您的vimrc文件
syntax on " Turn on syntax highlighting " (makes code and config files more readable) set background=dark " If using a dark background, instead of the " usual white background in Terminal " (makes darker colors brighter) set incsearch " Used for incremental searching " (useful when searching large text files) set hlsearch " Turns on highlighting for matched search patterns " (use :nohlsearch inside vim to turn off highlights " after a search) set tabstop=4 " Sets the tab size to 4 " (tabs are usually 8 spaces) set expandtab " Tab key inserts spaces instead of tabs set shiftwidth=4 " Sets spaces used for (auto)indent set shiftround " Indent to nearest tabstop set autoindent " Carries over previous indent to the next line
中。 欢迎您留下评论,分享您自己有用的 vim 选项和宏。