Question

I am using vim 7.3 on OSX Lion. I installed snipmate from garbas/vim-snipmate on github, and it appears that <tab> doesn't work in certain places while <c-n> does.

When I try to tab-complete an existing word in the file or if I want to tab-complete something from my ctags list, all I get is spaces being added...but <c-n> works!

If I freely type for<tab>, that does work.

Why is it not completing in some cases but does in others?

Was it helpful?

Solution

You are confused, <C-n> and Snipmate's tab-expansion system have nothing to do with each other.

<C-n> is a built-in shortcut for omnicompletion: it allows you to complete what you are currently typing with other words from the currently opened buffers, and some other sources.

Snipmate's <Tab> expands arbitrary stubs into full snippets of code:

for<Tab>

would give you this in a JS file:

for (var i = 0; i < Things.length; i++) {

}

It's not a completion mechanism. If you don't have a language-specific snippet defined for the few letters you just typed, Snipmate won't do anything:

function farting(){
    return "prrt!";
}

far<Tab>

doesn't expand anything because you don't have a far snippet while omnicompletion will complete with ting.

Because you want your <Tab> to do two unrelated things you will probably need a plugin like SuperTab.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top