Thursday, July 13, 2017

Re: execute "set =..."

On Thu, Jul 13, 2017 at 6:06 PM, Lifepillar <lifepillar@lifepillar.me> wrote:
> Using Vim on macOS, I had this in my .vimrc:
>
> cmap <esc>b <s-left>
> cmap <esc>f <s-right>
>
> which allowed me to use <alt>-arrows in command mode to jump
> between words. It worked, but it caused a 'timeout' delay
> when I was pressing <esc> to exit command mode.
>
> I have recently discovered that I can do this instead:
>
> execute "set <s-left>=\eb"
> execute "set <s-right>=\ef"
> execute "cmap \eb <s-left>"
> execute "cmap \ef <s-right>"
>
> This works exactly the same, and <esc> does not cause any delay
> (I have ttimeoutlen=10 if that matters). Great!
>
> So, here are my questions:
>
> 1) What do the commands above do exactly?
> 2) Where is ":set <some-key>=" explained in the manual?
> 3) Is it possible to rewrite the commands without :execute?
> 4) Is there any drawback or side effect I should be aware of?
>
> Thanks,
> Life.

1) :set <code>=xyz tells Vim which bytes the terminal sends (or, in
some cases, expects) for that code. It can also be used for termcap
codes, and if neither of the two characters of the termcap item name
are special characters, you can dispense with the <> around it: e.g.
:set t_Co=256 to tell Vim that your present console supports 256
colours rather than the minimum 8 background and 16 foreground.
2) :help :set-termcap
3) yes
4) if your terminal sends some other set of bytes for Shift-Left
and/or Shift-Right, Vim will stop recognizing those keys when you hit
them.

Best regards,
Tony.

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment