Permalink
Browse files

Move back to vimux + zeus

  • Loading branch information...
1 parent f299e1d commit e9277cb334bbab5deba6eabd277989b2608471ac @saulius committed Dec 10, 2012
Showing with 64 additions and 11 deletions.
  1. +3 −0 .gitmodules
  2. +1 −0 bundle/vimux
  3. +60 −11 vimrc
View
@@ -52,3 +52,6 @@
[submodule "bundle/supertab"]
path = bundle/supertab
url = https://github.com/ervandew/supertab.git
+[submodule "bundle/vimux"]
+ path = bundle/vimux
+ url = https://github.com/benmills/vimux.git
Submodule vimux added at d6d88a
View
@@ -158,14 +158,63 @@ map <leader>v :view %%
set wildmenu
set wildmode=longest,full
-" Screen settings
-let g:ScreenImpl = 'Tmux'
-let g:ScreenShellTmuxInitArgs = '-2'
-let g:ScreenShellInitialFocus = 'shell'
-let g:ScreenShellQuitOnVimExit = 0
-let g:ScreenShellHeight = 10
-map <F5> :ScreenShell<CR>
-command -nargs=? -complete=shellcmd W :w | :call ScreenShellSend("load '".@%."';")
-map <Leader>rc :ScreenShell bundle exec rails c<CR>
-map <Leader>sl :w<CR> :call ScreenShellSend("rspec ".@% . ':' . line('.'))<CR>
-map <Leader>sf :w<CR> :call ScreenShellSend("rspec ".@%)<CR>
+" Vimux
+let VimuxUseNearestPane = 1
+let g:VimuxOrientation = "v"
+let g:VimuxHeight = "30"
+
+" Run last command executed by RunVimTmuxCommand
+map rl :RunLastVimTmuxCommand<CR>
+
+" Close all other tmux panes in current window
+map rx :CloseVimTmuxPanes<CR>
+
+" Interrupt any command running in the runner pane
+map rs :InterruptVimTmuxRunner<CR>
+
+" rspec mappings
+map <Leader>st :call RunCurrentSpecFile()<CR>
+map <Leader>ss :call RunNearestSpec()<CR>
+map <Leader>sl :call RunLastSpec()<CR>
+
+function! RunCurrentSpecFile()
+ if InSpecFile()
+ let l:command = SpecRunner() . "rspec " . @% . " -f documentation"
+ call SetLastSpecCommand(l:command)
+ call RunSpecs(l:command)
+ endif
+endfunction
+
+function! RunNearestSpec()
+ if InSpecFile()
+ let l:command = SpecRunner() . "rspec " . @% . " -l " . line(".") . " -f documentation"
+ call SetLastSpecCommand(l:command)
+ call RunSpecs(l:command)
+ endif
+endfunction
+
+function! SpecRunner()
+ if filereadable("zeus.json")
+ return "zeus "
+ else
+ return "bundle exec "
+ endif
+endfunction
+
+function! RunLastSpec()
+ if exists("t:last_spec_command")
+ call RunSpecs(t:last_spec_command)
+ endif
+endfunction
+
+function! InSpecFile()
+ return match(expand("%"), "_spec.rb$") != -1
+endfunction
+
+function! SetLastSpecCommand(command)
+ let t:last_spec_command = a:command
+endfunction
+
+function! RunSpecs(command)
+ call VimuxRunCommand("clear;". a:command . " " . expand("%"))
+endfunction

0 comments on commit e9277cb

Please sign in to comment.