7 ms·
For those out there trying to "learn" vim, give neovim 0.5 a try! I've been using neovim HEAD (0.5 pre-release) for a while and it has been awesome. It all sta
by _benj 5y ago
For those out there trying to "learn" vim, give neovim 0.5 a try!
I've been using neovim HEAD (0.5 pre-release) for a while and it has been awesome. It all started with this config [0] and from there and haven't tried (as before) to join a vim cult but instead to use it as a tool that works for me (i.e. use mouse scroll to browse around, use arrows on insert mode, and other vim sins)
Little by little I've been looking at how I could do something a little better and pretty much every time vim has an awesome way for me to do something! Yanked some text then deleted something but I want to paste the yanked text, not the deleted one? "0p is the answer. Need to replace all ___ but not modify the prefixed numbers? I can use visual regex to easily work that out! I'm doing something over and over? I can make that into a macro! There's a macro that I always use on certain file types? I can make an autocmd to load some string to some macro when I open certain file.
It'a awesome feeling that time I've actually learning about registers, macros, regex, windows, buffers, and everything else in a modern and snappy tool!
[0] https://github.com/mjlbach/defaults.nvim https://github.com/mjlbach/defaults.nvim
- maddyboo 5y agoWow, I’ve been a vim user for like 8+ years and didn’t know about 0p even though I run into that problem all the time. I had even re-bound yank/paste to use a different register. Thanks for the pointer! This is what I love about vim, there’s always something new to learn.
- linsomniac 5y agoLunarVim has a "show b̶u̶f̶f̶e̶r̶s̶ registers" plugin enabled so when you type " it brings up a window showing the contents of various buffers, so you can eyeball it rather than remembering.
- maddyboo 5y agoOh, just realized I misread the original comment. I ignored the “, so I thought they were saying you could just use 0p (on my phone, otherwise would’ve tested it in vim). I use registers often but I admit I haven’t memorized the meaning of the auto-populated ones like 0.
- leephillips 5y agoI guess you mean registers. You can see a list of them in default Vim using the command :reg.
- Graziano_M 5y agohttps://github.com/junegunn/vim-peekaboo https://github.com/junegunn/vim-peekaboo
- maddyboo 5y agowhich-key.nvim too, plus more features. Really useful for remembering/learning new plugin mappings. https://github.com/folke/which-key.nvim https://github.com/folke/which-key.nvim
- Lio 5y agoTo be perfectly honest I'm regularly surprised by techniques I don't know using plain old vi let alone Vim/NeoVim. That's still useful for situations where you only have say busybox vi. I'm sure it's very well known but the "greatest stack overflow answer of all time" is an example[1] (IMHO obviously :D ) Vim Golf (also well known) is another invaluable and surprising resource[2]. 1. https://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118 https://stackoverflow.com/questions/1218390/what-is-your-mos... 2. http://www.vimgolf.com/ http://www.vimgolf.com/
- wolverine876 5y agoTo clarify for people unfamiliar, all of that is common to Vim and Neovim except maybe visual regex - what is that?
- _benj 5y agoTbh, that’s how I call it but it’s just having incremental search enabled. That will highlight search/replace matches and the using s/<thing to search for>/<thing to replace it with> That allows me to see what my regex matches. So I can start typing ^d*\. Hello and that would match any start of line digit followed by a dot and the word hello. I still have a lot to learn there but just that has been incredibly useful for me. Hope that makes sense
- wolverine876 5y agoYes, thanks. That's not what I thought you meant, but it suggests a great idea: Something that gives visual feedback as you construct regexes. I'm not sure that incremental search isn't sufficient, however.
- sagarm 5y agoThat's exactly what NeoVIM supports: you get a live preview of searches and replaces. The behavior can be enabled with ":set inccommand=split" (preview in a separate window) or ":set inccommand=nosplit" (inline preview).
- root_axis 5y agoI always pick up great tips in these threads... 0p is the latest, thanks!