Skip to content

Instantly share code, notes, and snippets.

@c4pt0r
Created March 1, 2012 06:07
Show Gist options
  • Save c4pt0r/1947708 to your computer and use it in GitHub Desktop.
Save c4pt0r/1947708 to your computer and use it in GitHub Desktop.
myvimrc
filetype plugin on
set hlsearch
" Use incremental searching
set incsearch
" Set standard setting for PEAR coding standards
set tabstop=4
set shiftwidth=4
" Auto expand tabs to spaces
set expandtab
" Auto indent after a {
set autoindent
set smartindent
" Linewidth to endless
set textwidth=0
" Do not wrap lines automatically
set nowrap
" Show line numbers by default
set number
" Jump 5 lines when running out of the screen
set scrolljump=5
" Indicate jump out of the screen when 3 lines before end of the screen
set scrolloff=3
" Repair wired terminal/vim settings
set backspace=start,eol
" Map <CTRL>-B to run PHP parser check
" The completion dictionary is provided by Rasmus:
" http://lerdorf.com/funclist.txt
set dictionary-=/home/apple/funclist.txt dictionary+=/home/apple/funclist.txt
" Use the dictionary completion
set complete-=k complete+=k
" This function determines, wether we are on the start of the line text (then tab indents) or
" if we want to try autocompletion
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
" Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
"set list
"set listchars=tab:>-,trail:-
" set listchars=tab:>-,trail:-,eol:$
"set ignorecase " caseinsensitive searches
"set showmode " always show command or insert mode
"set ruler " show line and column information
"set showmatch " show matching brackets
"set formatoptions=tcqor
"set whichwrap=b,s,<,>,[,]
syntax on
" CTRL-C = SVN Commit
map <C-C> :w<CR>:!svn commit<CR>
" fuzzyfinder
map <C-l> :FufCoverageFile<CR>
nmap <C-z> :FufBuffer<CR>
nmap <silent> <Leader>nf :NERDTreeFind<CR>
" python auto-complete code
" Typing the following (in insert mode):
" os.lis<Ctrl-n>
" will expand to:
" os.listdir(
" Python 自动补全功能,只需要反覆按 Ctrl-N 就行了
if has("autocmd")
autocmd FileType python set complete+=k~/pydiction
endif
autocmd VimEnter * NERDTree
function! NERDTreeQuit()
redir => buffersoutput
silent buffers
redir END
" 1BufNo 2Mods. 3File 4LineNo
let pattern = '^\s*\(\d\+\)\(.....\) "\(.*\)"\s\+line \(\d\+\)$'
let windowfound = 0
for bline in split(buffersoutput, "\n")
let m = matchlist(bline, pattern)
if (len(m) > 0)
if (m[2] =~ '..a..')
let windowfound = 1
endif
endif
endfor
if (!windowfound)
quitall
endif
endfunction
autocmd WinEnter * call NERDTreeQuit()
set guifont=Monaco:h14
colorscheme pablo
set fileencodings=utf-8,gb18030,utf-16,big5
"set noantialias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment