Sunday, January 1, 2023

Re: Simple Vim questions -- Backspace + Escape in maps

On Sat, 31 Dec 2022 09:11:04 -0800 (PST)
"bertran...@gmail.com" <bertrand.meyer@gmail.com> wrote:
> 1. Backspace in insert mode, over some characters, gives a special
> character instead of erasing. I remember that this was a feature, not a bug
> – a way to type special characters when they were troublesome to produce
> otherwise. I don't need that facility, which is very annoying; I just want
> backspace to erase. What should I do? My settings file (_vimrc) currently
> has
>
> set bs=2

I have never heard of this feature. Maybe you can try reading ':h bs'
and ':h :fixdel'.

> 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'.

--
Enan
3nan.ajmain@gmail.com
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230101195648.00000bc7%40gmail.com.

No comments:

Post a Comment