Skip to content

Instantly share code, notes, and snippets.

View tabcomplete.vim
inoremap <expr> <tab> pumvisible() ? '<c-n>' : '<tab>'
inoremap <expr> <s-tab> pumvisible() ? '<c-p>' : '<tab>'
augroup autocomplete
autocmd TextChangedI * call TypeComplete()
augroup end
fun! TypeComplete()
if getline('.')[col('.') - 2] =~ '\K' && getline('.')[col('.') - 1] !~ '\K'
call feedkeys("\<c-n>")
romainl / Vim_pushing_built-in_features_beyond_their_limits.markdown
Last active Dec 27, 2021
Vim: pushing built-in features beyond their limits
View Vim_pushing_built-in_features_beyond_their_limits.markdown

Vim: pushing built-in features beyond their limits

The situation

Searching can be an efficient way to navigate the current buffer.

The first search commands we learn are usually / and ?. These are seriously cool, especially with the incsearch option enabled which lets us keep typing to refine our search pattern. / and ? really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:

  • when we want to search something that's not directly there, those two commands can make us loose context very quickly,
  • when we need to compare the matches.

The Power of Vim

Today's episode: Compile/build/error check workflow. The Vim Way™


The number one plugin that everyone and their relatives installs, without a second thought, if they want to check for errors in their script/language of choice, is syntastic. In my opinion, syntastic is a completely useless plugin. "HUH WTF?! How dare you insult my favorite plugin?!" Yes, that's right. I said

romainl / gist:1f93db9dc976ba851bbb
Last active Oct 1, 2021
Vim: available lowercase key pairs in normal mode…
View gist:1f93db9dc976ba851bbb
cd cm co cp cq cr cs cu cv cx cy cz
dc dm dq dr ds du dv dx dy dz
gb gc gl gs gy
vc vd vm vo vp vq vr vs vu vv vx vy vz
yc yd ym yo yp yq yr ys yu yv yx yz
romainl / gist:9970697
Last active Nov 2, 2021
How to use Tim Pope's Pathogen
View gist:9970697

How to use Tim Pope’s Pathogen

I’ll assume you are on Linux or Mac OSX. For Windows, replace ~/.vim/ with $HOME\vimfiles\ and forward slashes with backward slashes.

The idea

Vim plugins can be single scripts or collections of specialized scripts that you are supposed to put in “standard” locations under your ~/.vim/ directory. Syntax scripts go into ~/.vim/syntax/, plugin scripts go into ~/.vim/plugin, documentation goes into ~/.vim/doc/ and so on. That design can lead to a messy config where it quickly becomes hard to manage your plugins.

This is not the place to explain the technicalities behind Pathogen but the basic concept is quite straightforward: each plugin lives in its own directory under ~/.vim/bundle/, where each directory simulates the standard structure of your ~/.vim/ directory.

vcavallo /
Last active Jan 8, 2017
Create a GitHub repo from the CLI (plus bash function)

Create GitHub repo without leaving the command line

curl -u 'USER' -d '{"name":"REPO"}'

Replace USER with your username and REPO with the intended repo name. Include all quotes above.

The do the usual:

git remote add origin
git push origin master