mirror of
https://github.com/preservim/vimux
synced 2024-11-12 01:11:10 +00:00
Add InspectVimTmuxRunner command and PromptVimTmuxCommand
This commit is contained in:
parent
655727d750
commit
1170fbe39d
24
README.mkd
24
README.mkd
@ -17,7 +17,17 @@ Run a system command in a small horizontal split bellow the current pane vim is
|
||||
|
||||
```viml
|
||||
" Run the current file with rspec
|
||||
map <Leader>rb :call RunVimTmuxCommand("clear %% rspec " . bufname("%"))<CR>
|
||||
map <Leader>rb :call RunVimTmuxCommand("clear && rspec " . bufname("%"))<CR>
|
||||
```
|
||||
|
||||
### PromptVimTmuxCommand
|
||||
Prompt for a command and run it in a small horizontal split bellow the current pane.
|
||||
|
||||
*Example:*
|
||||
|
||||
```viml
|
||||
" Prompt for a command to run
|
||||
map <Leader>rp :PromptVimTmuxCommand<CR>
|
||||
```
|
||||
|
||||
### RunLastVimTmuxCommand
|
||||
@ -30,6 +40,16 @@ Run the last command executed by `RunVimTmuxCommand`
|
||||
map <Leader>rl :call RunLastVimTmuxCommand<CR>
|
||||
```
|
||||
|
||||
### InspectVimTmuxRunner
|
||||
Move into the tmux runner pane created by `RunVimTmuxCommand` and enter copy mode (scroll mode).
|
||||
|
||||
*Example:*
|
||||
|
||||
```viml
|
||||
" Inspect runner pane
|
||||
map <Leader>ri :InspectVimTmuxRunner<CR>
|
||||
```
|
||||
|
||||
### CloseVimTmuxWindows
|
||||
Close all other tmux panes in the current window.
|
||||
|
||||
@ -54,4 +74,4 @@ let VimuxHeight = "50"
|
||||
|
||||
The features I would like to add in the near future.
|
||||
|
||||
* Add the ability to target any tmux session, window and pane
|
||||
* Add the ability to target any tmux session, window and pane
|
||||
|
@ -4,6 +4,8 @@ end
|
||||
|
||||
command RunLastVimTmuxCommand :call RunLastVimTmuxCommand()
|
||||
command CloseVimTmuxWindows :call CloseVimTmuxWindows()
|
||||
command InspectVimTmuxRunner :call InspectVimTmuxRunner()
|
||||
command PromptVimTmuxCommand :call PromptVimTmuxCommand()
|
||||
|
||||
function! RunVimTmuxCommand(command)
|
||||
let g:_VimTmuxCmd = a:command
|
||||
@ -29,6 +31,15 @@ function! CloseVimTmuxWindows()
|
||||
call ClearVimTmuxWindow()
|
||||
endfunction
|
||||
|
||||
function! InspectVimTmuxRunner()
|
||||
ruby CurrentTmuxSession.new.inspect_runner
|
||||
endfunction
|
||||
|
||||
function! PromptVimTmuxCommand()
|
||||
let l:command = input("Command? ")
|
||||
call RunVimTmuxCommand(l:command)
|
||||
endfunction
|
||||
|
||||
ruby << EOF
|
||||
class TmuxSession
|
||||
def initialize(session, window, pane)
|
||||
@ -62,6 +73,11 @@ class TmuxSession
|
||||
end
|
||||
end
|
||||
|
||||
def inspect_runner
|
||||
run("select-pane -t #{target(:pane => runner_pane)}")
|
||||
run("copy-mode")
|
||||
end
|
||||
|
||||
def current_panes
|
||||
run('list-panes').split("\n").map do |line|
|
||||
line.split(':').first
|
||||
|
Loading…
Reference in New Issue
Block a user