Re: [gentoo-user] Change Readline mode for all users?

2017-09-20 Thread Stroller

> On 19 Sep 2017, at 01:30, Simon Thelen  wrote:
> 
>> I find that my pager and editor are set in /etc/env.d/99pager and
>> /etc/env.d/99editor respectively, but creating a
>> /etc/env.d/99bashlineediting file containing "set -o vi" doesn't seem
>> to work.
> Either "set-editing-mode vi" in /etc/inputrc for all readline programs
> or in /etc/bash/bashrc (for bash-only)

Oops! This spelling breaks the "m" key - for some reason it doesn't work in 
lowercase mode.

The correct comment directive is "set editing-mode vi" with a space after "set".

This is also discussed on the Vim wiki: 
http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal

Stroller.




Re: [gentoo-user] Change Readline mode for all users?

2017-09-19 Thread Simon Thelen
On 17-09-19 at 14:48, Stroller wrote:
> > On 19 Sep 2017, at 01:30, Simon Thelen  wrote:
> >> Is it possible to set this for all users, please, so that this edit
> >> mode is used for root?
> > Readline is customized by putting commands in an initialization file
> > (the inputrc file). The name of this file is taken from the value of the
> > INPUTRC environment variable.  If that variable is unset, the default is
> > ~/.inputrc. If that file  does not exist or cannot be read, the ultimate
> > default is /etc/inputrc.
> > 
> >> I find that my pager and editor are set in /etc/env.d/99pager and
> >> /etc/env.d/99editor respectively, but creating a
> >> /etc/env.d/99bashlineediting file containing "set -o vi" doesn't seem
> >> to work.
> > Either "set-editing-mode vi" in /etc/inputrc for all readline programs
> > or in /etc/bash/bashrc (for bash-only)
> I looked at /etc/inputrc, and its existing contents are of a different format.
> 
> Where all the other lines are of the form:
>   "\eOH": beginning-of-line
>   "\eOF": end-of-line
> it felt a bit wrong to be adding "set-editing-mode vi". Hence me asking here. 
> Is it foolish of me to think this?
That's just part of the inputrc, mine at least also has several settings
set at the top of the file. According to readline(3) the inputrc can
contain both key bindings and variable settings, the lines you pointed
out are the keybindings and what you wanted to add is a variable setting
(set editing-mode vi).

-- 
Simon Thelen



Re: [gentoo-user] Change Readline mode for all users?

2017-09-19 Thread Stroller

> On 19 Sep 2017, at 01:30, Simon Thelen  wrote:
>> 
>> Is it possible to set this for all users, please, so that this edit
>> mode is used for root?
> Readline is customized by putting commands in an initialization file
> (the inputrc file). The name of this file is taken from the value of the
> INPUTRC environment variable.  If that variable is unset, the default is
> ~/.inputrc. If that file  does not exist or cannot be read, the ultimate
> default is /etc/inputrc.
> 
>> I find that my pager and editor are set in /etc/env.d/99pager and
>> /etc/env.d/99editor respectively, but creating a
>> /etc/env.d/99bashlineediting file containing "set -o vi" doesn't seem
>> to work.
> Either "set-editing-mode vi" in /etc/inputrc for all readline programs
> or in /etc/bash/bashrc (for bash-only)

I looked at /etc/inputrc, and its existing contents are of a different format.

Where all the other lines are of the form:
  "\eOH": beginning-of-line
  "\eOF": end-of-line
it felt a bit wrong to be adding "set-editing-mode vi". Hence me asking here. 
Is it foolish of me to think this?

Stroller.




Re: [gentoo-user] Change Readline mode for all users?

2017-09-19 Thread Stroller

> On 19 Sep 2017, at 01:25, Vadim A. Misbakh-Soloviov  wrote:
> 
>> I find that my pager and editor are set in /etc/env.d/99pager and
>> /etc/env.d/99editor respectively, but creating a
>> /etc/env.d/99bashlineediting file containing "set -o vi" doesn't seem to
>> work.
> 
> 1) env-update
> 
> env.d is just the place where all the packages places their crap so 
> env-update 
> can take care of it and rebuild all the things properly (so, no need to allow 
> to edit system config directly (and accidentally brake them)

Sorry, I don't understand.

> 2) what you want is a bad idea.
> 
> I bet portage (which internally uses bash a lot) won't be happy with that

A setting for interactive bash use should not affect non-interactive bash 
scripts. If it does, I'd think it a bug.

Stroller.




Re: [gentoo-user] Change Readline mode for all users?

2017-09-18 Thread Simon Thelen
On 17-09-19 at 01:11, Stroller wrote:
> I prefer vi-style editing for my bash prompt - that is to say I press
> the escape key, and "b" two or three times and the cursor moves back 2
> or 3 words. I can press "escape" followed by shift-I to take the
> cursor back to the very start of the line, and "v" allows me to edit
> the command line in vi itself.
> 
> I enable this in my .bashrc with "set -o vi".
> 
> I find I can set it for all Readline-based programs by putting "set
> editing-mode vi" in ~/.inputrc.
> 
> Is it possible to set this for all users, please, so that this edit
> mode is used for root?
Readline is customized by putting commands in an initialization file
(the inputrc file). The name of this file is taken from the value of the
INPUTRC environment variable.  If that variable is unset, the default is
~/.inputrc. If that file  does not exist or cannot be read, the ultimate
default is /etc/inputrc.

> I find that my pager and editor are set in /etc/env.d/99pager and
> /etc/env.d/99editor respectively, but creating a
> /etc/env.d/99bashlineediting file containing "set -o vi" doesn't seem
> to work.
Either "set-editing-mode vi" in /etc/inputrc for all readline programs
or in /etc/bash/bashrc (for bash-only)

-- 
Simon Thelen



Re: [gentoo-user] Change Readline mode for all users?

2017-09-18 Thread Vadim A. Misbakh-Soloviov
> I find that my pager and editor are set in /etc/env.d/99pager and
> /etc/env.d/99editor respectively, but creating a
> /etc/env.d/99bashlineediting file containing "set -o vi" doesn't seem to
> work.

1) env-update

env.d is just the place where all the packages places their crap so env-update 
can take care of it and rebuild all the things properly (so, no need to allow 
to edit system config directly (and accidentally brake them)

2) what you want is a bad idea.

I bet portage (which internally uses bash a lot) won't be happy with that



[gentoo-user] Change Readline mode for all users?

2017-09-18 Thread Stroller
I prefer vi-style editing for my bash prompt - that is to say I press the 
escape key, and "b" two or three times and the cursor moves back 2 or 3 words. 
I can press "escape" followed by shift-I to take the cursor back to the very 
start of the line, and "v" allows me to edit the command line in vi itself.

I enable this in my .bashrc with "set -o vi".

I find I can set it for all Readline-based programs by putting "set 
editing-mode vi" in ~/.inputrc.

Is it possible to set this for all users, please, so that this edit mode is 
used for root?

I find that my pager and editor are set in /etc/env.d/99pager and 
/etc/env.d/99editor respectively, but creating a /etc/env.d/99bashlineediting 
file containing "set -o vi" doesn't seem to work.

Any thoughts, please?

Stroller.