how to CTRL-A in a script

10 views
Skip to first unread message

tooth pik

unread,
Mar 31, 2023, 10:35:02 PM3/31/23
to vim...@googlegroups.com
i know this is a stupid question and i'll slap my forehead and say i KNEW that when i find out, but...

a very useful feature of vim is the ability to hit CTRL-A in normal mode to increment whatever number is nearby by one -- but if i want to do the same thing in a script, normal CTRL-A is not the way

what is?

thx in advance,

toothpik

Salman Halim

unread,
Mar 31, 2023, 10:40:53 PM3/31/23
to Vim Users
Try :execute "normal \<c-a>"

Otherwise, you'd have to embed an actual ctrl-A in your script by typing ctrl-v ctrl-a, which would put a 'weird' character in your script. 

I do have a version of the normal command (that I called, creatively, Normal) that lets me just do :Normal <c-a>. If you're interested, I can find its definition (I'm typing this from my phone).

Salman

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALfSX1yKZsaTauDf6XfQ%3DG0beE8vAWGBV1MpQ5xP0tJrNEN%3Dmg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages