Browse Source

update vimrc: maxium gvim when start

remotes/origin/master
Ein Verne 10 years ago
parent
commit
adfb07ca02
  1. 48
      _vimrc

48
_vimrc

@ -1,3 +1,21 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Judge current OS is Windows or Linux
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if(has("win32") || has("win64") || has("win95") || has("win16"))
let g:iswindows = 1
else
let g:iswindows = 0
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Judge current process is vim or gvim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("gui_running")
let g:isGUI = 1
else
let g:isGUI = 0
endif
" 引用vundle_vimrc " 引用vundle_vimrc
source $VIM/vundle_vimrc source $VIM/vundle_vimrc
@ -26,14 +44,24 @@ let g:mapleader = ","
nmap <leader>w :w!<cr> nmap <leader>w :w!<cr>
"编辑vimrc之后,重新加载 "编辑vimrc之后,重新加载
if g:iswindows
autocmd! bufwritepost _vimrc source $VIM/_vimrc autocmd! bufwritepost _vimrc source $VIM/_vimrc
else
autocmd! bufwritepost *.vimrc source $HOME/.vimrc
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface " => VIM user interface
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" set 7 lines to the cursor - when moving vertically using j/k " set 8 lines to the cursor - when moving vertically using j/k
" j/k移动时光标距离文件上下n行 缩写 set so = 8
set scrolloff=8 set scrolloff=8
" gVim automatically maximize when it open
" 启动时最大化gVim
" http://superuser.com/questions/140419/how-to-start-gvim-maximized
au GUIEnter * simalt ~x
" 如下命令使鼠标用起来象微软 Windows " 如下命令使鼠标用起来象微软 Windows
behave mswin behave mswin
@ -42,8 +70,10 @@ set cursorline
" always show current position " always show current position
set ruler set ruler
" height of the command bar " height of the command bar
set cmdheight=2 set cmdheight=2
" in many terminal emulators the mouse works just fine, thus enable it " in many terminal emulators the mouse works just fine, thus enable it
if has('mouse') if has('mouse')
set mouse=a set mouse=a
@ -90,13 +120,13 @@ colorscheme molokai
"vim内部编码 "vim内部编码
set encoding=utf-8 set encoding=utf-8
" set current file encoding
set fileencoding=utf-8
"按照utf-8 without bom,utf-8,顺序识别打开文件 "按照utf-8 without bom,utf-8,顺序识别打开文件
set fileencodings=ucs-bom,utf-8,gbk,gb2312,cp936,big5,gb18030,shift-jis,latin1 set fileencodings=ucs-bom,utf-8,gbk,gb2312,cp936,big5,gb18030,shift-jis,latin1
set fileencoding=utf-8
"防止菜单乱码 "防止菜单乱码
if(has("win32") || has("win64") || has("win95") || has("win16")) if(g:iswindows && g:isGUI)
source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8 language messages zh_CN.utf-8
@ -117,6 +147,7 @@ set guifontwide=NSimsun\:h12
" => Files, backups and undo " => Files, backups and undo
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git et.c anyway... " Turn backup off, since most stuff is in SVN, git et.c anyway...
" no backup file, no write backup file, no swap file
set nobackup set nobackup
set nowb set nowb
set noswapfile set noswapfile
@ -206,6 +237,9 @@ let g:jedi#popup_on_dot = 0
" no <up> ddkP " no <up> ddkP
" no <down> ddp " no <down> ddp
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" =>Others
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Delete trailing white space on save, useful for Python and CoffeeScript ;) " Delete trailing white space on save, useful for Python and CoffeeScript ;)
func! DeleteTrailingWS() func! DeleteTrailingWS()
exe "normal mz" exe "normal mz"
@ -215,6 +249,12 @@ endfunc
autocmd BufWrite *.py :call DeleteTrailingWS() autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS() autocmd BufWrite *.coffee :call DeleteTrailingWS()
" smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
set diffexpr=MyDiff() set diffexpr=MyDiff()
function! MyDiff() function! MyDiff()
let opt = '-a --binary ' let opt = '-a --binary '

Loading…
Cancel
Save