Merge pull request #4 from pgr0ss/tslime_example

Tslime example
1.0.0rc1
Ben Mills 12 years ago
commit 3628c358be

@ -86,6 +86,24 @@ map <Leader>rx :CloseVimTmuxPanes<CR>
map <Leader>rs :InterruptVimTmuxRunner<CR>
```
### tslime replacement
Here is how to use vimux to send code to a REPL. This is similar to tslime. First, add some helpful mappings.
```viml
" Prompt for a command to run
map <LocalLeader>vp :PromptVimTmuxCommand<CR>
" If text is selected, save it in the v buffer and send that buffer it to tmux
vmap <LocalLeader>vs "vy :call RunVimTmuxCommand(@v)<CR>
" Select current paragraph and send it to tmux
nmap <LocalLeader>vs vip<LocalLeader>vs<CR>
```
Now, open a clojure file. Let's say your leader is backslash (\). Type \vp, and then type lein repl at the prompt. This opens a tmux split running a REPL. Then, select text or put the cursor on a function and type \vs. This will send it to the REPL and evaluate it.
## Options
### VimuxHeight

@ -1,3 +1,8 @@
if exists("g:loaded_vimux") || &cp
finish
endif
let g:loaded_vimux = 1
if !has("ruby")
finish
end
@ -9,12 +14,12 @@ command InspectVimTmuxRunner :call InspectVimTmuxRunner()
command InterruptVimTmuxRunner :call InterruptVimTmuxRunner()
command PromptVimTmuxCommand :call PromptVimTmuxCommand()
function! RunVimTmuxCommand(command)
function RunVimTmuxCommand(command)
let g:_VimTmuxCmd = a:command
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
endfunction
function! RunLastVimTmuxCommand()
function RunLastVimTmuxCommand()
if exists("g:_VimTmuxCmd")
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
else
@ -22,32 +27,32 @@ function! RunLastVimTmuxCommand()
endif
endfunction
function! ClearVimTmuxWindow()
function ClearVimTmuxWindow()
if exists("g:_VimTmuxRunnerPane")
unlet g:_VimTmuxRunnerPane
end
endfunction
function! CloseVimTmuxWindows()
function CloseVimTmuxWindows()
ruby CurrentTmuxSession.new.close_other_panes
call ClearVimTmuxWindow()
echoerr "CloseVimTmuxWindows is deprecated, use CloseVimTmuxPanes"
endfunction
function! CloseVimTmuxPanes()
function CloseVimTmuxPanes()
ruby CurrentTmuxSession.new.close_other_panes
call ClearVimTmuxWindow()
endfunction
function! InterruptVimTmuxRunner()
function InterruptVimTmuxRunner()
ruby CurrentTmuxSession.new.interrupt_runner
endfunction
function! InspectVimTmuxRunner()
function InspectVimTmuxRunner()
ruby CurrentTmuxSession.new.inspect_runner
endfunction
function! PromptVimTmuxCommand()
function PromptVimTmuxCommand()
let l:command = input("Command? ")
call RunVimTmuxCommand(l:command)
endfunction

Loading…
Cancel
Save