TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Vim tab auto-complete

4 pointsby marroneabout 17 years ago
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;

1 comment

graywhabout 17 years ago
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.