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 [zsh]

Zsh is a shell with many advanced command-line and scripting features.

5
votes
0answers
344 views

How to capture the xtrace output (only) in a file?

I know that I can redirect the xtrace output to some_file with something like this: exec 2 >> some_file set +x ...but this sends to some_file not only the xtrace output, but also any other ...
4
votes
0answers
44 views

Case insensitve tab completion zsh without increasing startup time significantly

So I wanted to get away from oh-my-zsh because it made my shell startup lag noticeably (>0.1s). Indeed, after removing oh-my-zsh the startup time went to 0.02s but now I started adding features ...
4
votes
0answers
101 views

zsh keybinding: ignore given command in insert-last-word

In zsh, I have alt+. bound to insert-last-word. When I press alt+., I can list through the last word of previous commands. How can I exclude some words from being shown when I cycle through ? ie, ...
4
votes
0answers
177 views

How to teach zsh when not do autocorrect?

I love the autocorrection feature of ZSH, but sometimes it gets in the way: If I have a cli directory, it will be suggested when I try to run npm run ci. When running the Docker command docker run -...
4
votes
0answers
216 views

ZSH custom completion from command output

I am creating a custom completion for my command ipadd which will automatically complete all the network devices for OS X. It has a parameter --device which allows you to specify the network devices ...
4
votes
0answers
106 views

How do I wrap the zsh completion list with a fixed line of text before and after?

Specifically, I'd like to arrange for all completion lists (under the :completion:* context) to be preceded and followed by a fixed string (say "ABC" for the moment) on its own line. I have tried a ...
4
votes
0answers
52 views

How do I write a custom filename completer for specific directories in zsh?

I've found that file names with dates before the title are difficult to tab-completion. I'd like to write custom completion functions for these directories. How do I specify that the completer should ...
4
votes
0answers
110 views

Manual tab completions in zsh

I would like nm[TAB] to expand to node_modules in zsh. Is this possible? How can it be done? Ideally, it wouldn't be triggered if there is another completion available, such as an already existing nm ...
3
votes
0answers
62 views

XFCE - Blank text in terminal

I've just performed a fresh install of Arch Linux on my laptop (ThinkPad A485, though that's probably not relevant here), and installed XFCE4. Everything seems to be working with the exception of one ...
3
votes
0answers
59 views

Why does a failed filename generation make zsh stop processing a script?

I was trying to write a short script which would write all the executable programs found in $PATH: for dir in $(tr ':' ' ' <<<"${PATH}"); do for pgm in $dir/*; do if command -v "${pgm}"...
3
votes
0answers
139 views

Use colon as filename separator in zsh tab completion

I have many programs which take filename arguments as one(or more) of path/to/file scp:path/to/file.ext ark:/abs/path/to/file.ext Is it possible make zsh complete filenames after some keywords ...
3
votes
0answers
37 views

How to customize the look of currently selected(highlighted) completion in zsh?

Main question I would like to add powerline characters at the start and at the end of the selected completion, like this: Started the completion menu by inserting c and pressing the TAB key. Moved ...
3
votes
0answers
964 views

Powerline Fonts for zsh in TTY

I'm using UBUNTU 16.04. In graphical terminals like "Terminal" "guake" and "terminator" I am using zsh with Powerline-Fonts. I looked around a bit but found no proper solution to activate powerline ...
3
votes
0answers
77 views

How to control mysql with zpty?

I try to write a wrapper script for the mysql console client. While working on this, I stumbled upon zpty. It seems perfect. My first goal was to retrieve some table contents, but I already fail ...
3
votes
0answers
28 views

Testing that disk is parked

I run a command in zsh's preexec(), i.e. before every other command entered and accepted for run. Would like to skip doing this when I detect that the disk of current $PWD is parked. Can I do proper ...
3
votes
0answers
292 views

custom zsh autocomplete

I'd like to write a zsh completion for pytest. Where do I Start? I'm using oh-my-zsh. in .zshrc: fpath=($HOME/.mycompletions $fpath) autoload -U compinit && compinit -u in $HOME/....
3
votes
0answers
310 views

Call vared and complete files from a different directory

I have the following zsh function which lets me edit symbolic links using the vared ZLE builtin. function lned { emulate zsh setopt err_return extended_glob local_options local_traps local -a ...
3
votes
0answers
114 views

ZSH and completion of files with newline characters

I am experimenting with ZSH on nasty file names, especially file names with the newline character in it. Here is how I create them: $ touch "filename<hit return here> 1" $ touch "filename<...
3
votes
0answers
322 views

Git completions for aliases only available after running `git reflog`

I have a few aliases that I want to autocomplete for git, e.g., the following alias gco="git checkout" When I was attempting to add completions for this alias, I looked around in my path and saw ...
2
votes
0answers
38 views

Small delay in sudo

I want my zsh prompt to display whether the session has sudo rights (from a previously run sudo command). After looking at the answers to this question, I arranged to use the exit status of sudo -n ...
2
votes
0answers
86 views

How to make zsh pass the manual section to the man command when the `separate-sections` style is set?

When asking for a completion by pressing Tab on the zsh command line, the matches can be grouped according to their tag provided that the group-name style is set to an empty string: autoload -Uz ...
2
votes
0answers
142 views

Text gets messed up in history search(ctrl-r)

I using zsh. However, the command search history feature(ctrl-r) is giving me issues. Specifically, the text gets garbled. Everything executes correctly regardless, but UX it's a bad experience. ...
2
votes
0answers
85 views

Debian multi-line prompt in konsole

Sorry if I am wrong here, but I have no idea where to search for my problem. I accidentally upgraded my Debian system to stretch (stable). Since I did so, the konsole isn't working properly anymore. ...
2
votes
0answers
209 views

zsh: SHARE_HISTORY or INC_APPEND_HISTORY breaks EXTENDED_HISTORY

I would like to both share history across terminals and keep track of elapsed time for history commands. The intuitive way seems to be to use both EXTENDED_HISTORY and SHARE_HISTORY, but this sets all ...
2
votes
0answers
76 views

zsh: use setopt AUTO_MENU conditionally, depending on $PWD

generally, I find the zshoption AUTO_MENU annoying, and I disable it in my .zshrc: setopt noautomenu However, there are some directories where I have files with long filenames, with spaces in ...
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'...
2
votes
0answers
165 views

zsh is crashing on my linux environment, looking for debug tips

I use tmux and my shell is zsh with a variety of Oh-my-zsh customization. Lately I have started to experience the terminal abruptly closing when finishing executing a program such as git log showing ...
2
votes
0answers
218 views

“gnome-terminal -e tmux ./” keeps opening terminals forever

I recently asked this question. I won't ever use the first method. gnome-terminal -e tmux ./ if I put that in .zshrc or .bashrc (both shells, same problem). If I use that, the terminal will keep ...
2
votes
0answers
226 views

how to scroll multiple lines in zsh screen completion

Thanks to this question, I was able to configure zsh to properly scroll one line up or down when hitting "pgup/pgdwn" in a autocompletion menu: bindkey "${terminfo[kpp]}" up-line-or-history bindkey "$...
2
votes
0answers
296 views

What does ttyctl -f do, and why does it enable flow control in vim, mutt, etc.?

Background I have the following two lines in ~/.zshrc. setopt noflowcontrol ttyctl -f The first line disables flow control in zsh. I'm unsure what the second does, but I was advised to add it from ...
2
votes
0answers
174 views

Autocomplete flags after a subcommand

There is a program I have called luarocks that features a list of subcommands like build, install, and make, with flags after them. At the end, a command would like like the following: # luarocks ...
2
votes
0answers
135 views

Is there a plugin or tool for multiple “profiles” in ZSH?

I use oh-my-zsh for all of my console goodness. Depending on what I'm working on, there are certain environment variables that I'm often overwriting either manually or through scripts to make my work ...
2
votes
0answers
454 views

zsh completion by history not working

I read the answer https://stackoverflow.com/a/13614816/4126652 and tried out the history-beginning-search-menu I added the the 3 lines to my zshrc autoload -Uz history-beginning-search-menu zle -N ...
2
votes
0answers
40 views

How did I get the git commits to show up in autocomplete?

Git tab completion on my mac: Git tab completion on my Ubuntu server: On my mac and my Ubuntu server I get very different output from tab completion despite having the same version of zsh, same ...
2
votes
0answers
129 views

Can I prevent zsh slowing with a large history?

I've just migrated from bash to zsh. I converted ~/.bash_history for use in zsh. It's 150 000 lines long. bash is almost instantaneous to start up, but zsh is now fairly slow, taking half a second to ...
2
votes
0answers
380 views

How to view current settings for all options?

I know that setopt with arguments will show the options that are set to values different from the default; e.g. % setopt interactive login monitor norcs shinstdin zle If you have memorized all the ...
2
votes
0answers
876 views

Byobu - New window with same ssh session?

Is there a way to configure Byobu to use same ssh session in a new window. For e.g. Open Byobu window ssh into a remote host Press 'F2' to open a new window. This opens the terminal with my ...
2
votes
0answers
939 views

Making zsh filename completion case-insensitive everywhere

I have the following line in my zshrc to make filename completions case-insensitive: zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' This works most of the time but I’ve noticed that if I ...
2
votes
0answers
286 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 -...
2
votes
0answers
936 views

Powerline bash prompt not colorized in tmux

The bash/zsh commandline prompt is not displaying colors in tmux, even though I managed to get the powerline itself working (with colors). The prompt works fine in pure bash/zsh. I am getting the ...
2
votes
0answers
440 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 ...
2
votes
0answers
708 views

zsh/Prezto: difficulties with right prompt alignment

This may be stupidly simple, but... I am trying to make my own prompt for Prezto. I have been using numerous prompts for reference (I can post a list if necessary). My RPROMPT and cursor are refusing ...
2
votes
0answers
235 views

Corrupt files after extracting with Cygwin's GNU tar

I have a bunch of tarball backups which I just restored onto my new Windows 8.1 + Cygwin system using GNU tar: zsh$ for file in **/*.tgz; do tar xvzf $file; done To my surprise a lot of these ...
2
votes
0answers
254 views

zsh: Echoing every statement?

I have an odd problem with zsh when I switch between shells in a particular way: Option 1 (works well): I start a zsh shell. I switch to tcsh with /bin/tcsh, and I switch back to zsh with /bin/zsh ...
2
votes
0answers
45 views

Make zkbd ignore $DISPLAY

Is it possible to make zkbd ignore $DISPLAY variable? I have set up when I log in to different X sessions and it is annoying if suddenly I need to reenter/copy configuration (and I have no idea why $...
1
vote
0answers
13 views

How do I enable listing of zsh commands as you type

on one of my machines while setting up zsh I seem to have accidentally enabled a pretty useful feature. when I search through command history it actually lists all the matching commands as I type. How ...
1
vote
0answers
14 views

can zsh autocomplete to its autosuggestion?

When I type ssh, it auto suggest to the last host I've ssh'd into. ssh <AUTOSUGGESTED HOST> Is there a way so that when I type "tab" it just autocompletes to the autosuggested option?
1
vote
0answers
15 views

How to setup a git contrib script with zplug?

I want to add auto-installation of diff-highlight thanks to zsh zplug: zplug "git/git", as:command, use:"contrib/diff-highlight/diff-highlight" \ hook-build:"cd contrib/diff-highlight && ...
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 ...
1
vote
0answers
26 views

How can I disable vcs_info for a specific repository?

I enabled vcs_info like so: autoload -Uz vcs_info zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' formats '(%b)' set_prompt() { vcs_info print -n "[%~]${vcs_info_msg_0_}%# " # ...