On Saturday, September 14, 2013 10:46:28 PM UTC-7, Hayaki Saito wrote:
> Hi,
> 
> 
> 
> 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 <[email protected]> のメール:
> 
> 
> 
> > Hi All,
> 
> > I've been searching on this topic for hours but couldn't find anything 
> > relevant on the internetz.
> 
> > 
> 
> > _What_:
> 
> > In VIM, map <F6> to emit/send the following Mintty terminal keycode 
> > "\e[?7727h".
> 
> > 
> 
> > _Why_:
> 
> > 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.
> 
> > 
> 
> > _How_:
> 
> > ..... 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:
> 
> > https://plus.google.com/110860299900460184325/posts/bJWrtA7Kh9C
> 
> > https://code.google.com/p/mintty/wiki/Tips#Avoiding_escape_timeout_issues_in_vim
> 
> > https://github.com/saamalik/dotvim/blob/master/init/mintty.vim
> 
> > 
> 
> > 
> 
> > -- 
> 
> > -- 
> 
> > 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 [email protected].
> 
> > For more options, visit https://groups.google.com/groups/opt_out.

Thank you Hayaki. That's exactly what I was looking for. Do you bind the new 
escape sequence like this?

noremap <Esc>O[ <Esc>
noremap! <Esc>O[ <C-c>

Also, when you abort a single letter replace: (hit ESC on a 'r' normal 
command), is there a '[' on the line above? Presumably because 'r' eats up the 
ESC but the O[ is inserts the character [ on the line above. This doesn't 
bother me a whole lot, but did you figure out a way to fix this?

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to