Skip to content

Instantly share code, notes, and snippets.

@ceilwoo
Created November 12, 2015 05:20
Show Gist options
  • Save ceilwoo/06a9bbb3d65e3ecdf798 to your computer and use it in GitHub Desktop.
Save ceilwoo/06a9bbb3d65e3ecdf798 to your computer and use it in GitHub Desktop.
simple vimrc
"--------------------------------------------------------------------------------
" Simple Vimrc v1.1
" by [email protected]
"--------------------------------------------------------------------------------
" 支持中文,无插件
" 适用于命令行vim,gvim,windows,mac os
set number
colorscheme desert
set ignorecase
set linespace=2
set fdm=marker
set noswapfile
"--------------------------------------------------------------------------------
" Encoding Setting
"--------------------------------------------------------------------------------
if has ("gui_running")
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
let &termencoding=&encoding
"MENU LANGUAGE
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"CONSLE LANGUAGE
language messages zh_CN.utf-8
endif
"--------------------------------------------------------------------------------
" Search / Replace setting
"--------------------------------------------------------------------------------
set hlsearch " hightlighting search result
set incsearch
"--------------------------------------------------------------------------------
" Status Bar Setting
"--------------------------------------------------------------------------------
set statusline=[%F]%y%r%m%*%=[%l/%L;%c][%p%%] " status format
set laststatus=2 " always show the status bar
set ruler " show current line
"--------------------------------------------------------------------------------
" programme setting
"--------------------------------------------------------------------------------
filetype pluginindenton
"set showmatch
set smartindent
set shiftwidth=4
set autoindent
"set ai!
set backspace=2
set tabstop=4
"set nu!
set wrap
set wildmenu
set linebreak
set autochdir
set nobackup
set equalalways
set matchpairs=(:),{:},[:],<:>
set whichwrap=b,s,<,>,[,]
"--------------------------------------------------------------------------------
" QUICKFIX WINDOW
"--------------------------------------------------------------------------------
command -bang -nargs=? QFix call QFixToggle(<bang>0)
function! QFixToggle(forced)
if exists("g:qfix_win") && a:forced == 0
cclose
unlet g:qfix_win
else
copen 10
let g:qfix_win = bufnr("$")
endif
endfunction
nnoremap <leader>q :QFix<CR>
"--------------------------------------------------------------------------------
"tabpage setting
"--------------------------------------------------------------------------------
set guitablabel=%N/\ %t\ %M
augroup Tabs
nmap ,tn :tabnew<cr>
nmap ,te :tabedit
nmap ,tx :tabedit .<cr>
nmap ,tf :tabfirst<cr>
nmap ,tl :tablast<cr>
nmap ,th :tab help<cr>
augroup END
map <C-TAB> :tabn<CR>
imap <C-TAB> :tabn<CR>
nmap gf :tabedit <cfile><CR>
"--------------------------------------------------------------------------------
" Handle common typos for :commands
"-------------------------------------------------------------------------------
command! Q quit
command! W write
command! Wq wq
"- this one won't work, because :X is already a built-in command
"- command! X xit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment