Add option to expand VimuxPromptCommand arguments (#166)

Co-authored-by: Gerhard Siegesmund <gerhard.siegesmund@btd.de>
fix-tmux-next-3dot4
Gerhard Hellmann 3 years ago committed by GitHub
parent 3bfe0ea285
commit 5b1791673c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -400,5 +400,21 @@ you're using panes or windows, and your version of tmux.
Default: "tmux"
------------------------------------------------------------------------------
VimuxExpandCommand
4.10 g:VimuxExpandCommand~
Should the command given at the prompt via VimuxPromptCommand be expanded
using expand(). 1 to expand the string.
Unfortunately expand() only expands % (etc.) if the string starts with that
character. So the command is split at spaces and then rejoined after
expansion. With this simple approach things like "%:h/test.xml" are not
possible.
let g:VimuxExpandCommand = 1
Default: 0
==============================================================================
vim:tw=78:ts=2:sw=2:expandtab:ft=help:norl:

@ -14,6 +14,7 @@ let g:VimuxRunnerName = get(g:, 'VimuxRunnerName', '')
let g:VimuxRunnerType = get(g:, 'VimuxRunnerType', 'pane')
let g:VimuxTmuxCommand = get(g:, 'VimuxTmuxCommand', 'tmux')
let g:VimuxUseNearest = get(g:, 'VimuxUseNearest', v:true)
let g:VimuxExpandCommand = get(g:, 'VimuxExpandCommand', v:false)
function! VimuxOption(name) abort
return get(b:, a:name, get(g:, a:name))
@ -167,6 +168,9 @@ endfunction
function! VimuxPromptCommand(...)
let command = a:0 ==# 1 ? a:1 : ''
let l:command = input(VimuxOption('VimuxPromptString'), command, 'shellcmd')
if VimuxOption('VimuxExpandCommand')
let l:command = join(map(split(l:command, ' '), 'expand(v:val)'), ' ')
endif
call VimuxRunCommand(l:command)
endfunction

Loading…
Cancel
Save