Questions tagged [zsh]

Zsh is a shell designed for interactive use, although it is also a powerful scripting language.

Many of the useful features of bash, ksh, and tcsh were incorporated into zsh; many original features were added.

1416 questions
124
votes
4 answers

ZSH - output whole history?

I recently switched from bash to zsh. In bash, one way (besides recursive search) that I used to find previously-run commands was history | grep whatever, where whatever is the bit of command I remember. In zsh, this isn't working. history returns…
Nathan Long
  • 26,565
61
votes
6 answers

zsh (z shell) numpad/numlock doesn't work

I just upgraded to zsh/oh-my-zsh. Almost immediately I notice on my machine that the 10-digit numpad is not working. It was working in bash and fish shell. Oddly, if I hold down the fn/function key it acts like numlock and works, but it doesn't…
57
votes
5 answers

invoke zsh, having it run a command, and then enter interactive mode instead of exiting

i'd like to start zsh similar to zsh -c 'my_prog option1 option2' but instead of exiting after running that command, leaving me at the propt of the invoked zsh (not wherever it is being called from). one particular use-case for this is in screenrc…
Autoplectic
  • 1,268
44
votes
3 answers

How can I configure the color of 'ls' directory under zsh

I am using 'zsh'. In some directory, when I do ls --color=tty. I see some directories have 'blue text' with 'green background', which makes them hard to read. Can you please tell me how to configure this?
michael
  • 5,945
42
votes
2 answers

Iterating over keys (or k/v pairs) in zsh associative array?

In zsh, I want to iterate over an associative array. I need both keys and values. But when I iterate over the associative array normally (for x in $assoc_array), I get only values. All examples I've looked at show that, given a key, you can get…
Philip
  • 1,595
38
votes
1 answer

Any way to get list of functions defined in zsh (like alias command for aliases)

I can type alias and get a list of defined aliases in zsh How can I get a list of function names defined in zsh? When I type "functions", my shell window hangs after displaying lots of functions, always ending at __rvm_checksum_none () { [[ -z…
justingordon
  • 1,613
34
votes
2 answers

Searching through history with up and down arrow in zsh

When I first switched to ZSH when I would use the up arrow key to move through history it would filter the history based on what I had already typed so if I type mysql and then up I would be stepping through recent commands that started with mysql.…
seagullJS
31
votes
4 answers

how to format the path in a zsh prompt?

I would love to have a readable colored path. For example, instead of simply using %~ to return ~/path/to/foo I would like to format it to ~$RED/$NOCOLORpath$RED/$NOCOLORto$RED/$NOCOLORfoo to highlight the path separators. Can I define the content…
27
votes
1 answer

What are the differences between oh-my-zsh and prezto?

I understand both Oh-My-Zsh and Prezto are a collection of files meant to assist setting up your zsh (Z Shell) configuration. Could someone please explain what they're doing that is different to the standard installation of Zsh and the key…
jordn
  • 273
24
votes
1 answer

What is the zsh builtin `r` command for?

I accidentally typed r into the shell and got what appeared to be a repeat of the last command I ran. man zshbuiltins, unhelpfully, says this: r - Same as fc -e -. The documentation for fc is almost impenetrable but I managed to tease out these…
Dan
  • 343
22
votes
1 answer

Better way to read a line of user input in zsh? (e.g. with zle?)

Zsh's read for some reason is echo'ing ^M's instead of accepting them as keystrokes. (If -d is set, then they are recognized as 's, but still echoed.) It also doesn't support basics like the backspace key. I can get around this by…
17
votes
2 answers

ZSH: how to call ZLE widgets directly?

The documentation says in section 18.4 Widgets, that a "widget’s job is simply to perform some small action". But I cannot find a general description how to invoke these actions, i.e. how to call a widget. I've seen in examples (for example see this…
lumbric
  • 848
16
votes
3 answers

In ZSH line editor, how to insert a new line?

Say I am editing a single line, with my cursor at the indicated position: $ abc ꕯ def ghi I would now like to split into two lines and continue editing (like hitting ENTER would do in a text editor): $ abc $ ꕯ def ghi Is there a way to do this in…
Owen
  • 835
16
votes
3 answers

Is there a zsh equivalent to the bash `help` builtin?

In bash, I can use the help command to print a synopsis for a specific builtin command $ help pwd pwd: pwd [-LP] Print the name of the current working directory. Options: -L print the value of $PWD if it names the current working …
glenn jackman
  • 26,306
13
votes
1 answer

Zsh backward-delete-word does not recognize "/" character

I want ctrl-W on Zsh to stop when it encounters the "/" character. I have the following in my .zshrc file, but it doesn't stop on "/". What is going on? default-backward-delete-word () { local WORDCHARS="*?_[]~=/&;!#$%^(){}<>" zle…
yong
  • 153
1
2 3
9 10