Created
January 7, 2013 03:05
-
-
Save anonymous/4472002 to your computer and use it in GitHub Desktop.
My .vimrc file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call pathogen#infect() | |
call pathogen#helptags() | |
set colorcolumn=80 | |
highlight OverLength ctermbg=red ctermfg=white guibg=#592929 | |
match OverLength /\%81v.\+/ | |
syntax enable | |
set background=dark | |
let g:solarized_termcolors = 256 | |
let g:solarized_visibility = "high" | |
let g:solarized_contrast = "high" | |
colorscheme solarized | |
set autoindent | |
set pastetoggle=<C-p> | |
set grepprg=ack | |
let mapleader="," | |
noremap <F5> :CommandTFlush<CR> | |
nmap <silent> <Leader>n :NERDTreeToggle<CR> | |
if argc() == 0 | |
" autocmd vimenter * NERDTree | |
end | |
set wildignore+=tmp/** | |
set softtabstop=2 | |
set shiftwidth=2 | |
set tabstop=2 | |
set expandtab | |
set ttimeoutlen=50 | |
if &term =~ "xterm" || &term =~ "screen" | |
let g:CommandTCancelMap = ['<ESC>', '<C-c>'] | |
let g:CommandTSelectNextMap = ['<C-n>', '<C-j>', '<ESC>OB'] | |
let g:CommandTSelectPrevMap = ['<C-p>', '<C-k>', '<ESC>OA'] | |
let g:CommandTFlush = ['<C-l>'] | |
endif | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
function! Smart_TabComplete() | |
let line = getline('.') " current line | |
let substr = strpart(line, -1, col('.')+1) " from the start of the current | |
" line to one character right | |
" of the cursor | |
let substr = matchstr(substr, "[^ \t]*$") " word till cursor | |
if (strlen(substr)==0) " nothing to match on empty string | |
return "\<tab>" | |
endif | |
let has_period = match(substr, '\.') != -1 " position of period, if any | |
let has_slash = match(substr, '\/') != -1 " position of slash, if any | |
if (!has_period && !has_slash) | |
return "\<C-X>\<C-P>" " existing text matching | |
elseif ( has_slash ) | |
return "\<C-X>\<C-F>" " file matching | |
else | |
return "\<C-X>\<C-O>" " plugin matching | |
endif | |
endfunction | |
inoremap <tab> <c-r>=Smart_TabComplete()<CR> | |
autocmd FileType c,cpp,java,php,ruby,python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment