Normalize command and function names to match docs
This commit is contained in:
parent
bd04034a14
commit
562bbf1435
52
README.mkd
52
README.mkd
@ -1,19 +1,46 @@
|
|||||||
# Vim Tmux Runner
|
# VTR [Vim Tmux Runner]
|
||||||
|
|
||||||
A simple, vimscript only, command runner for sending commands from vim to tmux
|
A simple, vimscript only, command runner for sending commands from vim to tmux
|
||||||
|
|
||||||
## Commands
|
## Usage
|
||||||
|
|
||||||
This plugin exposes a command to open a small command runner window in a tmux
|
VTR provides a handful of commands for managing and interacting with [tmux][],
|
||||||
pane, then send commands to it.
|
the terminal multiplexer. The main command is:
|
||||||
|
|
||||||
- Open runner window
|
``` vim
|
||||||
- Automatic cd to project root (via git cdup)
|
VtrSendCommandToRunner
|
||||||
- Send command (with escaping, auto-enter, auto-pre-clear)
|
```
|
||||||
- Enter tmux-copy mode in pane
|
|
||||||
- Maximize the runner pane
|
|
||||||
|
|
||||||
Full documentation can be found [here][].
|
This command will prompt for a command to run, then send it to the runner pane
|
||||||
|
for execution. If one doesn't currently exist, a new runner pane will be
|
||||||
|
created. Subsequent calls to `VtrSendCommandToRunner` will reuse the provided
|
||||||
|
command.
|
||||||
|
|
||||||
|
VTR provides configuration options that allow for control over the size and
|
||||||
|
location of the VTR runner pane. In addition, VTR provides commands to resize,
|
||||||
|
reorient, and even detach the runner pane making the interaction as painless as
|
||||||
|
possible.
|
||||||
|
|
||||||
|
For a complete summary of the available commands and configuration options in
|
||||||
|
VTR, check [the included doc file][].
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The easiest way to install VTR is to add the git repo as a bundle, then use
|
||||||
|
[Pathogen][], [Vundle][] or similar plugin management option to add it to Vim's
|
||||||
|
runtime path.
|
||||||
|
|
||||||
|
``` shell
|
||||||
|
cd ~/.vim
|
||||||
|
mkdir bundles # only
|
||||||
|
cd bundles
|
||||||
|
git clone https://github.com/christoomey/vim-tmux-runner.git
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development Status
|
||||||
|
|
||||||
|
This plugin is currently very much an alpha. Although the major features are
|
||||||
|
implemented, the API is subject to change any time up until v1.0.
|
||||||
|
|
||||||
## Inspiration
|
## Inspiration
|
||||||
|
|
||||||
@ -22,4 +49,7 @@ plugin aims to implement a similar feature set while not requiring Vim with
|
|||||||
ruby requirement. In addition a few new commands not found in Vimux have been
|
ruby requirement. In addition a few new commands not found in Vimux have been
|
||||||
added to provide additional control over the tmux runner pane.
|
added to provide additional control over the tmux runner pane.
|
||||||
|
|
||||||
[here]: https://github.com/christoomey/vim-tmux-runner/blob/master/doc/vim-tmux-runner.txt
|
[the included doc file]: https://github.com/christoomey/vim-tmux-runner/blob/master/doc/vim-tmux-runner.txt
|
||||||
|
[Pathogen]: https://github.com/tpope/vim-pathogen
|
||||||
|
[Vundle]: https://github.com/gmarik/vundle
|
||||||
|
[tmux]: http://tmux.sourceforge.net/
|
||||||
|
@ -11,21 +11,6 @@ function! s:InitVariable(var, value)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:InitializeVariables()
|
|
||||||
call s:InitVariable("g:VtrPercentage", 20)
|
|
||||||
call s:InitVariable("g:VtrOrientation", "v")
|
|
||||||
call s:InitVariable("g:VtrInitialCommand", "")
|
|
||||||
call s:InitVariable("g:VtrClearBeforeSend", 1)
|
|
||||||
call s:InitVariable("g:VtrGitCdUpOnOpen", 1)
|
|
||||||
call s:InitVariable("g:VtrPrompt", "Command to run: ")
|
|
||||||
call s:InitVariable("g:VtrUseVtrMaps", 1)
|
|
||||||
call s:InitVariable("g:VtrClearOnResize", 1)
|
|
||||||
call s:InitVariable("g:VtrClearOnReorient", 1)
|
|
||||||
call s:InitVariable("g:VtrClearOnReattach", 1)
|
|
||||||
call s:InitVariable("g:VtrDetachedName", "VTR_Pane")
|
|
||||||
call s:InitVariable("g:VtrClearSequence", "")
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:OpenRunnerPane()
|
function! s:OpenRunnerPane()
|
||||||
let s:vim_pane = s:ActiveTmuxPaneNumber()
|
let s:vim_pane = s:ActiveTmuxPaneNumber()
|
||||||
let cmd = join(["split-window -p", g:VtrPercentage, "-".g:VtrOrientation])
|
let cmd = join(["split-window -p", g:VtrPercentage, "-".g:VtrOrientation])
|
||||||
@ -261,44 +246,16 @@ function! s:FlushCommand()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SendCommandToRunner()
|
function! s:SendCommandToRunner()
|
||||||
call s:EnsureRunnerPane()
|
|
||||||
if !exists("s:user_command")
|
if !exists("s:user_command")
|
||||||
let s:user_command = s:HighlightedPrompt(g:VtrPrompt)
|
let s:user_command = s:HighlightedPrompt(g:VtrPrompt)
|
||||||
endif
|
endif
|
||||||
|
call s:EnsureRunnerPane()
|
||||||
if g:VtrClearBeforeSend
|
if g:VtrClearBeforeSend
|
||||||
call s:SendClearSequence()
|
call s:SendClearSequence()
|
||||||
endif
|
endif
|
||||||
call s:SendKeys(s:user_command)
|
call s:SendKeys(s:user_command)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:DefineCommands()
|
|
||||||
command! VTROpenRunner :call s:EnsureRunnerPane()
|
|
||||||
command! VTRKillRunner :call s:KillRunnerPane()
|
|
||||||
command! VTRFocusRunnerPane :call s:FocusRunnerPane()
|
|
||||||
command! VTRSendCommandToRunner :call s:SendCommandToRunner()
|
|
||||||
command! VTRReorientRunner :call s:ReorientRunner()
|
|
||||||
command! VTRResizePane :call s:ResizeRunnerPane()
|
|
||||||
command! VTRDetachPane :call s:DetachRunnerPane()
|
|
||||||
command! VTRReattachPane :call s:ReattachPane()
|
|
||||||
command! VTRClearRunner :call s:SendClearSequence()
|
|
||||||
command! VTRFlushCommand :call s:FlushCommand()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:DefineKeymaps()
|
|
||||||
if g:VtrUseVtrMaps
|
|
||||||
nmap ,rr :VTRResizePane<cr>
|
|
||||||
nmap ,ror :VTRReorientRunner<cr>
|
|
||||||
nmap ,sc :VTRSendCommandToRunner<cr>
|
|
||||||
nmap ,or :VTROpenRunner<cr>
|
|
||||||
nmap ,kr :VTRKillRunner<cr>
|
|
||||||
nmap ,fr :VTRFocusRunnerPane<cr>
|
|
||||||
nmap ,dr :VTRDetachPane<cr>
|
|
||||||
nmap ,ar :VTRReattachPane<cr>
|
|
||||||
nmap ,cr :VTRClearRunner<cr>
|
|
||||||
nmap ,fc :VTRFlushCommand<cr>
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:EnsureRunnerPane()
|
function! s:EnsureRunnerPane()
|
||||||
if exists('s:detached_window')
|
if exists('s:detached_window')
|
||||||
call s:ReattachPane()
|
call s:ReattachPane()
|
||||||
@ -309,12 +266,56 @@ function! s:EnsureRunnerPane()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! VTRSendCommand(command)
|
function! VtrSendCommand(command)
|
||||||
call s:EnsureRunnerPane()
|
call s:EnsureRunnerPane()
|
||||||
let escaped_command = shellescape(a:command)
|
let escaped_command = shellescape(a:command)
|
||||||
call s:SendKeys(escaped_command)
|
call s:SendKeys(escaped_command)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:DefineCommands()
|
||||||
|
command! VtrSendCommandToRunner :call s:SendCommandToRunner()
|
||||||
|
command! VtrOpenRunner :call s:EnsureRunnerPane()
|
||||||
|
command! VtrKillRunner :call s:KillRunnerPane()
|
||||||
|
command! VtrFocusRunner :call s:FocusRunnerPane()
|
||||||
|
command! VtrResizeRunner :call s:ResizeRunnerPane()
|
||||||
|
command! VtrReorientRunner :call s:ReorientRunner()
|
||||||
|
command! VtrDetachRunner :call s:DetachRunnerPane()
|
||||||
|
command! VtrReattachRunner :call s:ReattachPane()
|
||||||
|
command! VtrClearRunner :call s:SendClearSequence()
|
||||||
|
command! VtrFlushCommand :call s:FlushCommand()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:DefineKeymaps()
|
||||||
|
if g:VtrUseVtrMaps
|
||||||
|
nmap ,rr :VtrResizeRunner<cr>
|
||||||
|
nmap ,ror :VtrReorientRunner<cr>
|
||||||
|
nmap ,sc :VtrSendCommandToRunner<cr>
|
||||||
|
nmap ,or :VtrOpenRunner<cr>
|
||||||
|
nmap ,kr :VtrKillRunner<cr>
|
||||||
|
nmap ,fr :VtrFocusRunner<cr>
|
||||||
|
nmap ,dr :VtrDetachRunner<cr>
|
||||||
|
nmap ,ar :VtrReattachRunner<cr>
|
||||||
|
nmap ,cr :VtrClearRunner<cr>
|
||||||
|
nmap ,fc :VtrFlushCommand<cr>
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:InitializeVariables()
|
||||||
|
call s:InitVariable("g:VtrPercentage", 20)
|
||||||
|
call s:InitVariable("g:VtrOrientation", "v")
|
||||||
|
call s:InitVariable("g:VtrInitialCommand", "")
|
||||||
|
call s:InitVariable("g:VtrGitCdUpOnOpen", 0)
|
||||||
|
call s:InitVariable("g:VtrClearBeforeSend", 1)
|
||||||
|
call s:InitVariable("g:VtrPrompt", "Command to run: ")
|
||||||
|
call s:InitVariable("g:VtrUseVtrMaps", 0)
|
||||||
|
call s:InitVariable("g:VtrClearOnResize", 1)
|
||||||
|
call s:InitVariable("g:VtrClearOnReorient", 1)
|
||||||
|
call s:InitVariable("g:VtrClearOnReattach", 1)
|
||||||
|
call s:InitVariable("g:VtrDetachedName", "VTR_Pane")
|
||||||
|
call s:InitVariable("g:VtrClearSequence", "")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
call s:InitializeVariables()
|
call s:InitializeVariables()
|
||||||
call s:DefineCommands()
|
call s:DefineCommands()
|
||||||
call s:DefineKeymaps()
|
call s:DefineKeymaps()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user