]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1833 v7.4.1833
authorBram Moolenaar <Bram@vim.org>
Tue, 24 May 2016 08:46:45 +0000 (10:46 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 24 May 2016 08:46:45 +0000 (10:46 +0200)
Problem:    Cannot use an Ex command for 'keywordprg'.
Solution:   Accept an Ex command. (Nelo-Thara Wallus)

runtime/doc/options.txt
src/normal.c
src/version.c

index aefbdbffbc2442b1c4f6958af4352e1bf55c9f37..3f3764939a0347ab973dcb135b1d6912f8bb8c1f 100644 (file)
@@ -4587,16 +4587,18 @@ A jump table for the options with a short description can be found at |Q_op|.
 
                                        *'keywordprg'* *'kp'*
 'keywordprg' 'kp'      string  (default "man" or "man -s",  DOS: ":help",
-                                               OS/2: "view /", VMS: "help")
+                                                                 VMS: "help")
                        global or local to buffer |global-local|
                        {not in Vi}
        Program to use for the |K| command.  Environment variables are
        expanded |:set_env|.  ":help" may be used to access the Vim internal
        help.  (Note that previously setting the global option to the empty
        value did this, which is now deprecated.)
-       When "man" is used, Vim will automatically translate a count for the
-       "K" command to a section number.  Also for "man -s", in which case the
-       "-s" is removed when there is no count.
+       When the first character is ":", the command is invoked as a Vim
+       Ex command prefixed with [count].
+       When "man", "man -s" or an Ex command is used, Vim will automatically
+       translate a count for the "K" command and pass it as the first
+       argument.  For "man -s" the "-s" is removed when there is no count.
        See |option-backslash| about including spaces and backslashes.
        Example: >
                :set keywordprg=man\ -s
index 7c15c15521c0465aa2a5fec1ab45f2ace0761587..d9948ec5943bf9deaf6ee0fbdc336d2b63c229bd 100644 (file)
@@ -5485,10 +5485,12 @@ nv_ident(cmdarg_T *cap)
 {
     char_u     *ptr = NULL;
     char_u     *buf;
+    unsigned   buflen;
     char_u     *newbuf;
     char_u     *p;
     char_u     *kp;            /* value of 'keywordprg' */
-    int                kp_help;        /* 'keywordprg' is ":help" */
+    int                kp_help;        /* 'keywordprg' is ":he" */
+    int                kp_ex;          /* 'keywordprg' starts with ":" */
     int                n = 0;          /* init for GCC */
     int                cmdchar;
     int                g_cmd;          /* "g" command */
@@ -5536,7 +5538,9 @@ nv_ident(cmdarg_T *cap)
     kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp);
     kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0
                                                 || STRCMP(kp, ":help") == 0);
-    buf = alloc((unsigned)(n * 2 + 30 + STRLEN(kp)));
+    kp_ex = (*kp == ':');
+    buflen = (unsigned)(n * 2 + 30 + STRLEN(kp));
+    buf = alloc(buflen);
     if (buf == NULL)
        return;
     buf[0] = NUL;
@@ -5562,6 +5566,15 @@ nv_ident(cmdarg_T *cap)
        case 'K':
            if (kp_help)
                STRCPY(buf, "he! ");
+           else if (kp_ex)
+           {
+               if (cap->count0 != 0)
+                   vim_snprintf((char *)buf, buflen, "%s %ld",
+                                                            kp, cap->count0);
+               else
+                   STRCPY(buf, kp);
+               STRCAT(buf, " ");
+           }
            else
            {
                /* An external command will probably use an argument starting
index 863a58f199086d253010a5fbf136aa2b9f216c51..eaa3e8ec91de631ab1dd7a249261027ff583aa7e 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1833,
 /**/
     1832,
 /**/