diff --git a/doc/vimux.txt b/doc/vimux.txt index dff0dcd..509b123 100644 --- a/doc/vimux.txt +++ b/doc/vimux.txt @@ -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: diff --git a/plugin/vimux.vim b/plugin/vimux.vim index 20da10c..bd1f247 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -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