summaryrefslogtreecommitdiff
path: root/src/misc1.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-05-07 15:10:21 +0200
committerBram Moolenaar <Bram@vim.org>2014-05-07 15:10:21 +0200
commit75a8d74cc22d66482a1149f004b04bcc0a8326f2 (patch)
tree629f2de2aa52c4640127d42768299b1166ab59a3 /src/misc1.c
parentf4d7f167f3c1e26f26c4b5905db553eb94aa9e81 (diff)
downloadvim-git-75a8d74cc22d66482a1149f004b04bcc0a8326f2.tar.gz
updated for version 7.4.276v7.4.276
Problem: The fish shell is not supported. Solution: Use begin/end instead of () for fish. (Andy Russell)
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/misc1.c b/src/misc1.c
index a71ab7cc9..477aba4bd 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -1405,7 +1405,7 @@ open_line(dir, flags, second_line_indent)
#ifdef FEAT_SMARTINDENT
if (did_si)
{
- int sw = (int)get_sw_value(curbuf);
+ int sw = (int)get_sw_value(curbuf);
if (p_sr)
newindent -= newindent % sw;
@@ -10896,3 +10896,41 @@ goto_im()
{
return (p_im && stuff_empty() && typebuf_typed());
}
+
+/*
+ * Returns the isolated name of the shell:
+ * - Skip beyond any path. E.g., "/usr/bin/csh -f" -> "csh -f".
+ * - Remove any argument. E.g., "csh -f" -> "csh".
+ * But don't allow a space in the path, so that this works:
+ * "/usr/bin/csh --rcfile ~/.cshrc"
+ * But don't do that for Windows, it's common to have a space in the path.
+ */
+ char_u *
+get_isolated_shell_name()
+{
+ char_u *p;
+
+#ifdef WIN3264
+ p = gettail(p_sh);
+ p = vim_strnsave(p, (int)(skiptowhite(p) - p));
+#else
+ p = skiptowhite(p_sh);
+ if (*p == NUL)
+ {
+ /* No white space, use the tail. */
+ p = vim_strsave(gettail(p_sh));
+ }
+ else
+ {
+ char_u *p1, *p2;
+
+ /* Find the last path separator before the space. */
+ p1 = p_sh;
+ for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
+ if (vim_ispathsep(*p2))
+ p1 = p2 + 1;
+ p = vim_strnsave(p1, (int)(p - p1));
+ }
+#endif
+ return p;
+}