diff options
author | Scott Prager <splinterofchaos@gmail.com> | 2014-07-21 01:53:02 -0400 |
---|---|---|
committer | Scott Prager <splinterofchaos@gmail.com> | 2014-08-17 22:17:26 -0400 |
commit | d2988e12fe577bcb6e91be359049b1355fa51aed (patch) | |
tree | 2514ad0e09eaacd59641974c823f194d3abd3140 /src/nvim/ex_cmds.c | |
parent | 284539f3950f724519948ffd4f68dd1b3899f321 (diff) | |
download | rneovim-d2988e12fe577bcb6e91be359049b1355fa51aed.tar.gz rneovim-d2988e12fe577bcb6e91be359049b1355fa51aed.tar.bz2 rneovim-d2988e12fe577bcb6e91be359049b1355fa51aed.zip |
vim-patch:7.4.276
Problem: The fish shell is not supported.
Solution: Use begin/end instead of () for fish. (Andy Russell)
https://code.google.com/p/vim/source/detail?r=a6b59ee633a355095e6473ec5e2a7d9088bfb853
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 009688f03d..48e75190aa 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1316,8 +1316,18 @@ do_shell ( /// @returns an allocated string with the shell command. char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp) { + bool is_fish_shell = +#if defined(UNIX) + STRNCMP(invocation_path_tail(p_sh, NULL), "fish", 4) == 0; +#else + false; +#endif + size_t len = STRLEN(cmd) + 1; // At least enough space for cmd + NULL. - len += sizeof("("")") - 1; + + len += is_fish_shell ? sizeof("begin; ""; end") - 1 + : sizeof("("")") - 1; + if (itmp != NULL) len += STRLEN(itmp) + sizeof(" { "" < "" } ") - 1; if (otmp != NULL) @@ -1325,18 +1335,22 @@ char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp) char_u *buf = xmalloc(len); #if defined(UNIX) - // Put braces around the command (for concatenated commands) when + // Put delimiters around the command (for concatenated commands) when // redirecting input and/or output. - if (itmp != NULL || otmp != NULL) - vim_snprintf((char *)buf, len, "(%s)", (char *)cmd); - else + if (itmp != NULL || otmp != NULL) { + char *fmt = is_fish_shell ? "begin; %s; end" + : "(%s)"; + vim_snprintf((char *)buf, len, fmt, (char *)cmd); + } else { STRCPY(buf, cmd); + } + if (itmp != NULL) { STRCAT(buf, " < "); STRCAT(buf, itmp); } #else - // for shells that don't understand braces around commands, at least allow + // For shells that don't understand braces around commands, at least allow // the use of commands in a pipe. STRCPY(buf, cmd); if (itmp != NULL) { |