Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 285 by dhah...@gmail.com: Completion for "set ft=" and "set syntax="
https://code.google.com/p/vim/issues/detail?id=285

There is currently no completion for "set filetype=" and "set syntax=".

I've looked a bit into the source and came up with the following patch, which
works basically, but probably needs improvements.

It sets the context to `EXPAND_FILETYPE` in both cases, because there appears
to be no completion/expansion for available syntax definitions yet - or I
have not found it.

For syntax completion, it might be probably better to expand on the `%s` part of the matching file names 'syntax/%s.vim' and 'syntax/%s/*.vim' in the runtime
path.

This patch also fixes the invalid completion after "set noinv", which currently
completes all boolean settings.


diff --git i/src/option.c w/src/option.c
index 6841d42..9dd7b1c 100644
--- i/src/option.c
+++ w/src/option.c
@@ -10773,12 +10773,31 @@ set_context_in_set_cmd(xp, arg, opt_flags)
        }
        --p;
     }
-    if (STRNCMP(p, "no", 2) == 0 && STRNCMP(p, "novice", 6) != 0)
+    if (STRNCMP(p, "filetype=", 9) == 0)
+    {
+        xp->xp_context = EXPAND_FILETYPE;
+        p += 9;
+    }
+    else if (STRNCMP(p, "ft=", 3) == 0)
+    {
+        xp->xp_context = EXPAND_FILETYPE;
+        p += 3;
+    }
+    else if (STRNCMP(p, "syntax=", 7) == 0)
+    {
+        xp->xp_context = EXPAND_FILETYPE;
+        p += 7;
+    }
+    else if (STRNCMP(p, "syn=", 4) == 0)
+    {
+        xp->xp_context = EXPAND_FILETYPE;
+        p += 4;
+    }
+    else if (STRNCMP(p, "no", 2) == 0 && STRNCMP(p, "novice", 6) != 0)
     {
        xp->xp_context = EXPAND_BOOL_SETTINGS;
        p += 2;
-    }
-    if (STRNCMP(p, "inv", 3) == 0)
+    } else if (STRNCMP(p, "inv", 3) == 0)
     {
        xp->xp_context = EXPAND_BOOL_SETTINGS;
        p += 3;


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui