mac选手使用vim的时候发现,代码全是白色的!我的天,我用的是vi吗?
但是编辑/usr/share/vim/vimrc中会发现系统不让用户改因为没有权限,这样可以直接在当前用户下实现同样的功能。步骤如下:
新建vimrc文件
vim ~/.vimrc
这里提示是New File,没问题就是New File。
cp下面代码着色代码
" Configuration file for vim
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
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
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup
let skip_defaults_vim=1
保存再进vim
我的天!这不是酷炫到炸?