Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from pgr0ss/tslime_example

Tslime example
  • Loading branch information...
commit 3628c358beb8ffa41efe63691220c174e4fe7327 2 parents 4867db4 + c6e564a
@benmills benmills authored
Showing with 31 additions and 8 deletions.
  1. +18 −0 README.mkd
  2. +13 −8 plugin/vimux.vim
View
18 README.mkd
@@ -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
View
21 plugin/vimux.vim
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.