Skip to content

Commit eb19f89

Browse files
committed
feat(zsh): disable removing space when putting pipe operator just after completion
1 parent 13c3a92 commit eb19f89

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

zsh/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
4343
# Load plugins
4444
source "${./ghq.plugin.sh}"
45+
source "${./disable-space-removal.plugin.sh}"
4546
source "${./local_history.plugin.zsh}"
4647
# source "$${pkgs.asdf-vm}/etc/profile.d/asdf-prepare.sh"
4748
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
insert-bar() {
2+
# when just after completion
3+
if [[ $LASTWIDGET == (expand-or-complete|complete-word|menu-complete|expand-or-complete-prefix|_main_complete) ]]; then
4+
# disable removing the last space in the completion
5+
LBUFFER="$LBUFFER|"
6+
else
7+
zle self-insert
8+
fi
9+
}
10+
11+
zle -N insert-bar
12+
bindkey '|' insert-bar

0 commit comments

Comments
 (0)