├── .gitignore ├── License.md ├── README.md ├── plugin └── vim-tmux-runner.vim └── doc └── vim-tmux-runner.txt /.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Chris Toomey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | VTR [Vim Tmux Runner] 2 | ===================== 3 | 4 | A simple, vimscript only, command runner for sending commands from vim to tmux. 5 | 6 | Usage 7 | ----- 8 | 9 | VTR provides a handful of commands for managing and interacting with [tmux][], 10 | the terminal multiplexer. The main command is: 11 | 12 | ``` vim 13 | VtrSendCommandToRunner 14 | ``` 15 | 16 | This command will prompt for a command to run, then send it to the runner pane 17 | for execution. Subsequent calls to `VtrSendCommandToRunner` will reuse the 18 | provided command. 19 | 20 | If you would like VTR to create a runner pane if one doesn't exist while issuing 21 | a command, a bang version can be used: `VtrSendCommandToRunner!`. 22 | 23 | VTR provides configuration options that allow for control over the size and 24 | location of the VTR runner pane. In addition, VTR provides commands to resize, 25 | reorient, and even detach the runner pane making the interaction as painless as 26 | possible. 27 | 28 | For a complete summary of the available commands and configuration options in 29 | VTR, check [the included doc file][]. 30 | 31 | You can watch a [short demo][] by [Jack Franklin][] recorded at [Vim London][]. 32 | 33 | Installation 34 | ------------ 35 | 36 | If you don't have a preferred installation method, I recommend using 37 | [vim-plug][]: 38 | 39 | ```vim 40 | Plug 'christoomey/vim-tmux-runner' 41 | ``` 42 | 43 | *Note* - you'll need to have a relatively recent (2.0+) version of Tmux to use 44 | this plugin. 45 | 46 | [vim-plug]: https://github.com/junegunn/vim-plug 47 | 48 | Python Notes 49 | ------------ 50 | 51 | If you are using python, or any other language with syntactic whitespace, you 52 | will likely want to change the following settings to better support the 53 | required whitespace: 54 | 55 | ``` vim 56 | let g:VtrStripLeadingWhitespace = 0 57 | let g:VtrClearEmptyLines = 0 58 | let g:VtrAppendNewline = 1 59 | ``` 60 | 61 | Additionally, if you are using ipython, you will need to ensure it is 62 | installed with proper readline support. Ref [this Stack Overflow thread][] and 63 | answer for more detail. 64 | 65 | You will also need to start ipython with auto-indentation disabled, which can 66 | be done with the following `ipython --no-autoindent`. 67 | 68 | [this Stack Overflow thread]: http://stackoverflow.com/a/1840304/2751777 69 | 70 | Inspiration 71 | ----------- 72 | 73 | This plugin is heavily inspired by the functionality in the [Vimux][] plugin. 74 | This plugin aims to implement a similar feature set while not requiring Vim 75 | with ruby requirement. In addition a few new commands not found in Vimux have 76 | been added to provide additional control over the tmux runner pane. 77 | 78 | [the included doc file]: https://github.com/christoomey/vim-tmux-runner/blob/master/doc/vim-tmux-runner.txt 79 | [Pathogen]: https://github.com/tpope/vim-pathogen 80 | [Vundle]: https://github.com/gmarik/vundle 81 | [tmux]: http://tmux.sourceforge.net/ 82 | [Vimux]: https://github.com/benmills/vimux 83 | [short demo]: https://vimeo.com/126420226 84 | [Jack Franklin]: https://github.com/jackfranklin 85 | [Vim London]: http://www.meetup.com/Vim-London/ 86 | -------------------------------------------------------------------------------- /plugin/vim-tmux-runner.vim: -------------------------------------------------------------------------------- 1 | function! s:InitVariable(var, value) 2 | if !exists(a:var) 3 | let escaped_value = substitute(a:value, "'", "''", "g") 4 | exec 'let ' . a:var . ' = ' . "'" . escaped_value . "'" 5 | return 1 6 | endif 7 | return 0 8 | endfunction 9 | 10 | function! s:DictFetch(dict, key, default) 11 | if has_key(a:dict, a:key) 12 | return a:dict[a:key] 13 | else 14 | return a:default 15 | endif 16 | endfunction 17 | 18 | function! s:CreateRunnerPane(...) 19 | if exists("a:1") 20 | let s:vtr_orientation = s:DictFetch(a:1, 'orientation', s:vtr_orientation) 21 | let s:vtr_percentage = s:DictFetch(a:1, 'percentage', s:vtr_percentage) 22 | let g:VtrInitialCommand = s:DictFetch(a:1, 'cmd', g:VtrInitialCommand) 23 | endif 24 | let s:vim_pane = s:ActivePaneIndex() 25 | let cmd = join(["split-window -p", s:vtr_percentage, "-".s:vtr_orientation]) 26 | call s:SendTmuxCommand(cmd) 27 | call s:SendTmuxCommand('select-pane -T '.g:VtrCreatedRunnerPaneName) 28 | let s:runner_pane = s:ActivePaneIndex() 29 | call s:FocusVimPane() 30 | if g:VtrGitCdUpOnOpen 31 | call s:GitCdUp() 32 | endif 33 | if g:VtrInitialCommand != "" 34 | call s:SendKeys(g:VtrInitialCommand) 35 | endif 36 | endfunction 37 | 38 | function! s:DetachRunnerPane() 39 | if !s:ValidRunnerPaneSet() | return | endif 40 | call s:BreakRunnerPaneToTempWindow() 41 | let cmd = join(["rename-window -t", s:detached_window, g:VtrDetachedName]) 42 | call s:SendTmuxCommand(cmd) 43 | endfunction 44 | 45 | function! s:ValidRunnerPaneSet() 46 | if !exists("s:runner_pane") 47 | call s:EchoError("No runner pane attached.") 48 | return 0 49 | endif 50 | if !s:ValidRunnerPaneNumber(s:runner_pane) 51 | call s:EchoError("Runner pane setting (" . s:runner_pane . ") is invalid. Please reattach or run VtrUnsetRunnerPane.") 52 | return 0 53 | endif 54 | return 1 55 | endfunction 56 | 57 | function! s:DetachedWindowOutOfSync() 58 | let window_map = s:WindowMap() 59 | if index(keys(window_map), s:detached_window) == -1 60 | return 1 61 | endif 62 | if s:WindowMap()[s:detached_window] != g:VtrDetachedName 63 | return 1 64 | endif 65 | return 0 66 | endfunction 67 | 68 | function! s:DetachedPaneAvailable() 69 | if exists("s:detached_window") 70 | if s:DetachedWindowOutOfSync() 71 | call s:EchoError("Detached pane out of sync. Unable to kill") 72 | unlet s:detached_window 73 | return 0 74 | endif 75 | else 76 | call s:EchoError("No detached runner pane.") 77 | return 0 78 | endif 79 | return 1 80 | endfunction 81 | 82 | function! s:RequireLocalPaneOrDetached() 83 | if !exists('s:detached_window') && !exists('s:runner_pane') 84 | call s:EchoError("No pane, local or detached.") 85 | return 0 86 | endif 87 | return 1 88 | endfunction 89 | 90 | function! s:KillLocalRunner() 91 | if s:ValidRunnerPaneSet() 92 | let targeted_cmd = s:TargetedTmuxCommand("kill-pane", s:runner_pane) 93 | call s:SendTmuxCommand(targeted_cmd) 94 | call s:UnsetRunnerPane() 95 | endif 96 | endfunction 97 | 98 | function! s:UnsetRunnerPane() 99 | if exists("s:runner_pane") 100 | unlet s:runner_pane 101 | endif 102 | endfunction 103 | 104 | function! s:WindowMap() 105 | let window_pattern = '\v(\d+): ([-_a-zA-Z]{-})[-\* ]\s.*' 106 | let window_map = {} 107 | for line in split(s:SendTmuxCommand("list-windows"), "\n") 108 | let dem = split(substitute(line, window_pattern, '\1:\2', ""), ':') 109 | let window_map[dem[0]] = dem[1] 110 | endfor 111 | return window_map 112 | endfunction 113 | 114 | function! s:KillDetachedWindow() 115 | if !s:DetachedPaneAvailable() | return | endif 116 | let cmd = join(["kill-window", '-t', s:detached_window]) 117 | call s:SendTmuxCommand(cmd) 118 | unlet s:detached_window 119 | endfunction 120 | 121 | function! s:KillRunnerPane() 122 | if !s:RequireLocalPaneOrDetached() | return | endif 123 | if exists("s:runner_pane") 124 | call s:KillLocalRunner() 125 | else 126 | call s:KillDetachedWindow() 127 | endif 128 | endfunction 129 | 130 | function! s:ActivePaneIndex() 131 | return str2nr(s:SendTmuxCommand("display-message -p \"#{pane_index}\"")) 132 | endfunction 133 | 134 | function! s:TmuxPanes() 135 | let panes = s:SendTmuxCommand("list-panes") 136 | return split(panes, '\n') 137 | endfunction 138 | 139 | " builds a returns of map of { : } 140 | " note: if two panes have the same name there will only be 141 | " one entry for the last pane with that id returned by 142 | " list-panes 143 | function! s:TmuxPanesByName() 144 | let panes = s:SendTmuxCommand("list-panes -F 'name:#T,id:#P'") 145 | let lines = split(panes, '\n') 146 | let result = {} 147 | for line in lines 148 | let matches = matchlist(line, '\vname:(.*),id:(.*)') 149 | if len(matches) >= 3 150 | let name = matches[1] 151 | let id = matches[2] 152 | let result[name] = id 153 | endif 154 | endfor 155 | 156 | return result 157 | endfunction 158 | 159 | function! s:FocusTmuxPane(pane_number) 160 | let targeted_cmd = s:TargetedTmuxCommand("select-pane", a:pane_number) 161 | call s:SendTmuxCommand(targeted_cmd) 162 | endfunction 163 | 164 | function! s:RunnerPaneDimensions() 165 | let panes = s:TmuxPanes() 166 | for pane in panes 167 | if pane =~ '^'.s:runner_pane 168 | let pattern = s:runner_pane.': [\(\d\+\)x\(\d\+\)\]' 169 | let pane_info = matchlist(pane, pattern) 170 | return {'width': pane_info[1], 'height': pane_info[2]} 171 | endif 172 | endfor 173 | endfunction 174 | 175 | function! s:FocusRunnerPane(should_zoom) 176 | if !s:ValidRunnerPaneSet() | return | endif 177 | call s:FocusTmuxPane(s:runner_pane) 178 | if a:should_zoom 179 | call s:SendTmuxCommand("resize-pane -Z") 180 | endif 181 | endfunction 182 | 183 | function! s:Strip(string) 184 | return substitute(a:string, '^\s*\(.\{-}\)\s*\n\?$', '\1', '') 185 | endfunction 186 | 187 | function! s:SendTmuxCommand(command) 188 | let prefixed_command = "tmux " . a:command 189 | return s:Strip(system(prefixed_command)) 190 | endfunction 191 | 192 | function! s:TargetedTmuxCommand(command, target_pane) 193 | return a:command . " -t " . a:target_pane 194 | endfunction 195 | 196 | function! s:_SendKeys(keys) 197 | let targeted_cmd = s:TargetedTmuxCommand("send-keys", s:runner_pane) 198 | let full_command = join([targeted_cmd, a:keys]) 199 | call s:SendTmuxCommand(full_command) 200 | endfunction 201 | 202 | function! s:SendKeys(keys) 203 | let cmd = g:VtrClearBeforeSend ? g:VtrClearSequence.a:keys : a:keys 204 | call s:_SendKeys(cmd) 205 | call s:SendEnterSequence() 206 | endfunction 207 | 208 | function! s:SendKeysRaw(keys) 209 | if !s:ValidRunnerPaneSet() | return | endif 210 | call s:_SendKeys(a:keys) 211 | endfunction 212 | 213 | function! s:SendCtrlD() 214 | call s:SendKeysRaw('') 215 | endfunction 216 | 217 | function! s:SendCtrlC() 218 | call s:SendKeysRaw('') 219 | endfunction 220 | 221 | function! s:SendEnterSequence() 222 | call s:_SendKeys("Enter") 223 | endfunction 224 | 225 | function! s:SendClearSequence() 226 | if !s:ValidRunnerPaneSet() | return | endif 227 | call s:SendTmuxCopyModeExit() 228 | call s:_SendKeys(g:VtrClearSequence) 229 | endfunction 230 | 231 | function! s:SendQuitSequence() 232 | if !s:ValidRunnerPaneSet() | return | endif 233 | call s:_SendKeys("q") 234 | endfunction 235 | 236 | function! s:GitCdUp() 237 | let git_repo_check = "git rev-parse --git-dir > /dev/null 2>&1" 238 | let cdup_cmd = "cd './'$(git rev-parse --show-cdup)" 239 | let cmd = shellescape(join([git_repo_check, '&&', cdup_cmd])) 240 | call s:SendTmuxCopyModeExit() 241 | call s:SendKeys(cmd) 242 | call s:SendClearSequence() 243 | endfunction 244 | 245 | function! s:FocusVimPane() 246 | call s:FocusTmuxPane(s:vim_pane) 247 | endfunction 248 | 249 | function! s:LastWindowNumber() 250 | return split(s:SendTmuxCommand("list-windows"), '\n')[-1][0] 251 | endfunction 252 | 253 | function! s:ToggleOrientationVariable() 254 | let s:vtr_orientation = (s:vtr_orientation == "v" ? "h" : "v") 255 | endfunction 256 | 257 | function! s:BreakRunnerPaneToTempWindow() 258 | let targeted_cmd = s:TargetedTmuxCommand("break-pane", s:runner_pane) 259 | let full_command = join([targeted_cmd, "-d"]) 260 | call s:SendTmuxCommand(full_command) 261 | let s:detached_window = s:LastWindowNumber() 262 | let s:vim_pane = s:ActivePaneIndex() 263 | call s:UnsetRunnerPane() 264 | endfunction 265 | 266 | function! s:RunnerDimensionSpec() 267 | let dimensions = join(["-p", s:vtr_percentage, "-".s:vtr_orientation]) 268 | return dimensions 269 | endfunction 270 | 271 | function! s:TmuxInfo(message) 272 | " TODO: this should accept optional target pane, default to current. 273 | " Pass that to TargetedCommand as "display-message", "-p '#{...}') 274 | return s:SendTmuxCommand("display-message -p '#{" . a:message . "}'") 275 | endfunction 276 | 277 | function! s:PaneCount() 278 | return str2nr(s:TmuxInfo('window_panes')) 279 | endfunction 280 | 281 | function! s:PaneIndices() 282 | let index_slicer = 'str2nr(substitute(v:val, "\\v(\\d+):.*", "\\1", ""))' 283 | return map(s:TmuxPanes(), index_slicer) 284 | endfunction 285 | 286 | function! s:PaneNumberForName(name) 287 | let mapped = s:TmuxPanesByName() 288 | if has_key(mapped, a:name) 289 | return mapped[a:name] 290 | endif 291 | return -1 292 | endfunction 293 | 294 | function! s:AvailableRunnerPaneIndices() 295 | return filter(s:PaneIndices(), "v:val != " . s:ActivePaneIndex()) 296 | endfunction 297 | 298 | function! s:AltPane() 299 | if s:PaneCount() == 2 300 | return s:AvailableRunnerPaneIndices()[0] 301 | else 302 | echoerr "AltPane only valid if two panes open" 303 | endif 304 | endfunction 305 | 306 | function! s:AttachToPane(...) 307 | if exists("a:1") && a:1 != "" 308 | call s:AttachToSpecifiedPane(a:1, 1) 309 | elseif s:PaneCount() == 2 310 | call s:AttachToSpecifiedPane(s:AltPane(), 1) 311 | else 312 | call s:PromptForPaneToAttach() 313 | endif 314 | endfunction 315 | 316 | function! s:PromptForPaneToAttach() 317 | if g:VtrDisplayPaneNumbers 318 | call s:SendTmuxCommand('source ~/.tmux.conf && tmux display-panes') 319 | endif 320 | echohl String | let desired_pane = input('Pane #: ') | echohl None 321 | if desired_pane != '' 322 | call s:AttachToSpecifiedPane(desired_pane, 1) 323 | else 324 | call s:EchoError("No pane specified. Cancelling.") 325 | endif 326 | endfunction 327 | 328 | function! s:CurrentMajorOrientation() 329 | let orientation_map = { '[': 'v', '{': 'h' } 330 | let layout = s:TmuxInfo('window_layout') 331 | let outermost_orientation = substitute(layout, '[^[{]', '', 'g')[0] 332 | return orientation_map[outermost_orientation] 333 | endfunction 334 | 335 | function! s:AttachToSpecifiedPane(desired_pane, should_notify) 336 | let desired_pane = str2nr(a:desired_pane) 337 | if s:ValidRunnerPaneNumber(desired_pane) 338 | let s:runner_pane = desired_pane 339 | let s:vim_pane = s:ActivePaneIndex() 340 | let s:vtr_orientation = s:CurrentMajorOrientation() 341 | if a:should_notify 342 | echohl String | echo "\rRunner pane set to: " . desired_pane | echohl None 343 | endif 344 | else 345 | call s:EchoError("Invalid pane number: " . desired_pane) 346 | endif 347 | endfunction 348 | 349 | function! s:EchoError(message) 350 | echohl ErrorMsg | echo "\rVTR: ". a:message | echohl None 351 | endfunction 352 | 353 | function! s:DesiredPaneExists(desired_pane) 354 | return count(s:PaneIndices(), a:desired_pane) == 0 355 | endfunction 356 | 357 | function! s:ValidRunnerPaneNumber(desired_pane) 358 | if a:desired_pane == s:ActivePaneIndex() | return 0 | endif 359 | if s:DesiredPaneExists(a:desired_pane) | return 0 | endif 360 | return 1 361 | endfunction 362 | 363 | function! s:ReattachPane() 364 | if !s:DetachedPaneAvailable() | return | endif 365 | let s:vim_pane = s:ActivePaneIndex() 366 | call s:_ReattachPane() 367 | call s:FocusVimPane() 368 | if g:VtrClearOnReattach 369 | call s:SendClearSequence() 370 | endif 371 | endfunction 372 | 373 | function! s:_ReattachPane() 374 | let join_cmd = join(["join-pane", "-s", ":".s:detached_window.".0", 375 | \ s:RunnerDimensionSpec()]) 376 | call s:SendTmuxCommand(join_cmd) 377 | unlet s:detached_window 378 | let s:runner_pane = s:ActivePaneIndex() 379 | endfunction 380 | 381 | function! s:ReorientRunner() 382 | if !s:ValidRunnerPaneSet() | return | endif 383 | call s:BreakRunnerPaneToTempWindow() 384 | call s:ToggleOrientationVariable() 385 | call s:_ReattachPane() 386 | call s:FocusVimPane() 387 | if g:VtrClearOnReorient 388 | call s:SendClearSequence() 389 | endif 390 | endfunction 391 | 392 | function! s:HighlightedPrompt(prompt) 393 | echohl String | let input = shellescape(input(a:prompt)) | echohl None 394 | return input 395 | endfunction 396 | 397 | function! s:FlushCommand() 398 | if exists("s:user_command") 399 | unlet s:user_command 400 | endif 401 | endfunction 402 | 403 | function! s:SendTmuxCopyModeExit() 404 | let l:session = s:TmuxInfo('session_name') 405 | let l:win = s:TmuxInfo('window_index') 406 | let target_cmd = join([l:session.':'.l:win.".".s:runner_pane]) 407 | if s:SendTmuxCommand("display-message -p -F '#{pane_in_mode}' -t " . l:target_cmd) 408 | call s:SendQuitSequence() 409 | endif 410 | endfunction 411 | 412 | function! s:SendCommandToRunner(ensure_pane, ...) 413 | if a:ensure_pane | call s:EnsureRunnerPane() | endif 414 | if !s:ValidRunnerPaneSet() | return | endif 415 | if exists("a:1") && a:1 != "" 416 | let s:user_command = shellescape(a:1) 417 | endif 418 | if !exists("s:user_command") 419 | let s:user_command = s:HighlightedPrompt(g:VtrPrompt) 420 | endif 421 | let escaped_empty_string = "''" 422 | if s:user_command == escaped_empty_string 423 | unlet s:user_command 424 | call s:EchoError("command string required") 425 | return 426 | endif 427 | call s:SendTmuxCopyModeExit() 428 | if g:VtrClearBeforeSend 429 | call s:SendClearSequence() 430 | endif 431 | call s:SendKeys(s:user_command) 432 | endfunction 433 | 434 | function! s:EnsureRunnerPane(...) 435 | if exists('s:detached_window') 436 | call s:ReattachPane() 437 | elseif g:VtrAutomaticReattachByName == 1 438 | let found = s:PaneNumberForName(g:VtrCreatedRunnerPaneName) 439 | if found >= 0 440 | call s:AttachToSpecifiedPane(found, 0) 441 | return 442 | endif 443 | elseif exists('s:runner_pane') 444 | return 445 | endif 446 | 447 | if exists('a:1') 448 | call s:CreateRunnerPane(a:1) 449 | else 450 | call s:CreateRunnerPane() 451 | endif 452 | 453 | endfunction 454 | 455 | function! s:SendLinesToRunner(ensure_pane) range 456 | if a:ensure_pane | call s:EnsureRunnerPane() | endif 457 | if !s:ValidRunnerPaneSet() | return | endif 458 | call s:SendTmuxCopyModeExit() 459 | call s:SendTextToRunner(getline(a:firstline, a:lastline)) 460 | endfunction 461 | 462 | function! s:PrepareLines(lines) 463 | let prepared = a:lines 464 | if g:VtrStripLeadingWhitespace 465 | let prepared = map(a:lines, 'substitute(v:val,"^\\s*","","")') 466 | endif 467 | if g:VtrClearEmptyLines 468 | let prepared = filter(prepared, "!empty(v:val)") 469 | endif 470 | if g:VtrAppendNewline && len(a:lines) > 1 471 | let prepared = add(prepared, "\r") 472 | endif 473 | return prepared 474 | endfunction 475 | 476 | function! s:SendTextToRunner(lines) 477 | if !s:ValidRunnerPaneSet() | return | endif 478 | let prepared = s:PrepareLines(a:lines) 479 | let send_keys_cmd = s:TargetedTmuxCommand("send-keys", s:runner_pane) 480 | for line in prepared 481 | let targeted_cmd = send_keys_cmd . ' ' . shellescape(line . "\r") 482 | call s:SendTmuxCommand(targeted_cmd) 483 | endfor 484 | endfunction 485 | 486 | function! s:SendFileViaVtr(ensure_pane) 487 | let runners = s:CurrentFiletypeRunners() 488 | if has_key(runners, &filetype) 489 | write 490 | let runner = runners[&filetype] 491 | let local_file_path = expand('%') 492 | let run_command = substitute(runner, '{file}', local_file_path, 'g') 493 | call VtrSendCommand(run_command, a:ensure_pane) 494 | else 495 | echoerr 'Unable to determine runner' 496 | endif 497 | endfunction 498 | 499 | function! s:CurrentFiletypeRunners() 500 | let default_runners = { 501 | \ 'elixir': 'elixir {file}', 502 | \ 'javascript': 'node {file}', 503 | \ 'python': 'python {file}', 504 | \ 'ruby': 'ruby {file}', 505 | \ 'sh': 'sh {file}' 506 | \ } 507 | if exists("g:vtr_filetype_runner_overrides") 508 | return extend(copy(default_runners), g:vtr_filetype_runner_overrides) 509 | else 510 | return default_runners 511 | endif 512 | endfunction 513 | 514 | function! VtrSendCommand(command, ...) 515 | let ensure_pane = 0 516 | if exists("a:1") 517 | let ensure_pane = a:1 518 | endif 519 | call s:SendCommandToRunner(ensure_pane, a:command) 520 | endfunction 521 | 522 | function! s:DefineCommands() 523 | command! -bang -nargs=? VtrSendCommandToRunner call s:SendCommandToRunner(0, ) 524 | command! -bang -range VtrSendLinesToRunner ,call s:SendLinesToRunner(0) 525 | command! -bang VtrSendFile call s:SendFileViaVtr(0) 526 | command! -nargs=? VtrOpenRunner call s:EnsureRunnerPane() 527 | command! VtrKillRunner call s:KillRunnerPane() 528 | command! -bang VtrFocusRunner call s:FocusRunnerPane(!0) 529 | command! VtrReorientRunner call s:ReorientRunner() 530 | command! VtrDetachRunner call s:DetachRunnerPane() 531 | command! VtrReattachRunner call s:ReattachPane() 532 | command! VtrClearRunner call s:SendClearSequence() 533 | command! VtrFlushCommand call s:FlushCommand() 534 | command! VtrSendCtrlD call s:SendCtrlD() 535 | command! VtrSendCtrlC call s:SendCtrlC() 536 | command! VtrUnsetRunnerPane call s:UnsetRunnerPane() 537 | command! -bang -nargs=? -bar VtrAttachToPane call s:AttachToPane() 538 | command! -nargs=1 VtrSendKeysRaw call s:SendKeysRaw() 539 | endfunction 540 | 541 | function! s:DefineKeymaps() 542 | if g:VtrUseVtrMaps 543 | nnoremap va :VtrAttachToPane 544 | nnoremap ror :VtrReorientRunner 545 | nnoremap sc :VtrSendCommandToRunner 546 | nnoremap sl :VtrSendLinesToRunner 547 | vnoremap sl :VtrSendLinesToRunner 548 | nnoremap or :VtrOpenRunner 549 | nnoremap kr :VtrKillRunner 550 | nnoremap fr :VtrFocusRunner 551 | nnoremap dr :VtrDetachRunner 552 | nnoremap cr :VtrClearRunner 553 | nnoremap fc :VtrFlushCommand 554 | nnoremap sf :VtrSendFile 555 | endif 556 | endfunction 557 | 558 | function! s:InitializeVariables() 559 | call s:InitVariable("g:VtrPercentage", 20) 560 | call s:InitVariable("g:VtrOrientation", "v") 561 | call s:InitVariable("g:VtrInitialCommand", "") 562 | call s:InitVariable("g:VtrGitCdUpOnOpen", 0) 563 | call s:InitVariable("g:VtrClearBeforeSend", 1) 564 | call s:InitVariable("g:VtrPrompt", "Command to run: ") 565 | call s:InitVariable("g:VtrUseVtrMaps", 0) 566 | call s:InitVariable("g:VtrClearOnReorient", 1) 567 | call s:InitVariable("g:VtrClearOnReattach", 1) 568 | call s:InitVariable("g:VtrDetachedName", "VTR_Detached_Pane") 569 | call s:InitVariable("g:VtrCreatedRunnerPaneName", "VTR_Created_Pane") 570 | call s:InitVariable("g:VtrClearSequence", " ") 571 | call s:InitVariable("g:VtrDisplayPaneNumbers", 1) 572 | call s:InitVariable("g:VtrStripLeadingWhitespace", 1) 573 | call s:InitVariable("g:VtrClearEmptyLines", 1) 574 | call s:InitVariable("g:VtrAppendNewline", 0) 575 | call s:InitVariable("g:VtrAutomaticReattachByName", 0) 576 | let s:vtr_percentage = g:VtrPercentage 577 | let s:vtr_orientation = g:VtrOrientation 578 | endfunction 579 | 580 | call s:InitializeVariables() 581 | call s:DefineCommands() 582 | call s:DefineKeymaps() 583 | 584 | " vim: set fdm=marker 585 | -------------------------------------------------------------------------------- /doc/vim-tmux-runner.txt: -------------------------------------------------------------------------------- 1 | *vim-tmux-runner.txt* For Vim version 7.3 Last change: 2020 May 29 2 | 3 | Vim Tmux Runner 4 | Vim and tmux, sittin' in a tree... 5 | 6 | ============================================================================== 7 | CONTENTS *vtr-contents* 8 | 9 | 1. About............................ |VTR-About| 10 | 2. Usage ........................... |VTR-Usage| 11 | 2.1 ............................... |VtrSendCommandToRunner| 12 | 2.2 ............................... |VtrSendLinesToRunner| 13 | 2.3 ............................... |VtrOpenRunner| 14 | 2.4 ............................... |VtrKillRunner| 15 | 2.5 ............................... |VtrFocusRunner| 16 | 2.6 ............................... |VtrResizeRunner| 17 | 2.7 ............................... |VtrReorientRunner| 18 | 2.8 ............................... |VtrDetachRunner| 19 | 2.9 ............................... |VtrReattachRunner| 20 | 2.10 ............................... |VtrClearRunner| 21 | 2.11 ............................... |VtrFlushCommand| 22 | 2.12 ............................... |VtrSendCtrlD| 23 | 2.13 ............................... |VtrSendCtrlC| 24 | 2.14 ............................... |VtrSendKeysRaw| 25 | 2.15 ............................... |VtrSendFile| 26 | 2.16 ............................... |VtrUnsetRunnerPane| 27 | 3. Configuration ................... |VTR-Configuration| 28 | 3.1 ................................ |VtrPercentage| 29 | 3.2 ................................ |VtrOrientation| 30 | 3.3 ................................ |VtrInitialCommand| 31 | 3.4 ................................ |VtrGitCdUpOnOpen| 32 | 3.5 ................................ |VtrClearBeforeSend| 33 | 3.5 ................................ |VtrPrompt| 34 | 3.6 ................................ |VtrUseVtrMaps| 35 | 3.7 ................................ |VtrClearOnResize| 36 | 3.8 ................................ |VtrClearOnReorient| 37 | 3.9 ................................ |VtrClearOnReattach| 38 | 3.10 ............................... |VtrDetachedName| 39 | 3.11 ............................... |VtrClearSequence| 40 | 3.12 ............................... |VtrStripLeadingWhitespace| 41 | 3.13 ............................... |VtrClearEmptyLines| 42 | 3.14 ............................... |VtrAppendNewline| 43 | 3.15 ............................... |VtrCreatedRunnerPaneName| 44 | 3.16 ............................... |VtrAutomaticReattachByName| 45 | 46 | ============================================================================== 47 | ABOUT (1) *VTR-About* 48 | 49 | VTR -- Straightforward Vim/tmux integration 50 | 51 | This plugin provides Vim with an understanding of tmux. The plugin provides 52 | functionality to open a small tmux pane and send commands to run in that tmux 53 | pane. 54 | 55 | This plugin was created by Chris Toomey[1]. Any bugs or feature requests can 56 | be entered at the github repo[2] for the plugin. Any feedback is greatly 57 | appreciated. 58 | 59 | This plugin was heavily inspired by Vimux[3]. It is meant to provide a very 60 | similar feature set to Vimux, but use native vimscript. In addition VTR 61 | provides a few commands beyond those in Vimux, such as the ability to rotate 62 | the runner pane between orientations. In addition, the code for sending text 63 | from a Vim buffer to the tmux runner pane for execution was modeled on the 64 | tslime.vim[4] plugin. 65 | 66 | [1] http://ctoomey.com 67 | [2] https://github.com/christoomey/vim-tmux-runner/issues 68 | [3] https://github.com/benmills/vimux 69 | [4] https://github.com/kikijump/tslime.vim 70 | 71 | ============================================================================== 72 | USAGE (2) *VTR-Usage* 73 | 74 | VTR provides a collection of commands and functions that allow Vim to interact 75 | with tmux. The primary command is VtrSendCommandToRunner. This allows for any 76 | command string to be passed to tmux for execution. The command 77 | VtrSendLinesToRunner allow for either the current 78 | visually selected region or the current line to be sent to the tmux runner 79 | pane for execution. This functionality is similar to SLIME[5] mode for the 80 | Emacs text editor. 81 | 82 | VTR uses a tmux "pane" to execute the provided command. A tmux pane is very 83 | similar to a Vim split. Throughout VTR this tmux pane used for command 84 | execution is referred to as the "runner" pane. The runner by default will 85 | start an instance of the system shell, but other executables such as a python 86 | REPL, ruby irb session, or similar then be opened within that shell be used. 87 | The power of VTR and tmux is that each pane is a fully independent shell 88 | environment. None the less, tmux allows for communication between these 89 | environments and it is this ability that give VTR its power. 90 | 91 | [5] http://common-lisp.net/project/slime/ 92 | 93 | ------------------------------------------------------------------------------ 94 | *VtrSendCommandToRunner* 95 | 2.1 VtrSendCommandToRunner~ 96 | 97 | Send a command to the tmux runner pane. This is the primary purpose of VTR. 98 | 99 | Before using this command, attaching to a tmux runner pane via VtrOpenRunner 100 | or VtrAttachToPane is required. If you would like VTR to create a runner pane 101 | if it doesn't exist while issuing a command, a bang version can be used: 102 | VtrSendCommandToRunner!. 103 | 104 | By default, the runner will be cleared before sending the provided command, 105 | but this behavior can be disabled with the |VtrClearBeforeSend| setting. 106 | 107 | The first time this command is called, it will prompt for a command to send to 108 | the runner. The specific prompt text can be configured via the |VtPrompt| 109 | setting. The command is then stored in an internal variable and will 110 | continue to be used for subsequent calls to the command. The stored command 111 | can be cleared using |VtrFlushCommand|. 112 | 113 | ------------------------------------------------------------------------------ 114 | *VtrSendLinesToRunner* 115 | 2.2 VtrSendLinesToRunner~ 116 | 117 | Send the current line or the current visual selection from the Vim buffer 118 | to the runner pane for execution. 119 | 120 | ------------------------------------------------------------------------------ 121 | *VtrOpenRunner* 122 | 2.3 VtrOpenRunner~ 123 | 124 | Open a tmux pane, referred to as the "runner", adjacent to the tmux pane 125 | containing the current Vim session. This command will make use of the 126 | |VtrOrientation| and |VtrPercentage| settings. Note, this command will 127 | restore a detached pane or create a new one as needed. 128 | 129 | This command can also be passed a Vim Dictionary with parameters for the new 130 | pane to override the defaults. This can be used to create context specific 131 | runner panes with sizing and orientation that is relevant for that use case. 132 | 133 | Script runner: 134 | VtrOpenRunner {'orientation': 'h', 'percentage': 50} 135 | 136 | Test runner: 137 | VtrOpenRunner {'orientation': 'v', 'percentage': 20} 138 | 139 | Ruby Repl: 140 | VtrOpenRunner {'orientation': 'h', 'percentage': 50, 'cmd': 'irb'} 141 | 142 | ------------------------------------------------------------------------------ 143 | *VtrKillRunner* 144 | 2.4 VtrKillRunner~ 145 | 146 | Kill the tmux runner pane. this pane will kill either the local or detached 147 | runner pane. this command does nothing if there is currently not a runner 148 | pane. 149 | 150 | ------------------------------------------------------------------------------ 151 | *VtrFocusRunner* 152 | 2.5 VtrFocusRunner~ 153 | 154 | Move the cursor to the runner to interact directly with it and zooms the 155 | pane. A new runner will be created if one does not exist and a detached 156 | pane will be restored as needed. To not zoom the runner pane, add a bang: 157 | VtrFocusRunner!. 158 | 159 | ------------------------------------------------------------------------------ 160 | *VtrResizeRunner* 161 | 2.6 VtrResizeRunner~ 162 | 163 | Prompt for a new percentage then resize the runner pane to that percentage. 164 | This command will update the |VtrPercentage| setting for the current Vim 165 | session. The |VtrPercentage| will be reset if Vim is closed. By default, the 166 | runner will be cleared after resizing, but this behavior can be disabled 167 | with the |VtrClearOnResize| setting. 168 | 169 | ------------------------------------------------------------------------------ 170 | *VtrReorientRunner* 171 | 2.7 VtrReorientRunner~ 172 | 173 | Switch the runner pane from its current orientation to the alternate 174 | orientation (horizontal or vertical). The |VtrPercentage| will be maintained 175 | through the reorientation. By default, the runner will be cleared after 176 | reorienting, but this behavior can be disabled with the |VtrClearOnReorient| 177 | setting. 178 | 179 | ------------------------------------------------------------------------------ 180 | *VtrDetachRunner* 181 | 2.8 VtrDetachRunner~ 182 | 183 | Detach the runner pane to its own window while keeping the cursor focus on the 184 | Vim window. This command is useful if there are details in the runner pane or 185 | significant setup implemented in the runner pane that will be useful at a 186 | later time, but current the runner pane is not needed. Rather than killing the 187 | runner, this command simply stashes it away in its own window until it is 188 | needed again. The runner can later be restored with any of |VtrReattachRunner|, 189 | |VtrOpenRunner|, or |VtrFocusRunner|. The runner can still be killed with the 190 | |VtrKillRunner| command. 191 | 192 | ------------------------------------------------------------------------------ 193 | *VtrReattachRunner* 194 | 2.9 VtrReattachRunner~ 195 | 196 | Reattach the runner pane. This command assumes that the runner has previously 197 | been dismissed using the |VtrDetachRunner| command. The pane will be restored 198 | with the last |VtrOrientation| and |VtrPercentage| combination used. By 199 | default the runner pane will be cleared after being reattached, but this 200 | behavior can be disabled using the |VtrClearOnReattach| setting. 201 | 202 | ------------------------------------------------------------------------------ 203 | *VtrClearRunner* 204 | 2.10 VtrClearRunner~ 205 | 206 | Send the key sequence defined by the |VtrClearSequence| setting to the runner. 207 | By default this will clear any unfinished commands at the shell prompt and 208 | move the prompt up to hide any previous command output. 209 | 210 | ------------------------------------------------------------------------------ 211 | *VtrFlushCommand* 212 | 2.11 VtrFlushCommand~ 213 | 214 | Flush the previous run command variable. After running this command, the next 215 | run of |VtrSendCommandToRunner| will again prompt for the command to run. 216 | 217 | ------------------------------------------------------------------------------ 218 | *VtrSendCtrlD* 219 | 2.12 VtrSendCtrlD~ 220 | 221 | Send Ctrl-D key sequence to the runner without resetting the current command. 222 | This is useful if you are repeatedly running a script in the debugger and 223 | regularly need to kill the repl. 224 | 225 | ------------------------------------------------------------------------------ 226 | *VtrSendCtrlC* 227 | 2.13 VtrSendCtrlC~ 228 | 229 | Send Ctrl-C key sequence to the runner without resetting the current command. 230 | This is useful if you are repeatedly running a script in the debugger and 231 | regularly need to interrupt the process. 232 | 233 | ------------------------------------------------------------------------------ 234 | *VtrSendKeysRaw* 235 | 2.14 VtrSendKeysRaw~ 236 | 237 | Send a key sequence to the runner. |VtrSendCtrlD| and |VtrSendCtrlC| wrap this 238 | to send Ctrl-D and Ctrl-C to the runner. 239 | 240 | ------------------------------------------------------------------------------ 241 | *VtrSendFile* 242 | 2.15 VtrSendFile~ 243 | 244 | Send a command to execute the current file as a script. The command will be 245 | crafted based on the filetype of the current buffer, e.g. for a file "foo.rb" 246 | (filetype "ruby"), the command would be "ruby {filename}" with {filename} 247 | populated based on the current file. There are default configurations provided 248 | for elixir, javascript (via node), python, ruby, and sh. You can override and 249 | or add by defining a dictionary in your Vimrc, e.g.: 250 | 251 | let g:vtr_filetype_runner_overrides = { 252 | \ 'ruby': 'ruby -w {file}', 253 | \ 'haskell': 'runhaskell {file}' 254 | \ } 255 | 256 | The key for each entry should be the fileype, and the value is a string for 257 | which the {file} portion will be replaced by the current file name when run. 258 | Any settings in your g:vtr_filetype_runner_overrides will take precedence 259 | over the default values. 260 | 261 | This command expects a runner to be attached. Add ! to force a runner. 262 | 263 | ------------------------------------------------------------------------------ 264 | *VtrUnsetRunnerPane* 265 | 2.16 VtrUnsetRunnerPane~ 266 | 267 | This command will unset the "runner pane" allowing you to open a new pane. Most 268 | commands will check for the runner pane before running and thus you may hit 269 | "Runner pane setting (1) is invalid..." if you've closed the runner pane. 270 | 271 | 272 | ============================================================================== 273 | CONFIGURATION (3) *VTR-Configuration* 274 | 275 | You can configure VTR using the following settings: 276 | 277 | ------------------------------------------------------------------------------ 278 | *VtrPercentage* 279 | 3.1 g:VtrPercentage~ 280 | 281 | The percent of the tmux window the runner pane will occupy. 282 | 283 | let g:VtrPercentage = 35 284 | 285 | Default: 20 286 | 287 | ------------------------------------------------------------------------------ 288 | *VtrOrientation* 289 | 3.2 g:VtrOrientation~ 290 | 291 | The orientation used when creating the tmux split pane to use as the runner 292 | pane. The orientation argument is the inverse of Vim's, ie "horizontal" splits 293 | in tmux will create a new pane to the right of the existing pane. 294 | 295 | let g:VtrOrientation = "h" 296 | 297 | Options: 298 | "v": vertical (split pane below Vim pane) 299 | "h": horizontal (split pane to the right of Vim pane) 300 | 301 | Default: "v" 302 | 303 | ------------------------------------------------------------------------------ 304 | *VtrInitialCommand* 305 | 3.3 g:VtrInitialCommand~ 306 | 307 | Provide a command to be run just after the runner pane is created. This can 308 | be used to set the working directory, define an environment variable, etc. 309 | No command will be run if this is set to an empty string. 310 | 311 | let g:VtrInitialCommand = "cd .." 312 | 313 | Default: "" 314 | 315 | ------------------------------------------------------------------------------ 316 | *VtrGitCdUpOnOpen* 317 | 3.4 g:VtrGitCdUpOnOpen~ 318 | 319 | When opening a new runner, if currently within a git repo then change the 320 | working directory to the root of the git repo. This can be useful for some 321 | test runners which behave differently depending on where they are run from. By 322 | default this functionality is disabled. 323 | 324 | let g:VtrGitCdUpOnOpen = 1 325 | 326 | Default: 0 327 | 328 | ------------------------------------------------------------------------------ 329 | *VtrClearBeforeSend* 330 | 3.5 g:VtrClearBeforeSend~ 331 | 332 | Before sending a command to the runner pane, send the clear sequence defined 333 | by the |VtrClearSequence| setting. This will make it easier to view and 334 | interpret the output in the runner pane. Set this to 0 to disable. 335 | 336 | let g:VtrClearBeforeSend = 0 337 | 338 | Default: 1 339 | 340 | ------------------------------------------------------------------------------ 341 | *VtrPrompt* 342 | 3.5 g:VtrPrompt~ 343 | 344 | The string used when prompting for a command to run. It is best to include a 345 | space at the end of this string to visually separate the prompt from the users 346 | command. 347 | 348 | let g:VtrPrompt = "What can I do you for?: " 349 | 350 | Default: "Command to run: " 351 | 352 | ------------------------------------------------------------------------------ 353 | *VtrUseVtrMaps* 354 | 3.6 g:VtrUseVtrMaps~ 355 | 356 | Allow VTR to define a set of key mappings to provide easy access to the VTR 357 | command set. As a Vim user, I consider my space to be sacred, so 358 | these maps are disabled by default. To allow VTR to set its maps, add the 359 | following to your vimrc: 360 | 361 | let g:VtrUseVtrMaps = 1 362 | 363 | The following normal mode maps are provided when g:VtrUseVtrMaps is set to 1: 364 | 365 | Mapping | Command 366 | ----------------------------- 367 | va | VtrAttachToPane 368 | ror | VtrReorientRunner 369 | sc | VtrSendCommandToRunner 370 | sf | VtrSendFile 371 | sl | VtrSendLinesToRunner 372 | or | VtrOpenRunner 373 | kr | VtrKillRunner 374 | fr | VtrFocusRunner 375 | dr | VtrDetachRunner 376 | cr | VtrClearRunner 377 | fc | VtrFlushCommand 378 | 379 | In addition, a single visual mode map is provided to send a visually selected 380 | region to the runner pane: 381 | 382 | Mapping | Command 383 | ----------------------------- 384 | sl | VtrSendLinesToRunner 385 | 386 | Default: 0 387 | 388 | ------------------------------------------------------------------------------ 389 | *VtrClearOnResize* 390 | 3.7 g:VtrClearOnResize~ 391 | 392 | Send the |VtrClearSequence| after resizing the runner via the 393 | |VtrResizeRunner| command. This option is turned off by default as 394 | most often a resize is used to better see the content currently in 395 | the runner pane. 396 | 397 | let g:VtrClearOnResize = 1 398 | 399 | Default: 0 400 | 401 | ------------------------------------------------------------------------------ 402 | *VtrClearOnReorient* 403 | 3.8 g:VtrClearOnReorient~ 404 | 405 | Send the |VtrClearSequence| after reorienting the runner via the 406 | |VtrReorientRunner| command. 407 | 408 | let g:VtrClearOnReorient = 0 409 | 410 | Default: 1 411 | 412 | ------------------------------------------------------------------------------ 413 | *VtrClearOnReattach* 414 | 3.9 g:VtrClearOnReattach~ 415 | 416 | Send the |VtrClearSequence| after reattaching the runner via the 417 | |VtrReattachRunner| command. 418 | 419 | let g:VtrClearOnReattach = 0 420 | 421 | Default: 1 422 | 423 | ------------------------------------------------------------------------------ 424 | *VtrDetachedName* 425 | 3.10 g:VtrDetachedName~ 426 | 427 | The name to use for the temporary window used when dismissing the runner via 428 | the |VtrDetachRunner| command. This is provided in the rare event that the 429 | window name "VTR_Pane" is already used and you would like to distinguish the 430 | VTR detached runner pane window. 431 | 432 | let g:VtrDetachedName = "WildAndWackyWindowName" 433 | 434 | Default: "VTR_Pane" 435 | 436 | ------------------------------------------------------------------------------ 437 | *VtrClearSequence* 438 | 3.11 g:VtrClearSequence~ 439 | 440 | The character sequence to send to clear the runner. This sequence is used in 441 | the explicit VTR comamnd |VtrClearRunner|. In addition, the sequence may be 442 | used with the commands |VtrSendCommandToRunner|, |VtrResizeRunner|, 443 | |VtrReattachRunner|, and |VtrReorientRunner| depending on the current value of 444 | their respective "ClearOn" settings. 445 | 446 | The default sequence will clear any unfinished commands sent to the shell 447 | prompt within the runner pane and clear the scrollback history to present a 448 | clean prompt ready for the next command. The character literals,  , for 449 | and respectively, can be inserted using while in 450 | insert mode. See the help file, ':help i_Ctrl-v', for more detail. 451 | 452 | let g:VtrClearSequence = " " 453 | 454 | Default: " " 455 | 456 | ------------------------------------------------------------------------------ 457 | *VtrStripLeadingWhitespace* 458 | 459 | 3.12 g:VtrStripLeadingWhitespace~ 460 | 461 | When interacting with most REPLs, indentation will automatically be added to 462 | the beginning of lines based on the syntax. The setting causes VTR to strip 463 | leading whitespace before sending lines to avoid doubly indented lines. 464 | 465 | By default this setting is enabled, but if you are using a language with 466 | syntactic whitespace like python or coffeescript then you will likely want to 467 | disable this setting. 468 | 469 | let g:VtrStripLeadingWhitespace = 0 470 | 471 | Default: 1 472 | 473 | ------------------------------------------------------------------------------ 474 | *VtrClearEmptyLines* 475 | 476 | 3.13 g:VtrClearEmptyLines~ 477 | 478 | VTR will clear out empty lines in visually selected regions to avoid clutter in 479 | the REPLs. If the blank lines are relevant, you can disable this behavior. 480 | 481 | let g:VtrClearEmptyLines = 0 482 | 483 | Default: 1 484 | 485 | ------------------------------------------------------------------------------ 486 | *VtrAppendNewline* 487 | 488 | 3.14 g:VtrAppendNewline 489 | 490 | If you are using python or any language with syntactic whitespace, an empty 491 | line might be needed to close the preceding context. To enable appending a new 492 | line to any multi line send, use the following setting. 493 | 494 | let g:VtrAppendNewline = 1 495 | 496 | Default: 0 497 | 498 | ------------------------------------------------------------------------------ 499 | *VtrCreatedRunnerPaneName* 500 | 501 | 3.15 g:VtrCreatedRunnerPaneName 502 | 503 | When runner panes are created this name will be set on them using: 504 | "select-pane -T g:VtrCreatedRunnerPaneName" 505 | 506 | let g:VtrCreatedRunnerPaneName = "the name you want" 507 | 508 | Default: VTR_Created_Pane 509 | 510 | ------------------------------------------------------------------------------ 511 | *VtrAutomaticReattachByName* 512 | 513 | 3.16 g:VtrAutomaticReattachByName 514 | 515 | With this option a search for a runner pane with the name stored in 516 | g:VtrCreatedRunnerPaneName will be performed and the command will be sent to 517 | that pane if it exists before any new runner panes are created. defined by 518 | g:VtrCreatedRunnerPaneName. 519 | 520 | let g:VtrAutomaticReattachByName = 1 521 | 522 | Default: 0 523 | 524 | ============================================================================== 525 | vim:tw=78:ts=2:sw=2:expandtab:ft=help:norl: 526 | --------------------------------------------------------------------------------