首页 > 代码库 > vim 环境参数配置 DIY

vim 环境参数配置 DIY

  • 参考《笨方法学Vimscript》   http://learnvimscriptthehardway.onefloweroneworld.com/
  • 系统环境    

    ubantu 12.04 

  • 从ubantu系统自带的vim例子开始。/usr/share/vim/vim**/vimrc_example.vim,将该文件复制到~/.vimrc
  • 添加DIY的配置选项

augroup filetype_vim
  autocmd!
  autocmd FileType vim setlocal foldmethod=marker
  "use the marker method of folding for any Vimscript files
  "for instance : z-a open and close maker
augroup END
"Basic setting--------{{{
  let mapleader = ","
  let maplocalleader = "."
  "<LocalLeader> is to be used for mappings which are local to a buffer.
"}}}
"FileType-specific settings ----{{{
  autocmd FileType vim nnoremap <buffer> <localleader>c I"<esc>
"}}}
"mappings setting---------{{{
  echo ">^.^<"
  noremap - ddp
  "move a row down
  noremap _ ddkkp
  "move a row up
  nnoremap <leader>u viwU
  "lowercase -> uppercase
  inoremap <leader>u <esc>viwUi
  nnoremap <leader>d dd
  nnoremap <leader>ev :vsplit $MYVIMRC<cr>
  nnoremap <leader>sv :source $MYVIMRC<cr>
  inoremap jk <esc>
  inoremap <esc> <nop>
  noremap <left> <nop>
  noremap <right> <nop>
  noremap <up> <nop>
  noremap <down> <nop>
  noremap ak <c-u>
  noremap aj <c-d>
"}}}

vim 环境参数配置 DIY