Skip to main content
Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Notice added Draw attention by mike
Bounty Started worth 50 reputation by mike
Formatting.
Source Link

Using bash in the default (emacs) mode I get the following behavior when I hit <ESC>.Esc, ..

$ echo hello
hello
$ hello  # I hit `<ESC>.` to insert this

Note there is no space before the word hellohello that is inserted when I hit <ESC>.Esc, ..

If I switch to vi mode and configure . I do get a leading space:

$ set -o vi
$ bind -m vi-command ".":yank-last-arg
$ echo hello
hello
$  hello  # I hit `<ESC>.` to insert this. Note the leading space.

Is there any way to configure bash/readline to avoid this leading space?

Using bash in the default (emacs) mode I get the following behavior when I hit <ESC>.

$ echo hello
hello
$ hello  # I hit `<ESC>.` to insert this

Note there is no space before the word hello that is inserted when I hit <ESC>.

If I switch to vi mode and configure . I do get a leading space:

$ set -o vi
$ bind -m vi-command ".":yank-last-arg
$ echo hello
hello
$  hello  # I hit `<ESC>.` to insert this. Note the leading space.

Is there any way to configure bash/readline to avoid this leading space?

Using bash in the default (emacs) mode I get the following behavior when I hit Esc, ..

$ echo hello
hello
$ hello  # I hit `<ESC>.` to insert this

Note there is no space before the word hello that is inserted when I hit Esc, ..

If I switch to vi mode and configure . I do get a leading space:

$ set -o vi
$ bind -m vi-command ".":yank-last-arg
$ echo hello
hello
$  hello  # I hit `<ESC>.` to insert this. Note the leading space.

Is there any way to configure bash/readline to avoid this leading space?

changed vi tag to vi-mode
Link
Source Link
mike
  • 165
  • 1
  • 7

Insert the last argument in bash in vi mode without inserting a leading space

Using bash in the default (emacs) mode I get the following behavior when I hit <ESC>.

$ echo hello
hello
$ hello  # I hit `<ESC>.` to insert this

Note there is no space before the word hello that is inserted when I hit <ESC>.

If I switch to vi mode and configure . I do get a leading space:

$ set -o vi
$ bind -m vi-command ".":yank-last-arg
$ echo hello
hello
$  hello  # I hit `<ESC>.` to insert this. Note the leading space.

Is there any way to configure bash/readline to avoid this leading space?