Thursday, July 13, 2017

execute "set =..."

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.

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