jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
3.07k stars 107 forks source link

alt + . in insert mode doesn't substitute to last argument! #287

Open d9k opened 1 month ago

d9k commented 1 month ago

General information

> zvm_system_report
- Terminal program: tmux 3.2a (screen-256color)
- Operating system: Linux (5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 GNU/Linux)
- ZSH framework: none
- ZSH version: zsh 5.8.1 (x86_64-ubuntu-linux-gnu)
- ZVM version: zsh-vi-mode 0.11.0 (c69df2c, 2023-03-07 16:52:25 -0500)

Problem description

alt + . in insert mode doesn't substitute to last argument! Very inconvenient.

> ls Backup
> ls
# I press <Alt+.>
> lsls  Bac//sls`
jeffreytse commented 1 month ago

Hi @d9k

Thanks for your information. May I know if the feature alt + . is from aother third-party plugin?

Thanks & Regards

d9k commented 1 month ago

No, I think it's built-in zsh / bash feature

qadzek commented 1 week ago

Try adding this to your zshrc:

# Normal mode
function append-last-word { ((++CURSOR)); zle insert-last-word; }
zle -N append-last-word
bindkey -M vicmd '\e.' append-last-word

# Insert mode
bindkey -M viins '\e.' insert-last-word

See also https://unix.stackexchange.com/questions/685008/how-to-use-alt-in-zsh-with-vim-bindings