Questions tagged [zsh-zle]

Tag questions related to the zsh line editor, including prompts, zle widgets, and the `zle` and `bindkey` commands

ZLE is the line editor. It's the part of the shell that deals with what you type and edit. You can extend the line editor using shell functions. The functionality available is immensely powerful.

54 questions
66
votes
6 answers

List of zsh bindkey commands

Where can I find a list of zsh commands that I can use with bindkey, with descriptions? Each time that I look for name of some standard action (e.g., end-of-line), I need to google and guess that the command found is what I look…
Jakub M.
  • 32,471
  • 48
  • 110
  • 179
43
votes
6 answers

zsh: update prompt with current time when a command is started

I have a zsh prompt I rather like: it evaluates the current time in precmd and displays that on the right side of the prompt: [Floatie:~] ^_^ cbowns% [9:28:31 on 2012-10-29] However, this isn't exactly what I want: as you can…
cbowns
  • 6,295
  • 5
  • 47
  • 64
42
votes
7 answers

Inserting a newline in a multiline zsh command pulled from history

Sometimes I use multiline commands in zsh: ❯ echo \ > a \ > multiline \ > command When editing the command after pulling it from a history search, I can change the content of individual lines. However, I can't figure out how to insert another…
Sean Mackesey
  • 10,701
  • 11
  • 40
  • 66
30
votes
10 answers

zsh new line prompt after each command

Can I configure my prompt to show a new line after each command? To give you an example. In the following screenshot I did run cat .zshrc. I want to have a new line between the last output line of the command, . ~/.zsh_aliases, and ~ $.
orschiro
  • 19,847
  • 19
  • 64
  • 95
24
votes
6 answers

Zsh zle shift selection

How to use shift to select part of the commandline (like in many text editors) ?
log0
  • 10,489
  • 4
  • 28
  • 62
24
votes
3 answers

widgets can only be called when ZLE is active

I have been dealing with this problem for almost a month now, and I feel frustrated, Any help would be greatly appreciated. I am trying to write a widget for my takenote command. The purpose of the widget is to feed all the markdown files in ~/notes…
ExistMe
  • 509
  • 6
  • 18
20
votes
3 answers

Constantly updated clock in zsh prompt?

I know that I can exec a date command in my zsh prompt. However, it shows the old time; to see the current time, I have to hit and get a new prompt with the current time. Is there a way to configure the zsh prompt to constantly update…
anon
  • 41,035
  • 53
  • 197
  • 293
18
votes
2 answers

Interpret zsh bindkey escaped sequences

I usually find interesting zsh keybinding settings (through bindkey command) around the web. My question is how do I interpret what these escaped sequences mapped to? For instance, here is a snippet from oh-my-zsh's key-bindings.zsh bindkey "^[[H"…
ejel
  • 4,135
  • 9
  • 32
  • 39
16
votes
4 answers

Multi-dot paths in zsh, like `cd ....`

All shells understand these commands: $ cd . $ cd .. And zsh will also understand: $ cd ... $ cd .... Provided you say: $ alias -g ...='../..' $ alias -g ....='../../..' Now, how can I make it do proper tab-completion when I've started typing cd…
Tarrasch
  • 10,199
  • 6
  • 41
  • 57
16
votes
1 answer

ZSH on 10.9: widgets can only be called when ZLE is active

I am new to ZSH and have been using oh-my-zsh to rum ZSH on OSX 10.9. I've been trying to take an advantage of a history plugin but I get this, "widgets can only be called when ZLE is active." when invoke any of history related commands. I've…
user1836430
  • 161
  • 1
  • 3
15
votes
4 answers

Integrate readline's kill-ring and the X11 clipboard

In my .zshrc, I use the following snippet to integrate the shell's clipboard and my primary X11 clipboard. Thanks to this integration, I can cut-and-paste text to and from emacs, firefox, and the terminal without having to use the mouse. kill-line()…
Gyom
  • 3,773
  • 5
  • 29
  • 38
13
votes
1 answer

zsh: how to get back 'unexpanded' command

Zsh has a nice feature of expanding globs. For example, hitting Tab turns ls **/*.js into ls app/assets/javascripts/application.js vendor/assets/javascripts/Markdown.Converter.js Is there a way to collapse it back to original glob version? Or…
artemave
  • 6,786
  • 7
  • 47
  • 71
10
votes
2 answers

zsh preexec command modification

Is there a way to modify the command that is about to execute? I would like to redirect the output to a file, as well as print it on the terminal. I found that ls > file.txt | cat does the job, so I would like to add that > file.txt | cat to any…
pvinis
  • 4,059
  • 5
  • 39
  • 59
7
votes
1 answer

How to print colored text below the prompt in zsh widget?

I want to create a widget bound to a hotkey that prints the current command description in rich text below the prompt, then erases it after a keypress. Like so (simplified): widget() { zle -R "ls - list files" read -k 1 } zle -N widget bindkey…
Poma
  • 8,174
  • 18
  • 82
  • 144
7
votes
1 answer

zsh: refresh prompt after running zle widget

I have the following widget defined function cdd() { cd / } zle -N cdd{,} bindkey "^R" cdd After pressing the key combination the cwd is already changed, but the terminal prompt is not updated. Example, after doing this () ~/tmp/todelete$ | #…
doraemon
  • 2,296
  • 1
  • 17
  • 36
1
2 3 4