PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > bash history and vi mode
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

bash history and vi mode

Réponse
 
LinkBack Outils de la discussion
Vieux 01/09/2007, 17h24   #1
salty_sohal@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut bash history and vi mode

I'm starting to adjust to using bash after many years of happy korn
shell usage. I like some of the shortcuts in bash but a few things are
driving me nuts. For instance, when I set the shell to vi mode, and
then use the up arrow to get my previous command out of history, bash
seems to be immediately in insert mode. My preference would be in
command mode so I can jump around and edit the line using the vi
navigation commands my fingers know so well. Does anyone know of any
workarounds that won't break the up arrow for other commands?

Thanks,
-Jonathan

  Réponse avec citation
Vieux 02/09/2007, 16h17   #2
Martin Krischik
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bash history and vi mode

salty_sohal@yahoo.com wrote:

> I'm starting to adjust to using bash after many years of happy korn
> shell usage. I like some of the shortcuts in bash but a few things are
> driving me nuts. For instance, when I set the shell to vi mode, and
> then use the up arrow to get my previous command out of history, bash
> seems to be immediately in insert mode. My preference would be in
> command mode so I can jump around and edit the line using the vi
> navigation commands my fingers know so well. Does anyone know of any
> workarounds that won't break the up arrow for other commands?


The bash input controlls are in a file called .inputrc - see info readline
for details. But I have to say that .inputrc isn't all that easy to
understand and difficult to debug as it only read at system start-up.

I for once never liked the bash vi mode (or .inputrc for that matter) and in
the end I moved on to Z-Shell [1] which offer a far better control over the
the way insert and normal mode work. Have a look at my "vim-mode" [2] and
how the bindkey offers a vicmd and viins. If .inputrc offers anything
similar then I never found it. Also since "bindkey" is a normal command it
easier to debug.

As Z-Shell can do almost everything bash can do and a lot more i never
looked back. And since you are a former korn shell user: have a look at [3]
and search for "KSH" ;-)

Martin

[1] http://zsh.dotsrc.org/
[2] http://martin.krischik.com/index.php/Z-Shell/VimMode
[3] http://zsh.dotsrc.org/Doc/Release/zsh_15.html

--
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com
  Réponse avec citation
Vieux 03/09/2007, 17h27   #3
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bash history and vi mode

On Sun, 02 Sep 2007 17:17:07 +0200, Martin Krischik wrote:

> salty_sohal@yahoo.com wrote:
>
>> I'm starting to adjust to using bash after many years of happy korn
>> shell usage. I like some of the shortcuts in bash but a few things are
>> driving me nuts. For instance, when I set the shell to vi mode, and
>> then use the up arrow to get my previous command out of history, bash
>> seems to be immediately in insert mode. My preference would be in
>> command mode so I can jump around and edit the line using the vi
>> navigation commands my fingers know so well. Does anyone know of any
>> workarounds that won't break the up arrow for other commands?

>
> The bash input controlls are in a file called .inputrc - see info
> readline for details. But I have to say that .inputrc isn't all that
> easy to understand and difficult to debug as it only read at system
> start-up.


Actually you can tell bash to re-read its inputrc file in a number of
different ways.
1) Using the re-read-init-file function, this is bound to ctrl-x ctrl-r
in the standard emacs mode, but is not bound in vi mode.
2) Using "bind -f .inputrc".
3) Starting a new subshell, e.g.
INPUTRC=test_inputrc bash
will use test_inputrc as the configuration file.
  Réponse avec citation
Vieux 03/09/2007, 17h27   #4
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bash history and vi mode

On Sun, 02 Sep 2007 17:17:07 +0200, Martin Krischik wrote:

> salty_sohal@yahoo.com wrote:
>
>> I'm starting to adjust to using bash after many years of happy korn
>> shell usage. I like some of the shortcuts in bash but a few things are
>> driving me nuts. For instance, when I set the shell to vi mode, and
>> then use the up arrow to get my previous command out of history, bash
>> seems to be immediately in insert mode. My preference would be in
>> command mode so I can jump around and edit the line using the vi
>> navigation commands my fingers know so well. Does anyone know of any
>> workarounds that won't break the up arrow for other commands?

>
> The bash input controlls are in a file called .inputrc - see info
> readline for details. But I have to say that .inputrc isn't all that
> easy to understand and difficult to debug as it only read at system
> start-up.


Actually you can tell bash to re-read its inputrc file in a number of
different ways.
1) Using the re-read-init-file function, this is bound to ctrl-x ctrl-r
in the standard emacs mode, but is not bound in vi mode.
2) Using "bind -f .inputrc".
3) Starting a new subshell, e.g.
INPUTRC=test_inputrc bash
will use test_inputrc as the configuration file.
  Réponse avec citation
Vieux 07/09/2007, 20h58   #5
William Park
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bash history and vi mode

salty_sohal@yahoo.com wrote:
> I'm starting to adjust to using bash after many years of happy korn
> shell usage. I like some of the shortcuts in bash but a few things are
> driving me nuts. For instance, when I set the shell to vi mode, and
> then use the up arrow to get my previous command out of history, bash
> seems to be immediately in insert mode. My preference would be in
> command mode so I can jump around and edit the line using the vi
> navigation commands my fingers know so well. Does anyone know of any
> workarounds that won't break the up arrow for other commands?


<Up-Arrow> works both in command mode and in insert mode. So, I suspect
that you're in insert mode to begin with.

--
William Park <opengeometry@yahoo.ca>, Toronto, Canada
BashDiff: Super Bash shell
http://freshmeat.net/projects/bashdiff/
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 21h03.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14526 seconds with 13 queries