Allow specifying the pane index with VtrAttachToPane (fixes #67)
This commit is contained in:
		
							parent
							
								
									30ed8912f5
								
							
						
					
					
						commit
						140017a04d
					
				| @ -246,19 +246,25 @@ function! s:AltPane() | |||||||
|   endif |   endif | ||||||
| endfunction | endfunction | ||||||
| 
 | 
 | ||||||
| function! s:PromptForRunnerToAttach() | function! s:AttachToPane(...) | ||||||
|   if s:PaneCount() == 2 |   if exists("a:1") && a:1 != "" | ||||||
|     call s:AttachToPane(s:AltPane()) |     call s:AttachToSpecifiedPane(a:1) | ||||||
|  |   elseif s:PaneCount() == 2 | ||||||
|  |     call s:AttachToSpecifiedPane(s:AltPane()) | ||||||
|   else |   else | ||||||
|     if g:VtrDisplayPaneNumbers |     call s:PromptForPaneToAttach() | ||||||
|       call s:SendTmuxCommand('source ~/.tmux.conf && tmux display-panes') |   endif | ||||||
|     endif | endfunction | ||||||
|     echohl String | let desired_pane = input('Pane #: ') | echohl None | 
 | ||||||
|     if desired_pane != '' | function! s:PromptForPaneToAttach() | ||||||
|       call s:AttachToPane(desired_pane) |   if g:VtrDisplayPaneNumbers | ||||||
|     else |     call s:SendTmuxCommand('source ~/.tmux.conf && tmux display-panes') | ||||||
|       call s:EchoError("No pane specified. Cancelling.") |   endif | ||||||
|     endif |   echohl String | let desired_pane = input('Pane #: ') | echohl None | ||||||
|  |   if desired_pane != '' | ||||||
|  |     call s:AttachToSpecifiedPane(desired_pane) | ||||||
|  |   else | ||||||
|  |     call s:EchoError("No pane specified. Cancelling.") | ||||||
|   endif |   endif | ||||||
| endfunction | endfunction | ||||||
| 
 | 
 | ||||||
| @ -269,7 +275,7 @@ function! s:CurrentMajorOrientation() | |||||||
|   return orientation_map[outermost_orientation] |   return orientation_map[outermost_orientation] | ||||||
| endfunction | endfunction | ||||||
| 
 | 
 | ||||||
| function! s:AttachToPane(desired_pane) | function! s:AttachToSpecifiedPane(desired_pane) | ||||||
|   let desired_pane = str2nr(a:desired_pane) |   let desired_pane = str2nr(a:desired_pane) | ||||||
|   if s:ValidRunnerPaneNumber(desired_pane) |   if s:ValidRunnerPaneNumber(desired_pane) | ||||||
|     let s:runner_pane = desired_pane |     let s:runner_pane = desired_pane | ||||||
| @ -453,7 +459,7 @@ function! s:DefineCommands() | |||||||
|     command! VtrClearRunner call s:SendClearSequence() |     command! VtrClearRunner call s:SendClearSequence() | ||||||
|     command! VtrFlushCommand call s:FlushCommand() |     command! VtrFlushCommand call s:FlushCommand() | ||||||
|     command! VtrSendCtrlD call s:SendCtrlD() |     command! VtrSendCtrlD call s:SendCtrlD() | ||||||
|     command! VtrAttachToPane call s:PromptForRunnerToAttach() |     command! -bang -nargs=? VtrAttachToPane call s:AttachToPane(<f-args>) | ||||||
| endfunction | endfunction | ||||||
| 
 | 
 | ||||||
| function! s:DefineKeymaps() | function! s:DefineKeymaps() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user