Mac OS X 中 VIM 语法高亮配置指南
前言
Vim 是一款源自 UNIX 平台且功能强大的命令行文本编辑器,但在 Mac OS X 环境下,它往往缺乏 Linux 发行版中常见的代码高亮、自动缩进等便捷特性。
(译者注:通常 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
完成编辑后保存并退出即可生效。
总结
以上就是本文的全部内容,希望这些设置能对大家在 Mac OS X 下学习或操作 Vim 有所帮助。如有任何疑问,欢迎留言交流。感谢大家对本站的支持。