Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [zle]

The tag has no usage guidance.

1
vote
0answers
16 views

Is there any way to change $? from a zle widget?

I have a widget for mapping ^Z to fg: function ctrlz() { [[ $(jobs | wc -l) > 0 ]] && { zle -I fg } } However, since widgets can't change $?, the exit status of ...
2
votes
2answers
131 views

Alt + . (dot) shows &, instead of a previous argument

I (ab)use Alt + . to recover the last argument in a previous command (I'm using ZSH): for example, $ convert img.png img.pdf $ llpp (alt + .) # which produces llpp img.pdf but sometimes I review a ...
2
votes
1answer
50 views

zsh: populate search input with existing line contents when ^R is pressed?

Given .zshrc config: bindkey -v bindkey "^R" history-incremental-pattern-search-backward When I type foo<^R>bar at an empty prompt, it searches for the most recent command matching bar. How ...
3
votes
4answers
147 views

Zsh refer to last element of current argument list and expand it

Suppose I do something like: ln a_file_with_a_long_filename.pdf ~/path/to/a/new/hardlink/a_file_with_a_long_filename_slightly_modified.pdf Is there a way to refer to and expand ...
1
vote
1answer
89 views

How to bind a keyboard shortcut in zsh to a program requiring stdin?

This is a follow-up to this question: I'm trying to create a keyboard shortcut for the terminal file manager ranger, in order to jump from the zsh prompt into the file manager with a single keystroke. ...
0
votes
0answers
65 views

Avoid terminal scroll issue when using zle reset-prompt

I use TMOUT=10 - 10s to update time in prompt so it caused scroll always go back to current prompt. For i.e: If I scroll back serverl pages of output then 10s later, zsh scroll down when prompt was ...
1
vote
1answer
44 views

Entering . (dot) cancels zsh incremental history search

History Search Ctrl+R in my zsh cancels if I enter the dot . character. If I hit Ctrl+R the bck-i-search: prompt appears and the history is searched according to the words I enter. But as soon as I ...
1
vote
2answers
375 views

Using putty, Left and Right keys move cursor one word, instead of one char

I have looked for a solution to this OhMyZSH! problem for a few days now, but can't find a solution. Admittedly, I do not understand how zle really works, same for bindkey. Same goes for the way ...
2
votes
1answer
721 views

ZLE: Key bindings codes list

I know that in bindkey '\ep' autosuggest-accept-suggested-small-word the \e refers to the ⎇ Alt key. I also know that C- refers to the ⎈ Ctrl key. Is there a list referencing ...
0
votes
2answers
214 views

Why isn't zsh autocomplete using history behaving consistently from login to login?

After adding the following lines to my .zshrc: autoload -U up-line-or-beginning-search autoload -U down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-...
2
votes
1answer
468 views

zsh: Where is the `key` -> `terminfo` dictionary defined

I'm learning zsh at the moment, and configuring my ~/.zshrc. On the Archwiki, I found a snippet to change the history searching behavior: autoload -Uz up-line-or-beginning-search down-line-or-...
2
votes
0answers
77 views

How to repeat a zle widget an arbitrary number of times when the completion menu is open?

I'm using the zsh shell, and I'm trying to install a few key bindings to use keys similar to the ones I would use in a Vim buffer, when a completion menu is open. So, inside the menuselect keymap I'...
4
votes
1answer
861 views

Bindkey to execute command (Zsh)

In bash one can do the following: bind -x '"\C-l":ls' to map Ctrl+L to external (ie. system's rather than readline function) ls command to list directory contents. How to do the same in zsh, and ...
4
votes
1answer
221 views

How can I find the zsh function associated with a zle widget?

I'm messing around with the accept-line widget and not getting the results I want. I want to inspect (and log) what is happening to accept-line by finding the underlying zsh function. My ...
3
votes
5answers
296 views

How to repeat currently typed in parameter in zsh?

Sometimes we just need to type a slightly different name when using mv/cp/convert. For example, convert IMG-long-number.jpg IMG-long-number.png How can I repeat IMG-long-number.jpg before typing ...
3
votes
1answer
371 views

Zsh clear command line from zsh/sched call

I try the following: clear-cmdline() { zle && zle kill-buffer sched +3 clear-cmdline } sched +3 clear-cmdline After I run this code, I enter a few letters at prompt, and wait. ...
4
votes
1answer
441 views

Backspace in zsh stuck

In set -o vi mode in bash, when I press Esc+k to get the last entered command, and then A, I end up in the insert mode, which allows me to press backspace to start deleting the end of the last command....
3
votes
1answer
96 views

Write warning while typing in zsh prompt

I know that it is possible to display text "outside" of the zsh prompt where you are typing. Common example is completions: myhost Wed 8 10:06 ~/sandlot $ e .py█ Press Tab, et voilá: myhost Wed 8 ...
1
vote
2answers
267 views

zle read first word in line?

Let us say: % ls ./ _ when foo is called, where _ is the cursor position. foo(){ echo $COMMAND } zle -N foo How can COMMAND be set such that foo will write out the 'command' (as in, the first ...
3
votes
2answers
987 views

Move to the previous line of a multi-line command

When editing multi-line commands, with escaped newlines, I cannot move up lines. For example, suppose I enter echo \ one one line, then I press Enter, and then I want to edit the echo \ part of the ...
1
vote
1answer
241 views

Why are some ZLE sequences being remapped to “self-insert”?

I've been tinkering with my dotfiles lately, and at some point I lost use of the default ^A and ^K keymappings, which I use frequently. bindkey -L | grep '\^[AK] # bindkey -R "^A"-"^C" self-insert # ...
9
votes
2answers
2k views

How to configure Ctrl+w as delete word in zsh

I want to delete a word by Ctrl+W in zsh like. vim /foo/bar^W vim /foo/ And found a solution for bash, but bind is not in zsh function. Is it possible to configure ctrl-w (delete word)? How can I ...
2
votes
0answers
285 views

Why does select-word-style stop me from using backward-kill-word for leading whitespace?

If I have just some whitespace at be beginning of my zsh prompt, I can usually ^W (backward-kill-word) it away. However, as soon as I load select-word-style - even if I don't select any special style -...
1
vote
1answer
350 views

Key to comment out the current line and keep editing it in zsh

On Bash I was using ESC # after Ctrl+R to prefix a # to the found line and keep it in the terminal, something similar for zsh?
2
votes
0answers
439 views

How can you get the current terminal line (the one that is still editable by the user)?

I need a way to use the current line which the users typed into as variable for a shell function. my current code, which can be called by ctrl+r zle -N search bindkey "^R" search search () { read ...
6
votes
1answer
174 views

How can I get back into “normal” edit-mode after pressing esc in zsh (vi mode)?

I'm using zsh in vi-mode. When I go to normal mode with ESC and then back into insert mode (for example using i, a or s), the line editor kind of "protects" the part of the line in front of the char, ...
6
votes
1answer
807 views

How can I configure ZSH's vi mode to persist the state between commands?

I am aware how to set ZSH's default line editor to use vi-like keybindings... bindkeys -v ...and even to default each new prompt to be in command mode instead of insert mod by default... zle-line-...