Skip to content

Instantly share code, notes, and snippets.

View manasthakur's full-sized avatar

Manas Thakur manasthakur

View GitHub Profile
@romainl
romainl / gist:9970697
Last active March 21, 2024 09:00
How to use Tim Pope's Pathogen

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.

@romainl
romainl / gist:1f93db9dc976ba851bbb
Last active March 13, 2024 23:15
Vim: available key pairs in normal mode…

Vim: available key pairs in normal mode

All lowercase

The operators c, d, and y expect a motion, like w, e, etc. The second character in the following pairs is not a motion so it is a NOP and nothing is overridden if we use them in mappings.

cd cm co cp cq cr cs cu cx cy cz

dc dm dq dr ds du dx dy dz
@romainl
romainl / Vim_pushing_built-in_features_beyond_their_limits.markdown
Last active September 19, 2023 08:16
Vim: pushing built-in features beyond their limits

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 lose context very quickly,
  • when we need to compare the matches.
@lwakefield
lwakefield / tabcomplete.vim
Last active January 23, 2018 21:12
tabcomplete
inoremap <expr> <tab> pumvisible() ? '<c-n>' : '<tab>'
inoremap <expr> <s-tab> pumvisible() ? '<c-p>' : '<tab>'
augroup autocomplete
autocmd!
autocmd TextChangedI * call TypeComplete()
augroup end
fun! TypeComplete()
if getline('.')[col('.') - 2] =~ '\K' && getline('.')[col('.') - 1] !~ '\K'
call feedkeys("\<c-n>")
end
@vcavallo
vcavallo / github_repo_from_cli.md
Last active January 8, 2017 06:06
Create a GitHub repo from the CLI (plus bash function)

Create GitHub repo without leaving the command line

curl -u 'USER' https://api.github.com/user/repos -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@github.com:USER/REPO.git

git push origin master