recover use of some terminal keys for vim

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

recover use of some terminal keys for vim

Bee-9

recover use of some terminal keys for vim

The terminal apps I use:
   MacOS 10.4.11 -- Terminal.app
   Linux         -- rxvt
intercept some control keys, such as:

0x03  ^C  intr
0x0F  ^O  discard ("flush" on Linux)
0x11  ^Q  start
0x13  ^S  stop
0x1A  ^Z  susp    (%% to resume)
0x1C  ^\  quit

Those keys can be made useful to vim by changing stty.

Read about stty:
man stty

To list stty options:
stty -a

Either the two character sequence "^-" or the string "undef" may be  
used to disable the functions.



Terminal.app on MacOS 10.4.11

alias _stty='stty discard ^- intr ^- quit ^- start ^- stop ^- susp ^-'



rxvt on Linux

alias _stty='stty flush ^- intr ^- quit ^- start ^- stop ^- susp ^-'

--
Bill Muench
Santa Cruz, California


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: recover use of some terminal keys for vim

Ben Schmidt

> recover use of some terminal keys for vim
>
> The terminal apps I use:
>    MacOS 10.4.11 -- Terminal.app
>    Linux         -- rxvt
> intercept some control keys, such as:
>
> 0x03  ^C  intr
> 0x0F  ^O  discard ("flush" on Linux)
> 0x11  ^Q  start
> 0x13  ^S  stop
> 0x1A  ^Z  susp    (%% to resume)
> 0x1C  ^\  quit

I never had any problems except with ^Q and ^S and fixed it by just doing

stty -ixon
vim
stty ixon

^C, ^Z and ^\ all send signals, but Vim catches them and handles them
properly anyway in my experience.

I have this little function in my .bashrc to do it automatically for vim:

vim() {
        if [ -t 0 ] ; then stty -ixon ; fi
        command vim "$@"
        if [ -t 0 ] ; then stty ixon ; fi
}

I'm mostly on Mac OS X 10.4.11.

Ben.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: recover use of some terminal keys for vim

Matt Wozniski-2

On 3/11/09, Ben Schmidt wrote:

>
>  > recover use of some terminal keys for vim
>  >
>  > The terminal apps I use:
>  >    MacOS 10.4.11 -- Terminal.app
>  >    Linux         -- rxvt
>  > intercept some control keys, such as:
>
> I never had any problems except with ^Q and ^S and fixed it by just doing
>
>  stty -ixon
>  vim
>  stty ixon

Yeah, this is the only one that needs to be done.  I personally just
throw "stty -ixon" into my shell rc file, because I find flow control
useless all the time.

>  ^C, ^Z and ^\ all send signals, but Vim catches them and handles them
>  properly anyway in my experience.

They send signals in "cooked" mode, but since Vim puts the terminal
into "raw" mode, it just reads them as regular-old characters.  Flow
control isn't disabled in raw mode, but all the other mentioned things
are.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: recover use of some terminal keys for vim

Bee-9
In reply to this post by Bee-9


On Mar 12, 2009, at 2:58 AM, Ben Schmidt wrote:

>> recover use of some terminal keys for vim
>>
>> The terminal apps I use:
>>    MacOS 10.4.11 -- Terminal.app
>>    Linux         -- rxvt
>> intercept some control keys, such as:
>>
>> 0x03  ^C  intr
>> 0x0F  ^O  discard ("flush" on Linux)
>> 0x11  ^Q  start
>> 0x13  ^S  stop
>> 0x1A  ^Z  susp    (%% to resume)
>> 0x1C  ^\  quit
>
> I never had any problems except with ^Q and ^S and fixed it by just  
> doing
>
> stty -ixon
> vim
> stty ixon
>
> ^C, ^Z and ^\ all send signals, but Vim catches them and handles them
> properly anyway in my experience.
>
> I have this little function in my .bashrc to do it automatically  
> for vim:
>
> vim() {
> if [ -t 0 ] ; then stty -ixon ; fi
> command vim "$@"
> if [ -t 0 ] ; then stty ixon ; fi
> }
>
> I'm mostly on Mac OS X 10.4.11.

You are correct, only ^Q and ^S for vim, my mistake, I copied a  
myself about another app that does not catch the other keys.

Thank you for the vim() function, it works great.
I will adapt it for the other app.
--
Bill


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---