Merge pull request #30 from elight/master

Adds terminal page up and down commands
1.0.0rc1
Ben Mills 12 years ago
commit 81b73a9639

@ -2,11 +2,11 @@
Easily interact with tmux from vim.
![vimux](https://www.braintreepayments.com/assets-faccd47687/assets/images/blog/vimux3.png)
![vimux](https://www.braintreepayments.com/assets-faccd47687/assets/images/blog/vimux3.png)
What inspired me to write vimux was [tslime.vim](https://github.com/kikijump/tslime.vim), a plugin that lets you send input to tmux. While tslime.vim works well, I felt it wasn't optimized for my primary use case which was having a smaller tmux pane that I would use to run tests or play with a REPL.
What inspired me to write vimux was [tslime.vim](https://github.com/kikijump/tslime.vim), a plugin that lets you send input to tmux. While tslime.vim works well, I felt it wasn't optimized for my primary use case which was having a smaller tmux pane that I would use to run tests or play with a REPL.
My goal with vimux is to make interacting with tmux from vim effortless. By default when you call `RunVimTmuxCommand` vimux will create a 20% tall horizontal pane under your current tmux pane and execute a command in it without losing focus of vim. Once that pane exists whenever you call `RunVimTmuxCommand` again the command will be executed in that pane. As I was using vimux myself I wanted to rerun commands over and over. An example of this was running the current file through rspec. Rather than typing that over and over I wrote `RunLastVimTmuxCommand` that will execute the last command you called with `RunVimTmuxCommand`.
My goal with vimux is to make interacting with tmux from vim effortless. By default when you call `RunVimTmuxCommand` vimux will create a 20% tall horizontal pane under your current tmux pane and execute a command in it without losing focus of vim. Once that pane exists whenever you call `RunVimTmuxCommand` again the command will be executed in that pane. As I was using vimux myself I wanted to rerun commands over and over. An example of this was running the current file through rspec. Rather than typing that over and over I wrote `RunLastVimTmuxCommand` that will execute the last command you called with `RunVimTmuxCommand`.
Other auxiliary functions and the ones I talked about above can be found bellow with a full description and example key binds for your vimrc.

@ -14,6 +14,8 @@ command VimuxCloseRunner :call VimuxCloseRunner()
command VimuxClosePanes :call VimuxClosePanes()
command VimuxCloseWindows :call VimuxCloseWindows()
command VimuxInspectRunner :call VimuxInspectRunner()
command VimuxScrollUpInspect :call VimuxScrollUpInspect()
command VimuxScrollDownInspect :call VimuxScrollDownInspect()
command VimuxInterruptRunner :call VimuxInterruptRunner()
command VimuxPromptCommand :call VimuxPromptCommand()
command VimuxClearRunnerHistory :call VimuxClearRunnerHistory()
@ -127,6 +129,13 @@ function InterruptVimTmuxRunner()
call VimuxInterruptRunner()
endfunction
function VimuxScrollDownInspect()
ruby CurrentTmuxSession.new.inspect_scroll_down
endfunction
function VimuxScrollUpInspect()
ruby CurrentTmuxSession.new.inspect_scroll_up
endfunction
function VimuxInspectRunner()
ruby CurrentTmuxSession.new.inspect_runner
@ -209,6 +218,23 @@ class TmuxSession
def inspect_runner
_run("select-pane -t #{target(:pane => runner_pane)}")
_run("copy-mode")
_move_up_pane
end
def inspect_send_command(cmd)
t = target(:pane => runner_pane)
_run("select-pane -t #{t}")
_run("copy-mode")
_send_command(cmd, t, false)
_move_up_pane
end
def inspect_scroll_up
inspect_send_command("C-u")
end
def inspect_scroll_down
inspect_send_command("C-d")
end
def current_panes

Loading…
Cancel
Save