Thank you, this is the idiom I had wired in years ago and forgotten. I 
really appreciate your help.

-- Bertrand Meyer

On Sunday, January 1, 2023 at 5:21:57 PM UTC+1 [email protected] wrote:

> On Sun, 1 Jan 2023 19:56:48 +0600
> Enan Ajmain <[email protected]> wrote:
> > On Sat, 31 Dec 2022 09:11:04 -0800 (PST)
> > "[email protected]" <[email protected]> wrote:
> > > 2. How do I represent ESC in a macro (my name for the result of a 
> ___map___)? I
> > > want to define something like
> > >
> > > :map v iSOME TEXT<Esc>
> > >
> > > so that when I type ___v___ it will insert SOME_TEXT at the current 
> position
> > > and then escape (get out of insert mode). But I no longer know how to 
> type
> > > what appears above as <Esc> when entering the macro. I remembered 
> various
> > > incantations involving CTRL-V or CTRL-G but they do not seem to work. 
> > 
> > Which version of Vim are you using? And it _is_ Vim, not Vi, right?
> > Because in Vim, your map should work. What I will recommend is using
> > 'nnoremap' instead of 'map' because:
> > 
> > o You want "v" to be mapped only in normal mode. Otherwise you can't
> > enter "v" in insert mode without using ':h i_CTRL-V'.
> > See ':h nmap'.
> > o You don't want nested or recursive mapping. See ':h noremap'.
>
> Sorry, I misunderstood your message. You're trying to map so that it
> inserts the text "<Esc>". For that you need to add a literal 'Ctrl-V'
> character in the map. Type this exactly (here ^V is a Ctrl-V):
>
> :nnoremap v iTEXT^V^V<Esc>
>
> To clarify, you need to press Ctrl-V twice, but only one literal Ctrl-V
> will be inserted. It's quite intuitive once you know it. I am sure you
> can explain the machinery yourself. Read ':h using_CTRL-V'.
>
>
> -- 
> Enan
> [email protected]
> https://git.sr.ht/~enan/
> https://www.github.com/3N4N
>

-- 
-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/31abedb8-e734-4895-99ab-44321477510dn%40googlegroups.com.

Reply via email to