Saturday, August 5, 2017

Re: Map CTRL-[ to CTRL-T, is it possible

Thanks Tony.
But I'm too used to use the Esc key to get out of Insert mode.
I will have to figure out another pair of keymaps to jumo between tags.
Cheers 

2017-08-05 3:16 GMT+01:00 Tony Mechelynck <antoine.mechelynck@gmail.com>:
On Sat, Aug 5, 2017 at 4:09 AM, Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
> On Sat, Aug 5, 2017 at 1:03 AM, Pablo Giménez <pablogipi@gmail.com> wrote:
>> Hello, I would like to map CTRL-[ to do the same action as CTRL-T, or in
>> other words
>> to go back one step in the tag stack, doing a :pop command.
>> It makes a lot of sense to me to use CTRL-] to go forward and CTRL-[ to go
>> backwards
>> in the stack.
>>
>> But for vim ESC and CTRL-[ seems to be the same keystroke and when I map
>> CTRL-[
>> it also affects the ESC key, so I can't get out from insert mode using it
>> anymore.
>> Is there any way to accomplish this?
>> This is how I am mapping CTRL-[ now:
>>
>> nnoremap <silent> <C-[>   <C-T>
>> vnoremap <silent> <C-[>   <C-T>
>> inoremap <silent> <C-[>   <C-T>
>>
>> Thanks.
>> --
>> Un saludo
>> Best Regards
>> Pablo Giménez
>
> Yes, Vim inherits this ultimately from early ASCII teletypes, which
> had no separate function keys, so Esc and Ctrl-[ are both seen as
> 0x1B. Similarly Backspace and Ctrl-H, Tab and Ctrl-I, Ctrl-(any letter
> a-z) with or without Shift, etc.
>
> This can just as well be seen as a feature: if your Esc key is too far
> out of the way, you can use Ctrl-[ instead. But as you found out,
> mapping either of them applies also to the other.
>
>
> Best regards,
> Tony.

P.S. You can regain <Esc> function by mapping something else to it, e.g. with

        inoremap ² <Esc>

(assuming that, as on my keyboard, the key left of the 1 gives the
exponent-2) will let you get out of Insert mode by hitting that. Or
use for the {lhs} any key that suits your fancy and doesn't cfonflict
with something that you would use in Insert mode.

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.



--
Un saludo
Best Regards
Pablo Giménez

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