Hacker News new | past | comments | ask | show | jobs | submit login

Hey, sorry that I didn't really try to explain the bindings. Climb_stealth said it all really but here are some extra bits.

The first one is a normal mode binding (the n in nnoremap). yiw copies the word you are currently on (without surrounding spaces), and then <C-r>" pastes that into the :Rg command. The :Rg command is part of the fzf vim plugin and it is a wrapper around ripgrep (see the link from climb_stealth), which gives you fuzzy search over the results of a ripgrep search.

There is more detail on the <C-r>" command here:

https://vim.fandom.com/wiki/Paste_registers_in_search_or_col....

It's basically just how you paste the contents of registers into commands.

The second one is almost exactly the same except that it is a visual mode mapping (the v in vnoremap). If you highlight something with visual mode, then use that command, it will search for the highlighted text using ripgrep.

<C-Space> is just the key chord that the command is bound to. It is a pretty arbitrary personal choice, I find it a very quick and easy chord combination but you can put whatever you want in there. For example, <C-S> would activate the command when you pressed the chord 'control + s'.

There is quite a good list of keys that are unused by vim here:

https://vim.fandom.com/wiki/Unused_keys

You can pick whatever you want but I prefer not to override any of the default bindings.

Hope that helps!




Very helpful! Thank you for the great detail!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: