how to indicate current vi mode?

how to indicate current vi mode?

Post by parv » Thu, 14 Mar 2002 15:32:26



i use bash as login/interactive shell, flirting sometimes w/ zsh &
ksh93 w/ emacs key binding.  not a problem so far.  i want to be
accustomed to vi binding for "personal enrichment".

i find it frustrating when i couldn't tell if insert mode is in
effect or the command mode.  is there any way visual way -- say in
$PS1, some message when mode changes perhaps via a script, etc. --
to indicate the current vi mode?  i don't have preferences, to learn
vi key binding, among bash, ksh93, and zsh.

 - parv

--
 for private mail, delete WhereElse from the address.

 
 
 

how to indicate current vi mode?

Post by Andreas K?h? » Fri, 15 Mar 2002 06:01:37


Submitted by parv to comp.unix.shell:

Quote:> i use bash as login/interactive shell, flirting sometimes w/ zsh &
> ksh93 w/ emacs key binding.  not a problem so far.  i want to be
> accustomed to vi binding for "personal enrichment".

> i find it frustrating when i couldn't tell if insert mode is in
> effect or the command mode.  is there any way visual way -- say in
> $PS1, some message when mode changes perhaps via a script, etc. --
> to indicate the current vi mode?  i don't have preferences, to learn
> vi key binding, among bash, ksh93, and zsh.

I'm more used to ksh93.  After pressing <Esc> (twice, or
until you hear a beep), you will always be in command mode
(as oppsed to insert mode), just as in the Vi editor.  You
will need to press <Esc> twice if you just managed to press
<Ctrl>-V in insert mode.

In ksh93, you also have ${.sh.edmode}, which will be <Esc> when
the shell is in Vi-mode insert-mode.  I doubt that you can use
this variable to change your prompt though, because the prompt
is displayed just after exiting from the last command that you
executed, and just before going into insert-mode again.  Anyone
is welcome to prove me wrong, of course.

--
Andreas K?h?ri (on a slow news feed)
----------------------------------------------------------------
NetBSD: En Vax i handen ?r b?ttre ?n tio p? skroten.
        http://www.netbsd.org/

 
 
 

how to indicate current vi mode?

Post by parv » Sun, 17 Mar 2002 03:41:35



wrote Andreas K?h?ri ...

Quote:

> Submitted by parv to comp.unix.shell:

>> i find it frustrating when i couldn't tell if insert mode is in
>> effect or the command mode.  is there any way visual way -- say
>> in $PS1, some message when mode changes perhaps via a script,
>> etc. -- to indicate the current vi mode?  i don't have
>> preferences, to learn vi key binding, among bash, ksh93, and zsh.

> I'm more used to ksh93.  After pressing <Esc> (twice, or until you
> hear a beep), you will always be in command mode (as oppsed to
> insert mode), just as in the Vi editor.

i was thinking of avoiding the beep.  in bash, sometimes i have
press ESC twice or thrice (or, until i hear beep) to go from insert
mode to command mode.

Quote:> I doubt that you can use this variable to change your prompt
> though, because the prompt is displayed just after exiting from
> the last command that you executed, and just before going into
> insert-mode again.

i was thinking that perhaps ESC (or ESC,ESC) could be binded to
execute script(s) which would echo, say, "insert mode" or "command
mode".  i guess i just have to learn the vi mode w/o the training
wheels.

 - parv

--
 for private mail, delete WhereElse from the address.

 
 
 

how to indicate current vi mode?

Post by Just Another Use » Wed, 20 Mar 2002 12:22:20


You can
set "set showmode" in the ".exrc" file
OR
include "set showmode" as part of EXINIT variable

When this is done and you are in insert mode then this is indicated at the
bottom right hand of your screen.


Quote:> Submitted by parv to comp.unix.shell:
> > i use bash as login/interactive shell, flirting sometimes w/ zsh &
> > ksh93 w/ emacs key binding.  not a problem so far.  i want to be
> > accustomed to vi binding for "personal enrichment".

> > i find it frustrating when i couldn't tell if insert mode is in
> > effect or the command mode.  is there any way visual way -- say in
> > $PS1, some message when mode changes perhaps via a script, etc. --
> > to indicate the current vi mode?  i don't have preferences, to learn
> > vi key binding, among bash, ksh93, and zsh.

> I'm more used to ksh93.  After pressing <Esc> (twice, or
> until you hear a beep), you will always be in command mode
> (as oppsed to insert mode), just as in the Vi editor.  You
> will need to press <Esc> twice if you just managed to press
> <Ctrl>-V in insert mode.

> In ksh93, you also have ${.sh.edmode}, which will be <Esc> when
> the shell is in Vi-mode insert-mode.  I doubt that you can use
> this variable to change your prompt though, because the prompt
> is displayed just after exiting from the last command that you
> executed, and just before going into insert-mode again.  Anyone
> is welcome to prove me wrong, of course.

