139159Re: Emit Terminal Keycodes from within ViM
- Sep 14, 2013Hi,
I usually use app escape mode, too.
I hope this smart feature becomes widespread.
By the way, I may be able to answer your question if I don’t misunderstand it.
I always send raw sequence to the terminal by the following way.
:call writefile(["\e[?7727h"], '/dev/tty', 'b’)
This is equivalent to:
:call system(‘echo -en “\e[?7727h” > /dev/tty’)
if vim runs in tmux session, we need to call as follows,
:call writefile(["\ePtmux;\e\e[?7727h\e\\"], '/dev/tty', 'b’)
-- Hayaki Saito
2013/09/15 7:14、Saad Malik <saamalik@...> のメール：
> Hi All,--
> I've been searching on this topic for hours but couldn't find anything relevant on the internetz.
> In VIM, map <F6> to emit/send the following Mintty terminal keycode "\e[?7727h".
> Cygwin Mintty terminal has a special mode (app escape mode) when enabled emits \eO[ (instead of regular \[) on ESC key. Using this I mapped <Esc>O[ to <ESC> which immediately exits insert mode. To enable App Escape mode for mintty, the following terminal code needs to be sent "\e[?7727h". To disable the app escape mode: "\e[?7727l".
> I've set my &t_ti = "\e[?7727h" and &t_te = "\e[?7727l". This works great--as soon as I start VIM, vim emits the t_ti code to enable Mintty app escape mode. As soon as I exit, t_te emits the app escape off code.
> However, I run into a little bit of trouble when running vim inside of tmux. If I exit Vim in a window, the app escape mode OFF is sent--then switching to another running window with ViM ALREADY running causes issues since app escape mode is off and ESC key won't generate the special \eO[ code.
> I was thinking of a simple manual step to just emit App Escape Mode ON keycode (using F6) whenever I find ESC not working properly.
> ..... half-way through writing this post I realized a simple fix .... If I execute any SHELL command from within VIM (e.g: :!echo "hellooo"), Vim will run the script and then regain control. What I just realized is that when Vim regains control--it'll emit whatever is in &t_ti --which includes my App Escape Mode ON.
> Anyway, for the sake of argument is there a Vim one liner that emits terminal keycodes from INSIDE Vim (without running an external script)?
> See the following links for more info:
> 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@....
> For more options, visit https://groups.google.com/groups/opt_out.
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@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>