<转>如何在Mac OS X中开启VIM语法高亮

打开Terminal,输入如下命令:

cd /usr/share/vimsudo vim vimrc

两行命令之后,会出现VIM,在set backspace=2这行下插入(VIM的操作不赘述,想做这个修改的肯定都会使VIM)如下配置

set ai                  " auto indenting

set history=100         " keep 100 lines of history

set ruler               " show the cursor position

syntax on               " syntax highlighting

set hlsearch            " highlight the last searched term

filetype plugin on      " use the file type plugins

 

" When editing a file, always jump to the last cursor position

autocmd BufReadPost *

\ if ! exists("g:leave_my_cursor_position_alone") |

\ if line("'\"") > 0 && line ("'\"") <= line("$") |

\ exe "normal g'\"" |

\ endif |

\ endif

然后保存退出VIM。

随便再用VIM开一个文件,比如刚才的vimrc:

sudo vim vimrc

你发现了神马……代码高亮显示了,也有自动缩进了。Yey!

然后保存退出VIM。

随便再用VIM开一个文件,比如刚才的vimrc:

sudo vim vimrc

你发现了神马……代码高亮显示了,也有自动缩进了。Yey!

然后保存退出VIM。

随便再用VIM开一个文件,比如刚才的vimrc:

sudo vim vimrc

你发现了神马……代码高亮显示了,也有自动缩进了。Yey!

posted on 2014-03-06 14:47  金玉游龙  阅读(172)  评论(0编辑  收藏  举报

导航