Skip to content

Instantly share code, notes, and snippets.

@AdamWagner
Last active September 1, 2018 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamWagner/4a2097b46ff039eb03a693ef0d0926aa to your computer and use it in GitHub Desktop.
Save AdamWagner/4a2097b46ff039eb03a693ef0d0926aa to your computer and use it in GitHub Desktop.
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