vim-macros

VIM Smart quit macro

ぃ、小莉子 提交于 2020-01-02 07:45:10
问题 From years of "finger memory" my hands know that F2 is save and F3 is quit (leftovers from years of IBM editors). Consequently my first vim key mappings were to get F2 and F3 doing what they're supposed to do. In particular for F3: :map <F3> :q<CR> :map! <ESC>:q<CR> If I quit a file that has edits I still get the E37: No write since last change (add ! to override) . What I'd prefer is more a function that would emit E37: No write since last change. Press F3 again to really quit.) How would I

VIM Smart quit macro

这一生的挚爱 提交于 2019-12-06 04:23:01
From years of "finger memory" my hands know that F2 is save and F3 is quit (leftovers from years of IBM editors). Consequently my first vim key mappings were to get F2 and F3 doing what they're supposed to do. In particular for F3: :map <F3> :q<CR> :map! <ESC>:q<CR> If I quit a file that has edits I still get the E37: No write since last change (add ! to override) . What I'd prefer is more a function that would emit E37: No write since last change. Press F3 again to really quit.) How would I code this? Updated Solution Suggestion It was pointed out to me that I could have used confirm to

In Vim, how do I apply a macro to a set of lines?

淺唱寂寞╮ 提交于 2019-11-29 18:33:31
I have a file with a bunch of lines. I have recorded a macro that performs an operation on a single line. I want to repeat that macro on all of the remaining lines in the file. Is there a quick way to do this? I tried Ctrl+Q, highlighted a set of lines, and pressed @@, but that didn't seem to do the trick. Use the normal command in Ex mode to execute the macro on multiple/all lines: Execute the macro stored in register a on lines 5 through 10. :5,10norm! @a Execute the macro stored in register a on lines 5 through the end of the file. :5,$norm! @a Execute the macro stored in register a on all

In Vim, how do I apply a macro to a set of lines?

送分小仙女□ 提交于 2019-11-28 13:10:11
问题 I have a file with a bunch of lines. I have recorded a macro that performs an operation on a single line. I want to repeat that macro on all of the remaining lines in the file. Is there a quick way to do this? I tried Ctrl+Q, highlighted a set of lines, and pressed @@, but that didn't seem to do the trick. 回答1: Use the normal command in Ex mode to execute the macro on multiple/all lines: Execute the macro stored in register a on lines 5 through 10. :5,10norm! @a Execute the macro stored in

Vim and Ctags tips and tricks [closed]

邮差的信 提交于 2019-11-26 01:43:34
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not