Skip to content

Commit

Permalink
Create language specific key bindings with autocmd
Browse files Browse the repository at this point in the history
  • Loading branch information
adomokos committed Jun 27, 2016
1 parent efa89c1 commit c18b609
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
18 changes: 5 additions & 13 deletions vim/.vimrc
Expand Up @@ -100,22 +100,11 @@ nmap ,e :e <C-R>=expand("%:p:h") . "/"<CR>
nmap ,, <C-^>
nmap <C-c> <ESC>
" Run rspec test on the currently edited file
nmap ,r :!time bin/rspec % --color<CR>
nmap ,d :!time bin/rspec % -fd --color<CR>
nmap ,t :execute "!time bundle exec rspec %:" . line(".")<cr>
" Include user's local vim config
if filereadable(expand("~/.vimrc.scripts"))
source ~/.vimrc.scripts
endif

" set commentstrings
if !exists("autocmmands_loaded")
let autocommands_loaded = 1
autocmd FileType ruby set commentstring=#%s
endif

" regenerate tags for ctags
" collided with VimClojure, but I don't use this that often
" map <Leader>rt :!/usr/local/Cellar/ctags/5.8/bin/ctags --extra=+f -R *<CR>
Expand Down Expand Up @@ -154,5 +143,8 @@ let g:ctrlp_max_depth = 5
" Add bufferline to vim-airline
let g:airline_section_y = 'BN: %{bufnr("%")}'

" hook in FindSpec
nmap ,a :call FindSpec()<CR>
if !exists("autocmmands_loaded")
let autocommands_loaded = 1
au Filetype clojure source ~/.vim/scripts/clojure.vim
au Filetype ruby source ~/.vim/scripts/ruby.vim
endif
1 change: 1 addition & 0 deletions vim/scripts/clojure.vim
@@ -0,0 +1 @@
nmap ,r :Require! <bar> Eval (clojure.test/run-tests)<CR>
10 changes: 10 additions & 0 deletions vim/scripts/ruby.vim
@@ -0,0 +1,10 @@
" Ruby specific NerdCommenter
set commentstring=#%s

" Run rspec test on the currently edited file
nmap ,r :!time bin/rspec % --color<CR>
nmap ,d :!time bin/rspec % -fd --color<CR>
nmap ,t :execute "!time bundle exec rspec %:" . line(".")<cr>
" hook in FindSpec
nmap ,a :call FindSpec()<CR>

0 comments on commit c18b609

Please sign in to comment.