Last active
September 1, 2018 01:08
-
-
Save AdamWagner/4a2097b46ff039eb03a693ef0d0926aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! Strip(string) | |
return substitute(a:string, '^\s*\(.\{-}\)\s*\n\?$', '\1', '') | |
endfunction | |
function! TargetedTmuxCommand(command, target_pane) | |
return a:command . " -t " . a:target_pane | |
endfunction | |
function! SendTmuxCommand(command) | |
let prefixed_command = "tmux " . a:command | |
echom a:command | |
return system(prefixed_command) | |
endfunction | |
function! _SendKeys(keys) | |
let targeted_cmd = TargetedTmuxCommand("send-keys", ".+") | |
let full_command = join([targeted_cmd, a:keys]) | |
call SendTmuxCommand(full_command) | |
endfunction | |
function! SendEnterSequence() | |
call _SendKeys("Enter") | |
endfunction | |
function! SendKeys(keys) | |
call _SendKeys(a:keys) | |
call SendEnterSequence() | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment