vimrc文件,用于配置vim编辑器。在Linux下位于~/.vimrc。
ubuntu下的vimrc配置:
""""""""""""""""""""""""""
" set mapleader
""""""""""""""""""""""""""
let mapleader=","
""""""""""""""""""""""""""
"shotcut of the vim configFile vimrc
""""""""""""""""""""""""""
"Fast reloading of the vimrc
map <silent><leader>sv :source ~/.vimrc<cr>
"Fast edit of the vimrc
map <silent><leader>ee :e ~/.vimrc<cr>
"When vimrc is edited,reload it
autocmd!bufwritepost .vimrc source ~/.vimrc
""""""""""""""""""""""""""
" session viminfo
""""""""""""""""""""""""""
map <silent><leader>so :source session-kernel.vim<cr>
map <silent><leader>ss :mks! session-kernel.vim<cr>
" execute project related configuration in current directory
autocmd VimEnter * :call s:ReadSession()
function! s:ReadSession()
let session_file = "./session-kernel.vim"
if filereadable( session_file )
execute "so " . session_file
endif
let session_file = "./session-android-4412.vim"
if filereadable( session_file )
execute "so " . session_file
endif
endfunction
autocmd VimLeave * :call s:WriteSession()
function! s:WriteSession()
let session_file = "./session-kernel.vim"
if filereadable( session_file )
execute "mks! " . session_file
endif
let session_file = "./session-android-4412.vim"
if filereadable( session_file )
execute "mks! " . session_file
endif
endfunction
""""""""""""""""""""""""""
" autoindent,backup,fold,color
""""""""""""""""""""""""""
set autoindent
set shiftwidth=4
set tabstop=4
set smarttab
set expandtab
set nobackup
set foldmethod=syntax
""""""""""""""""""""""""""
" netrw setting
""""""""""""""""""""""""""
let g:netrw_winsize = 30
nmap <silent><leader>fe :Sexplore!<cr>
""""""""""""""""""""""""""
" install buffer explorer plugin,use the cmd <leader>be
""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
" File Encode
""""""""""""""""""""""""""""""
set encoding=utf-8
set fileencodings=gb2313,ucs-bom,utf-8,chinese
set fileencoding=utf-8
""""""""""""""""""""""""""
" 对于vimwiki 1.2而言,html模板的配置有变化
""""""""""""""""""""""""""
set nocompatible
filetype plugin on
syntax on
let g:vimwiki_list=[{'path':'/home/ny/github/nieyong.github.com/wiki/',
\'path_html':'/home/ny/github/nieyong.github.com/',
\'template_path':'/home/ny/github/nieyong.github.com/templates/',
\'template_default':'default',
\'template_ext':'.tpl'}]
Linux下的vimrc配置:
""""""""""""""""""""""""""
" set mapleader
""""""""""""""""""""""""""
let mapleader=","
""""""""""""""""""""""""""
"shotcut of the vim configFile vimrc
""""""""""""""""""""""""""
"Fast reloading of the vimrc
map <silent><leader>ss :source ~/.vimrc<cr>
"Fast edit of the vimrc
map <silent><leader>ee :e ~/.vimrc<cr>
"When vimrc is edited,reload it
autocmd!bufwritepost .vimrc source ~/.vimrc
""""""""""""""""""""""""""
" autoindent,backup,fold,color
""""""""""""""""""""""""""
set autoindent
set shiftwidth=4
set tabstop=4
set smarttab
set expandtab
set nobackup
""""""""""""""""""""""""""
" netrw setting
""""""""""""""""""""""""""
let g:netrw_winsize = 30
nmap <silent><leader>fe :Sexplore!<cr>
""""""""""""""""""""""""""
" install buffer explorer plugin,use the cmd <leader>be
""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
" File Encode
""""""""""""""""""""""""""""""
set encoding=utf-8
set fileencodings=gb2313,ucs-bom,utf-8,chinese
set fileencoding=utf-8
""""""""""""""""""""""""""
" 对于vimwiki 1.2而言,html模板的配置有变化
""""""""""""""""""""""""""
set nocompatible
filetype plugin on
syntax on
let g:vimwiki_list=[{'path':'/home/ny/github/nieyong.github.com/wiki/',
\'path_html':'/home/ny/github/nieyong.github.com/',
\'template_path':'/home/ny/github/nieyong.github.com/templates/',
\'template_default':'default',
\'template_ext':'.tpl'}]
Windows下的vimrc文件配置:
""""""""""""""""""
" source the vim config file /etc/vimrc
""""""""""""""""""
source /etc/vimrc
""""""""""""""""""""""""""
" below is my own config
""""""""""""""""""""""""""
"""""""""""""""""""""""""
" 去除gvim中的菜单栏和工具栏
"""""""""""""""""""""""""
set go=
""""""""""""""""""""""""""
" set mapleader
""""""""""""""""""""""""""
let mapleader=","
""""""""""""""""""""""""""
" window position,size
""""""""""""""""""""""""""
winpos 35 35
set lines=35 columns=90
""""""""""""""""""""""""""
"shotcut of the vim configFile vimrc
""""""""""""""""""""""""""
"Fast reloading of the vimrc
map <silent><leader>ss :source ~/.vimrc<cr>
"Fast edit of the vimrc
map <silent><leader>ee :e ~/.vimrc<cr>
"When vimrc is edited,reload it
autocmd!bufwritepost .vimrc source ~/.vimrc
""""""""""""""""""""""""""
"shotcut of the vim configFile vimrc
"如果在ms下不起作用,那很可能是windows 7下面C盘目录权限的问题
""""""""""""""""""""""""""
"Fast reloading of the vimrc
map <silent><leader>ss :source H:/Program Files/Vim/_vimrc<cr>
"Fast edit of the vimrc
map <silent><leader>ee :e H:/Program Files/Vim/_vimrc<cr>
"When vimrc is edited,reload it
autocmd!bufwritepost _vimrc source H:/Program Files/Vim/_vimrc
""""""""""""""""""""""""""
" autoindent,backup,fold,color
""""""""""""""""""""""""""
set autoindent
set shiftwidth=4
set tabstop=4
set smarttab
set expandtab
set nobackup
set foldmethod=syntax
color murphy
""""""""""""""""""""""""""""""
" 设置gvim使用英文界面
""""""""""""""""""""""""""""""
set langmenu=en_US
let $LANG = 'en_US'
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
""""""""""""""""""""""""""
" netrw setting
""""""""""""""""""""""""""
let g:netrw_winsize = 30
nmap <silent><leader>fe :Sexplore!<cr>
""""""""""""""""""""""""""
" install buffer explorer plugin,use the cmd <leader>be
""""""""""""""""""""""""""
""""""""""""""""""""""""""""""
" File Encode
""""""""""""""""""""""""""""""
set encoding=utf-8
set fileencodings=gb2313,ucs-bom,utf-8,chinese
set fileencoding=utf-8
"""""""""""""""""""""""""""""
" install Vimwiki plugin
"""""""""""""""""""""""""""""
" set for vimwiki
set nocompatible
filetype plugin on
syntax on
map <F12> :VimwikiAll2HTML<cr>
map <F4> :Vimwiki2HTML<cr>
"calendar
"map <F8> :Calendar<cr>
let g:vimwiki_camel_case = 0
let g:vimwiki_list=[{'path':'/home/ny/Documents/vimwiki/nieyong.github.com/wiki/',
\'path_html':'/home/ny/Documents/vimwiki/nieyong.github.com/',
\'html_header': '/home/ny/Documents/vimwiki/nieyong.github.com/header.tpl',
\'html_footer': '/home/ny/Documents/vimwiki/nieyong.github.com/footer.tpl'},
\{'path':'/home/ny/Documents/vimwiki/wiki_life/'},
\{'path':'/home/ny/Documents/vimwiki/nienet/wiki/',
\'path_html':'/home/ny/Documents/vimwiki/nienet/'}]
""""""""""""""""""""""""""
" 对于vimwiki 1.2而言,html模板的配置有变化
""""""""""""""""""""""""""
let g:vimwiki_list=[{'path':'d:/git/nieyong.github.com/wiki/',
\'path_html':'d:/git/nieyong.github.com/',
\'template_path':'d:/git/nieyong.github.com/templates/',
\'template_default':'default',
\'template_ext':'.tpl'}]
"设置vim的路径为打开文件的当前路径,以使得 wiki 的 search.py能够工作在wiki路径下,否则都是在路径 ~/下
au BufNewFile,BufRead *.wiki cd %:p:h
au FileType vimwiki map <F8> :call SearchWiki
function! SearchWiki(Name)
execute "!./search.py ".a:Name
execute "VimwikiGoto search"
endfunction
au FileType vimwiki command! -buffer -nargs=1 SearchWiki call SearchWiki("<args>")