当前位置:主页 > 服务器 > Linux >

Mac OS X中设置VIM语法高亮的方法

时间:2021-03-03 10:09:39 | 栏目:Linux | 点击:

前言

Vim 是一款相当给力的源自UNIX平台的命令行文本编辑器,不过不给力的是,Mac OS X下并没有诸多Linux发行版上VIM那些牛逼哄哄的神马代码高亮显示啊,自动缩进之类的。

(译者注:通常Linux发行版可以通过编辑/etc/vimrc文件更改全局VIM设定或者针对某个用户的~/.vimrc进行个性化配置)

为了弥补这个缺憾,请按如下方法操作:

实现方法

主要是修改~/.vimrc文件

文件内容如下:

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

保存退出即可。

总结

您可能感兴趣的文章:

相关文章