3 ms·
I've got the VSCodeVim extension installed, some other people have mentioned one that is backed by the neovim folks so maybe that one is better. imap/nmap don'
by bee_rider 4y ago
I've got the VSCodeVim extension installed, some other people have mentioned one that is backed by the neovim folks so maybe that one is better.
imap/nmap don't seem to work -- I think I'm an intermediary vim user in the sense that I don't have all the shortcuts memorized. So it can be useful to just throw together a macro to encode an idea like "change the parentheses to brackets around this variable and then go to the next search result."
I'm sure there's a built-in command for this sort of thing but I don't have it memorized, so what I'll sometimes do is just perform the transformation manually once, keep track of which keys I hit, and then nmap that to some random key.
Before, my gripe was that visual mode didn't work, but they added that (yay!).
- mcluck 4y agoYou can do equivalent configuration with the extension settings but I can see how not having imap/nmap could be annoying. However, macros work just fine. I use them all the time. Press q and then another letter to start recording a macro for that register. Press q again to stop recording. Then you can type @<letter> to replay the macro
- WorldMaker 4y agoAre you familiar with vim q macros? It's a similar thing but you don't need to use maps/remaps to use them: q<letter> to start recording and q (in normal mode, so <Esc>q sometimes) to stop recording. Then you can rerun the macro with @<letter> (or @@ is rerun the last macro). (Even fun things like <count>@<letter> work to rerun the macro a number of times.) VSCodeVim seems to support q-macros just fine. The lone silly missing bit is that VSCodeVim makes it slightly tougher to save/reuse q-macros than proper Vim [1]. In Vim those letters are the exact same "registers" as copy/paste so that you can record a macro to register 'a' with `qa…<Esc>q` and then if you want to save that macro for later you can just paste it into a document somewhere `"a` (paste register a) and pull the macro back in with the right motion and yank to the register you want (`<motion>ya`). VSCodeVim unfortunately uses separate registers for now and it is a bit more work to save/restore q-macros. [1] https://github.com/VSCodeVim/Vim/issues/1658 https://github.com/VSCodeVim/Vim/issues/1658
- bee_rider 4y agoI should get used to q macros, they are the right way to do what I like to do. Unfortunately before hearing about them I mapped qq to 'quit' and I'm afraid the muscle memory is just stuck there now.
- WorldMaker 4y agoWhen I was a novice first starting vim I was given great advice that I followed for many years: avoid custom mappings. It's tough to learn vim if you confuse its mappings. When I was an intermediate user of vim for several years I had drastically custom mappings because I thought I knew enough and knew better. I thought I had a good excuse, too: I was using a different keyboard layout and I might as well remap everything. As an aged user of vim, I can't call myself "advanced" or an "expert" user I don't think, I've returned to the wisdom of the sages: avoid custom mappings. I still need some moderate remappings for my keyboard layout but have come back around to "the less I remap, the better".