Created
March 22, 2014 02:49
-
-
Save dmix/9700391 to your computer and use it in GitHub Desktop.
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
" vimrc shortcut | |
map vrc :e ~/.vimrc | |
" core | |
let mapleader="\<Space>" | |
set t_Co=256 " use 256 colors in terminator | |
" pathogen | |
silent! call pathogen#runtime_append_all_bundles() | |
" color scheme | |
colorscheme Tomorrow-Night | |
let g:molokai_original = 1 | |
let g:rehash256 = 1 | |
syntax enable | |
filetype plugin indent on | |
" config | |
set history=1000 " Increase history from 20 default to 1000 | |
set hidden " When a buffer is brought to foreground, remember undo history and marks. | |
set number | |
set noerrorbells " Disable error bells. | |
"set foldmethod=syntax " Markers are used to specify folds. | |
"set foldenable | |
"set foldlevel=2 | |
set esckeys " Allow cursor keys in insert mode. | |
set nohlsearch " Enable search result highlighting. | |
set incsearch " Highlight dynamically as pattern is typed. | |
set noinsertmode " Don't start vim in insert mode. | |
set magic " Enable extended regexes. | |
set report=0 " Show all changes. | |
set ruler " Show the cursor position. | |
set shortmess=I " Don't show the intro message when starting vim. | |
set showmode " Show the current mode. | |
set nostartofline " Don't jump to the start of the line when moving around. | |
set title " Show the filename in the window titlebar. | |
set wildchar=<TAB> " Character for CLI expansion (TAB-completion). | |
set wildmenu " Hitting TAB in command mode will show possible completions above command line. | |
set wildmode=list:longest " Complete only until point of ambiguity. | |
set expandtab " Expand tabs to spaces. | |
set tabstop=2 " Hitting the tab key results in 4 spaces. | |
set shiftwidth=2 " The # of spaces for indenting. | |
set smarttab " At start of line, <Tab> inserts shiftwidth spaces, <Bs> deletes shiftwidth spaces. | |
set backspace=start,indent,eol | |
set ignorecase " In searches, ignore case of lower case letters. | |
set smartcase " Override ignorecase if search contains upper case letters. | |
set scrolloff=3 " Start scrolling three lines before horizontal border of window. | |
set shortmess=atI " Shorten command line text and other info tokens. | |
set cul | |
set ls=2 | |
set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P | |
set autowrite | |
set grepprg=ag | |
set diffopt=filler,vertical | |
set noswapfile | |
set mouse +=a | |
set diffopt=filler " Add vertical spaces to keep right and left aligned | |
set diffopt+=iwhite " Ignore whitespace changes (focus on code changes) | |
set noshowmode " Don't show the current mode (airline.vim takes care of us) | |
set ai | |
" sudo write | |
noremap <leader>2 :w !sudo tee %<CR> | |
" nerdtree | |
map <C-n> :NERDTreeToggle<CR> | |
" copypasta | |
set clipboard=unnamedplus | |
vmap <C-c> "+yi | |
vmap <C-x> "+c | |
vmap <C-v> c<ESC>"+p | |
imap <C-v> <ESC>"+pa | |
imap <C-v> <Esc><C-v>a | |
" because im shitfy | |
command WQ wq | |
command Wq wq | |
command W w | |
command Q q | |
" vim.notes | |
let g:notes_directories = ['/home/dmix/notes'] | |
let g:notes_suffix = '.txt' | |
" ctrlp | |
let g:ctrlp_map = '<C-p>' | |
let g:ctrlp_cmd = 'CtrlPMixed' " search anything (in files, buffers and MRU files at the same time.) | |
let g:ctrlp_working_path_mode = 'ra' " search for nearest ancestor like .git, .hg, and the directory of the current file | |
let g:ctrlp_match_window_bottom = 0 " show the match window at the top of the screen | |
let g:ctrlp_max_height = 10 " maxiumum height of match window | |
let g:ctrlp_switch_buffer = 'et' " jump to a file if it's open already | |
"let g:ctrlp_use_caching = 1 " enable caching | |
let g:ctrlp_clear_cache_on_exit=0 " speed up by not removing clearing cache evertime | |
let g:ctrlp_show_hidden = 1 " show me dotfiles | |
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] | |
let g:ctrlp_use_caching = 0 | |
" silver search > grep/ack | |
let g:ackprg = 'ag --nogroup --nocolor --column' " use silver_searcher instead of ack | |
" neocomplete | |
let g:acp_enableAtStartup = 0 | |
let g:neocomplcache_enable_at_startup = 1 | |
let g:neocomplcache_enable_smart_case = 1 | |
let g:neocomplcache_min_syntax_length = 3 | |
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' | |
" Recommended key-mappings. | |
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> | |
function! s:my_cr_function() | |
return neocomplcache#smart_close_popup() . "\<CR>" | |
" For no inserting <CR> key. | |
"return pumvisible() ? neocomplcache#close_popup() : "\<CR>" | |
endfunction | |
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>" | |
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>" | |
inoremap <expr><C-y> neocomplcache#close_popup() | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTagsnoremap <expr><C-e> neocomplcache#cancel_popup() | |
"neocomplete | |
imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
xmap <C-k> <Plug>(neosnippet_expand_target) | |
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: pumvisible() ? "\<C-n>" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" | |
\: "\<TAB>" | |
" For snippet_complete marker. | |
if has('conceal') | |
set conceallevel=2 concealcursor=i | |
endif | |
let g:neosnippet#enable_snipmate_compatibility = 1 | |
let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets' | |
" remove trailing whitespace | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
autocmd FileType c,cpp,java,php,ruby,python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces() | |
autocmd InsertEnter * set cul | |
autocmd InsertLeave * set nocul | |
let g:syntastic_disabled_filetypes = ['java'] | |
let g:miniBufExplBRSplit = 0 | |
" using buffers instead of tabs | |
nnoremap <Leader>p :buffers<CR>:buffer<Space> | |
nnoremap <Leader>n :bn<CR> | |
nnoremap <Leader>b :bp<CR> | |
nnoremap <Leader>m :bprev<CR> | |
nnoremap <Leader>k :BufOnly<CR> | |
let g:notes_directories = ['~/notes/', '~/notes/projects', '~/notes/reference', '~/notes/writing'] | |
autocmd FileType make setlocal noexpandtab | |
function! YRRunAfterMaps() | |
" Make Y yank to end of line. | |
nnoremap Y :<C-U>YRYankCount 'y$'<CR> | |
" Don't clobber the yank register when pasting over text in visual mode. | |
vnoremap p :<c-u>YRPaste 'p', 'v'<cr>gv:YRYankRange 'v'<cr> | |
endfunction | |
" Tabs | |
nnoremap <leader>[ :tabprev<cr> | |
nnoremap <leader>] :tabnext<cr> | |
" Make | |
nmap <F9> :SCCompile<cr> | |
nmap <C-b> :SCCompileRun<cr> | |
" Neocomplete | |
let g:neocomplcache_enable_auto_select = 1 | |
" Space paste | |
nnoremap <Leader>w :w<CR> | |
vmap <Leader>y "+y | |
vmap <Leader>d "+d | |
nmap <Leader>p "+p | |
nmap <Leader>P "+P | |
vmap <Leader>p "+p | |
vmap <Leader>P "+P | |
" space space to visual mode | |
nmap <Leader><Leader> V | |
" region expanding: v = one char, v again for word, v again for paragraph | |
vmap v <Plug>(expand_region_expand) | |
vmap <C-v> <Plug>(expand_region_shrink) | |
" jump to end of line after paste | |
vnoremap <silent> y y`] | |
vnoremap <silent> p p`] | |
nnoremap <silent> p p`] | |
" vp doesn't replace paste buffer | |
function! RestoreRegister() | |
let @" = s:restore_reg | |
return '' | |
endfunction | |
function! s:Repl() | |
let s:restore_reg = @" | |
return "p@=RestoreRegister()\<cr>" | |
endfunction | |
vmap <silent> <expr> p <sid>Repl() | |
" airline | |
let g:airline_theme='powerlineish' | |
let g:airline_left_sep='' | |
let g:airline_right_sep='' | |
let g:airline_section_z='' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment