Vim配置

Posted on Thu 08 December 2011 in 我用(IT)

最近Vim用得比较多,发现朋友们博客上的配置介绍写得非常好,让我轻松就完成了配置。 强烈推荐呼噜猫的配置说明。 坚毅的刀刀的这篇文章也请参考。

简要操作步骤

在启动Vim时,当前用户根目录下的.vimrc文件会被自动读取,该文件可以包含一些设置甚至脚本。

创建当前用户的.vimrc文件的命令如下: $vi ~/.vimrc 设置完后 :wq 进行保存退出即可。

我现在Mac上用的.vimrc

" 更详细的.vimrc参考: http://vi-improved.org/vimrc.html

" Basics { set nocompatible " explicitly get out of vi-compatible mode "set noexrc " don't use local version of .(g)vimrc, .exrc set background=dark " we plan to use a dark background syntax on " syntax highlighting on filetype on "enable file type detection " }

" Vim UI { set cursorcolumn " highlight the current column "set cursorline " highlight current line set incsearch " BUT do highlight as you type you " search phrase set laststatus=2 " always show the status line " out of my files set number " turn on line numbers set report=0 " tell us when anything is changed via :... set ruler " Always show current positions along the bottom set showcmd " show the command being typed set showmatch " show matching brackets set sidescrolloff=10 " Keep 5 lines at the size " }

" Text Formatting/Layout { set ignorecase " case insensitive by default set infercase " case inferred by default set smartcase " if there are caps, go case-sensitive set columns=80 "Number of columns of the screen set tabstop=4 "Number of spaces that a in the file counts for set noexpandtab " do not use spaces to insert a set autoindent "使用自动对齐,也就是把当前行的对起格式应用到下一行 set smartindent "使用智能选择对起方式 " }