Timeline for How to save a macro (for quickly printing a variable)?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 2, 2022 at 20:14 | comment | added | Opifex | I got them to work. Thanks a lot Peter! You've made me a little less Vim-green! :) | |
Feb 2, 2022 at 20:05 | comment | added | Peter Rincker |
I have included the full after-directory path and have tested both ways. They do work. Please make sure you have filetype plugin indent on in your ~/.vim/vimrc . You can verify by running :filetype , it should give you filetype detection:ON plugin:ON indent:ON
|
|
Feb 2, 2022 at 20:01 | history | edited | Peter Rincker | CC BY-SA 4.0 |
full after directory path
|
Feb 2, 2022 at 16:56 | vote | accept | Opifex | ||
Feb 2, 2022 at 13:05 | comment | added | Opifex | Just one thing: the filetype specific command does not work. (I initially thought it did, but that was still the previous mapping existing) | |
Feb 2, 2022 at 10:55 | comment | added | Opifex | Nevermind that last question in comment. In most cases you will also want to be on the same indent when inserting it above the line. It's only when there's a conditional or loop that you would want to decrease the indentation, but I guess it's best to do that manually in those cases. Again, thanks a lot! I will wait the usual 24h before accepting the answer, but have an upvote in the meantime! | |
Feb 2, 2022 at 10:47 | comment | added | Opifex |
Extra question: let's say I want to make an identical command that inserts it on the line above it, instead of below it. For that I assume I need to use P instead of p at the end. But then how do I fix the indentation to not use the on of the current line, but 1 tabwidth less? Can I add an offset to ] ?
|
|
Feb 2, 2022 at 10:47 | comment | added | Opifex | Wow! Thank you so much for not only solving my problem, but also giving an in-depth explanation that even a rookie like me can understand! I wouldn't be able to create one myself yet I'm afraid, but thanks to your ELI5 explanation I think I understand what every part of the mapping does. About the indentation: My Vim already auto indents Python files, but if I exit insert mode (what my macro did, when it tried to paste) it deletes the indentation and goes back to the start of the line. | |
Feb 1, 2022 at 23:02 | history | answered | Peter Rincker | CC BY-SA 4.0 |