feat: VtrSendCtrlC and VtrSendKeysRaw (#98)
Co-authored-by: Chris Toomey <chris@ctoomey.com>
This commit is contained in:
		
							parent
							
								
									e28aa7799a
								
							
						
					
					
						commit
						3a0f173620
					
				| @ -1,4 +1,4 @@ | |||||||
| *vim-tmux-runner.txt*	      For Vim version 7.3	      Last change: 2012 Nov 25 | *vim-tmux-runner.txt*	      For Vim version 7.3	      Last change: 2020 May 29 | ||||||
| 
 | 
 | ||||||
|                             Vim Tmux Runner |                             Vim Tmux Runner | ||||||
|                     Vim and tmux, sittin' in a tree... |                     Vim and tmux, sittin' in a tree... | ||||||
| @ -20,7 +20,9 @@ CONTENTS                                                        *vtr-contents* | |||||||
|         2.10 ............................... |VtrClearRunner| |         2.10 ............................... |VtrClearRunner| | ||||||
|         2.11 ............................... |VtrFlushCommand| |         2.11 ............................... |VtrFlushCommand| | ||||||
|         2.12 ............................... |VtrSendCtrlD| |         2.12 ............................... |VtrSendCtrlD| | ||||||
|         2.13 ............................... |VtrSendFile| |         2.13 ............................... |VtrSendCtrlC| | ||||||
|  |         2.14 ............................... |VtrSendKeysRaw| | ||||||
|  |         2.15 ............................... |VtrSendFile| | ||||||
|       3. Configuration ................... |VTR-Configuration| |       3. Configuration ................... |VTR-Configuration| | ||||||
|         3.1 ................................ |VtrPercentage| |         3.1 ................................ |VtrPercentage| | ||||||
|         3.2 ................................ |VtrOrientation| |         3.2 ................................ |VtrOrientation| | ||||||
| @ -217,9 +219,24 @@ Send Ctrl-D key sequence to the runner without resetting the current command. | |||||||
| This is useful if you are repeatedly running a script in the debugger and | This is useful if you are repeatedly running a script in the debugger and | ||||||
| regularly need to kill the repl. | regularly need to kill the repl. | ||||||
| 
 | 
 | ||||||
|  | ------------------------------------------------------------------------------ | ||||||
|  |                                                                  *VtrSendCtrlC* | ||||||
|  | 2.13 VtrSendCtrlC~ | ||||||
|  | 
 | ||||||
|  | Send Ctrl-C key sequence to the runner without resetting the current command. | ||||||
|  | This is useful if you are repeatedly running a script in the debugger and | ||||||
|  | regularly need to interrupt the process. | ||||||
|  | 
 | ||||||
|  | ------------------------------------------------------------------------------ | ||||||
|  |                                                                *VtrSendKeysRaw* | ||||||
|  | 2.14 VtrSendKeysRaw~ | ||||||
|  | 
 | ||||||
|  | Send a key sequence to the runner. |VtrSendCtrlD| and |VtrSendCtrlC| wrap this | ||||||
|  | to send Ctrl-D and Ctrl-C to the runner. | ||||||
|  | 
 | ||||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ||||||
|                                                                   *VtrSendFile* |                                                                   *VtrSendFile* | ||||||
| 2.13 VtrSendFile~ | 2.15 VtrSendFile~ | ||||||
| 
 | 
 | ||||||
| Send a command to execute the current file as a script. The command will be | Send a command to execute the current file as a script. The command will be | ||||||
| crafted based on the filetype of the current buffer, e.g. for a file "foo.rb" | crafted based on the filetype of the current buffer, e.g. for a file "foo.rb" | ||||||
|  | |||||||
| @ -178,6 +178,19 @@ function! s:SendKeys(keys) | |||||||
|     call s:SendEnterSequence() |     call s:SendEnterSequence() | ||||||
| endfunction | endfunction | ||||||
| 
 | 
 | ||||||
|  | function! s:SendKeysRaw(keys) | ||||||
|  |   if !s:ValidRunnerPaneSet() | return | endif | ||||||
|  |   call s:_SendKeys(a:keys) | ||||||
|  | endfunction | ||||||
|  | 
 | ||||||
|  | function! s:SendCtrlD() | ||||||
|  |   call s:SendKeysRaw('') | ||||||
|  | endfunction | ||||||
|  | 
 | ||||||
|  | function! s:SendCtrlC() | ||||||
|  |   call s:SendKeysRaw('') | ||||||
|  | endfunction | ||||||
|  | 
 | ||||||
| function! s:SendEnterSequence() | function! s:SendEnterSequence() | ||||||
|     call s:_SendKeys("Enter") |     call s:_SendKeys("Enter") | ||||||
| endfunction | endfunction | ||||||
| @ -425,12 +438,6 @@ function! s:SendTextToRunner(lines) | |||||||
|     call s:SendTmuxCommand(targeted_cmd) |     call s:SendTmuxCommand(targeted_cmd) | ||||||
| endfunction | endfunction | ||||||
| 
 | 
 | ||||||
| function! s:SendCtrlD() |  | ||||||
|   if !s:ValidRunnerPaneSet() | return | endif |  | ||||||
|   call s:SendTmuxCopyModeExit() |  | ||||||
|   call s:SendKeys('') |  | ||||||
| endfunction |  | ||||||
| 
 |  | ||||||
| function! s:SendFileViaVtr(ensure_pane) | function! s:SendFileViaVtr(ensure_pane) | ||||||
|     let runners = s:CurrentFiletypeRunners() |     let runners = s:CurrentFiletypeRunners() | ||||||
|     if has_key(runners, &filetype) |     if has_key(runners, &filetype) | ||||||
| @ -480,7 +487,9 @@ 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! -bang -nargs=? -bar VtrAttachToPane call s:AttachToPane(<f-args>) |     command! VtrSendCtrlC call s:SendCtrlC() | ||||||
|  |     command! VtrAttachToPane call s:PromptForRunnerToAttach() | ||||||
|  |     command! -nargs=1 VtrSendKeysRaw call s:SendKeysRaw(<q-args>) | ||||||
| endfunction | endfunction | ||||||
| 
 | 
 | ||||||
| function! s:DefineKeymaps() | function! s:DefineKeymaps() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user