> --
> Andreas K?h?ri (on a slow news feed)
> ----------------------------------------------------------------
> NetBSD: En Vax i handen ?r b?ttre ?n tio p? skroten.
>         http://www.netbsd.org/

 
 
 

how to indicate current vi mode?

Post by Andreas K?h? » Wed, 20 Mar 2002 13:29:35


Submitted by "Just Another User" to comp.unix.shell:

Quote:> You can
> set "set showmode" in the ".exrc" file
> OR
> include "set showmode" as part of EXINIT variable

> When this is done and you are in insert mode then this is indicated at the
> bottom right hand of your screen.

Do no top-post.

Your solution is for the editor Vi, not the shell ksh as was
what "parv" wanted.



>> Submitted by parv to comp.unix.shell:
>> > i use bash as login/interactive shell, flirting sometimes w/ zsh &
>> > ksh93 w/ emacs key binding.  not a problem so far.  i want to be
>> > accustomed to vi binding for "personal enrichment".

>> > i find it frustrating when i couldn't tell if insert mode is in
>> > effect or the command mode.  is there any way visual way -- say in
>> > $PS1, some message when mode changes perhaps via a script, etc. --
>> > to indicate the current vi mode?  i don't have preferences, to learn
>> > vi key binding, among bash, ksh93, and zsh.

>> I'm more used to ksh93.  After pressing <Esc> (twice, or
>> until you hear a beep), you will always be in command mode
>> (as oppsed to insert mode), just as in the Vi editor.  You
>> will need to press <Esc> twice if you just managed to press
>> <Ctrl>-V in insert mode.

>> In ksh93, you also have ${.sh.edmode}, which will be <Esc> when
>> the shell is in Vi-mode insert-mode.  I doubt that you can use
>> this variable to change your prompt though, because the prompt
>> is displayed just after exiting from the last command that you
>> executed, and just before going into insert-mode again.  Anyone
>> is welcome to prove me wrong, of course.

>> --
>> Andreas K?h?ri (on a slow news feed)
>> ----------------------------------------------------------------
>> NetBSD: En Vax i handen ?r b?ttre ?n tio p? skroten.
>>         http://www.netbsd.org/

--
Andreas K?h?ri
----------------------------------------------------------------
NetBSD: Because you're worth it.    http://www.netbsd.org/
 
 
 

how to indicate current vi mode?

Post by parv » Wed, 20 Mar 2002 14:06:40



wrote Andreas K?h?ri ...

Quote:

> Submitted by "Just Another User" to comp.unix.shell:
>> You can
>> set "set showmode" in the ".exrc" file
>> OR
>> include "set showmode" as part of EXINIT variable

>> When this is done and you are in insert mode then this is indicated at the
>> bottom right hand of your screen.

> Do no top-post.

> Your solution is for the editor Vi, not the shell ksh as was
> what "parv" wanted.

that's what i wanted to say too.  actually, i don't have any
problems in vi(m) at all; it's just the shell editing mode.

anyway, i tried using vi editing mode in bash/ksh, but i found
myself typing more keys, most often ESC, than i would in emacs
editing mode.  fingers were getting tired ... i switched to -- dare
i say -- emacs again.

  - parv

 
 
 

how to indicate current vi mode?

Post by Andreas K?h? » Thu, 21 Mar 2002 11:34:11


Submitted by "parv" to comp.unix.shell:


> wrote Andreas K?h?ri ...

>> Submitted by "Just Another User" to comp.unix.shell:
>>> You can
>>> set "set showmode" in the ".exrc" file
>>> OR
>>> include "set showmode" as part of EXINIT variable

>>> When this is done and you are in insert mode then this is indicated at the
>>> bottom right hand of your screen.

>> Do no top-post.

>> Your solution is for the editor Vi, not the shell ksh as was
>> what "parv" wanted.

> that's what i wanted to say too.  actually, i don't have any
> problems in vi(m) at all; it's just the shell editing mode.

> anyway, i tried using vi editing mode in bash/ksh, but i found
> myself typing more keys, most often ESC, than i would in emacs
> editing mode.  fingers were getting tired ... i switched to -- dare
> i say -- emacs again.

Shame on you!  Maybe you simply need more Vi experience.  Try
setting EDITOR=vi and VISUAL=$EDITOR.

<halfjoke>
The Vi editing mode is very, very, very *ive.  Once you've
become used to it you can't use Emacs unless you start it up
in Viper mode.  Running the default bash (et al) setup becomes
a real pain (as will running *anything* with a Emacs editing
mode).  Writing e-mails in e.g. MS Outlook feels like playing
russian roulette (<Esc> cancels the current message).  You will
litter j's and k's everywhere...  Signs of a real Unix user!
</halfjoke>

--
Andreas K?h?ri
----------------------------------------------------------------
NetBSD: Because you're worth it.    http://www.veryComputer.com/