Skip to content

Instantly share code, notes, and snippets.

@nilbus
Created January 19, 2016 17:21
Show Gist options
  • Save nilbus/f3a259d82dd03c65f7b5 to your computer and use it in GitHub Desktop.
Save nilbus/f3a259d82dd03c65f7b5 to your computer and use it in GitHub Desktop.
" Load pathogen plugins and reload their help files call pathogen#infect() call pathogen#helptags() " Set leader key to space nmap <Space> <NOP> let mapleader = "\<Space>"" " Indent with 2 spaces set shiftwidth=2 set softtabstop=2 set tabstop=2 set expandtab " Set width to 85 chars set textwidth=85 " Highlight things you've searched for, and press enter or - to un-highlight set hlsearch noremap - -:nohl<cr> noremap <cr> <cr>:nohl<cr> " Highlight matching braces/parenthesis set showmatch set matchtime=1 " Syntax highlighting syntax on au BufNewFile,BufRead *.tmpl set filetype=html " Wait for .5 sec before deciding you weren't trying a key sequence set timeoutlen=500 " Improved tab completion when using :e to open a file, etc. set wildmode=list:longest set wildignore+=*.class " (optional) Keep buffers open in memory (preserve undo history, etc) and just hide them when you close them (but not fugitive buffers) set hidden autocmd BufReadPost fugitive://* set bufhidden=delete " Ignore case when searching unless your search contains uppercase set ignorecase set smartcase " Set the terminal title to the active buffer's filename set title " Prefix each line with the relative number of lines above or below the current line, for quick navigation (eg. 10j) set relativenumber set number " Download Tomorrow-Night.vim into .vim/colors to use this " https://github.com/chriskempson/tomorrow-theme/tree/master/vim/colors colorscheme Tomorrow-Night " Auto-reload .vimrc augroup myvimrc au! au BufWritePost .vimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif augroup END " Use left and right arrow keys to switch between tabs nmap <left> :tabprev<cr> nmap <right> :tabnext<cr> " Remap # to search forward for the word under the cursor (like *) but don't move the cursor, instead of finding the previous match nmap # mp"pyiwb/\<<c-r>p\><cr>`p nmap g# mp"pyiwb/<c-r>p<cr>`p " Map # to search for the contents of the visual selection vnoremap <silent>* <ESC>:call VisualSearch('/')<CR>/<CR> vnoremap <silent># <ESC>:call VisualSearch('?')<CR>?<CR> function! VisualSearch(dirrection) let l:register=@@ normal! gvy let l:search=escape(@@, '$.*/\[]') if a:dirrection=='/' execute 'normal! /'.l:search else execute 'normal! ?'.l:search endif let @/=l:search normal! gV let @@=l:register endfunction " K was never good to me (load the man page for the word under the cursor). Unmap it. noremap K <NOP> " Map Ctrl+D to Delete inoremap <c-d> <del> " Maximize the current window split with :Max or Ctrl+W Ctrl+M command! Max vert res 999|res 99 nmap <c-w><c-m> :Max<cr> " Map :w!! to save with sudo cmap w!! %!sudo tee > /dev/null % " Map U to open GUndo nmap U :GundoToggle<cr> " Map \d to :Linediff vmap <leader>d :Linediff<cr> " Configure vim GPG plugin to prefer saving in ascii format let g:GPGPreferArmor=1 " Map Ctrl+P for CommandT, and configure nmap <c-p> :CommandT<CR> let g:CommandTMaxFiles=100000 let g:CommandTMatchWindowReverse=1 let g:CommandTHighlightColor='Pmenu' let g:CommandTWildIgnore=&wildignore . ",vendor/bundle,tmp" " Replace :grep with Ag, The Silver Searcher if executable('ag') set grepprg=ag\ --nogroup\ --nocolor endif " Sometimes switching keybaords causes me to hit ` instead of =... silly Kinesis nmap <c-w>` <c-w>= " Highlight the current line set cursorline " Minimize lag in ruby files set lazyredraw " Fix crontab -e au BufEnter /private/tmp/crontab.* setl backupcopy=yes nnoremap <leader>t :tabnew<cr> nnoremap <leader>c :tabc<cr> nnoremap <leader>w :w<cr> nnoremap <leader>W :wa<cr> nnoremap <leader>e :e<cr> nnoremap <leader>E :tabdo windo e<cr> nnoremap <leader>q :q<cr> nnoremap <leader>z :wq<cr> nnoremap <leader>a :!git add %<cr><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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment