Created
January 30, 2014 14:58
-
-
Save simonista/8710242 to your computer and use it in GitHub Desktop.
vimrc tips and tricks from instructure
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
" classic conundrum | |
nnoremap <up> <nop> | |
nnoremap <down> <nop> | |
nnoremap <left> <nop> | |
nnoremap <right> <nop> | |
inoremap <up> <nop> | |
inoremap <down> <nop> | |
inoremap <left> <nop> | |
inoremap <right> <nop> | |
" ericb | |
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher | |
if executable('ag') | |
" Use Ag over Grep | |
set grepprg=ag\ --nogroup\ --nocolor | |
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
" ag is fast enough that CtrlP doesn't need to cache | |
let g:ctrlp_use_caching = 0 | |
endif | |
" ddorman | |
function! TrimWhiteSpace() | |
let l:cursor = getpos(".") | |
%s/\s\+$//e | |
call setpos('.', l:cursor) | |
endfunction | |
autocmd BufWritePre * :call TrimWhiteSpace() | |
autocmd FileWritePre * :call TrimWhiteSpace() | |
" zachp | |
set number | |
set relativenumber | |
function! NumberToggle() | |
if(&relativenumber == 1) | |
set number | |
else | |
set relativenumber | |
endif | |
endfunc | |
nnoremap <F3> :call NumberToggle()<CR> | |
" brianp | |
" Run spec under the cursor | |
nmap <leader>r :wa <CR> :execute "!bundle exec spec " . expand('%') . ':' . line('.')<CR> | |
" simon | |
" Remember last location in file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal g'\"" | endif | |
endif | |
" simon | |
" Save when losing focus | |
au FocusLost * :wa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment