

Vim tab auto-complete - marrone

Hey, for the vimmers out there, this is such a great customization that I thought I'd pass it along for anyone who is interested. Add the following to your vimrc and you can use tab to auto-complete words while still preserving it as a tab insert where most appropriate (whenever your cursor is not over a word).<p>Anyone care to share their favorite vim tips?<p>function InsertTabWrapper()<p><pre><code>    let col = col('.') - 1 

    if !col || getline('.')[col - 1] !~ '\k'

        return "\&#60;tab&#62;"

    else

        return "\&#60;c-p&#62;"

    endif
</code></pre>
endfunction<p>inoremap &#60;tab&#62; &#60;c-r&#62;=InsertTabWrapper()&#60;CR&#62;
======
graywh
I'm sure the best Vim users on HN could fill pages and pages with "favorite
tips". Seems like I learn something new and/or cool about Vim every week.

