Tag Info

Hot answers tagged

3

Answering directly to your question title: Yes, there is: The prompt variables are listed in the PARAMETERS USED BY THE SHELL section of man zshparam. The prompt escape sequences are explained in the SIMPLE PROMPT ESCAPES section of man zshmisc. If you don't know in which man page you find the desired information, you can use man zshall.


3

You are correct that the substitution occurs when PATH is defined. It is simple to get around that. Define a bash/zsh function: javaswitch() { [[ "$1" =~ ^[0-9]$ ]] && export PATH=${PATH/java[0-9]/java$1}; } Now, anytime that you want to switch java versions, run: javaswitch 7 Or: javaswitch 8 To make the definition of javaswitch ...


2

When the Z shell displays the prompt it is idle and IMHO does not do any background tasks. So, the history file $HISTFILE is re-read only when rendering a new prompt. That why it is sufficient, but also necessary that you press ENTER in a terminal to re-read your history. If you you want to save this additional keystroke you can use the following zle widget ...


2

You can also use hash -d to set Static Named Directories (just like user homes): hash -d WIN_HOME='/Users/giulio/Documents/Parallels/Windows 8.pvm/Windows Disks/C' Instead of the whole path zsh will show ~WIN_HOME. You can also go to this directory by cd ~WIN_HOME. Static Named Directories are automatically created for user homes ( ~someuser points to ...


2

You can define a trap for SIGINT (triggered by CTRL-C), which will print ^C (or any other text you would like): TRAPINT() { print -n "^C" return $(( 128 + $1 )) } This example is taken from man zshmisc. The return command has the following background: Programs terminated by uncaught signals typically return the status 128 plus the signal number. ...


1

I figured that ZSH has an option called AUTO_NAME_DIRS, which tells ZSH to expand the directories like I want. I just had to setopt autonamedirs in the shell and set the env variable. and it worked :)


1

To get first completion and a listing you can add the following to bashrc bind 'set show-all-if-ambiguous on' bind 'TAB:menu-complete' show-all-if-ambiguous: This alters the default behavior of the completion functions. If set to ‘on’, words which have more than one possible completion cause the matches to be listed immediately instead of ringing ...


1

I encounter this problem a lot, too. It always involves installd, and most importantly, with installd installing/updating Apple apps, like iWork (IIRC it's iWork exclusive; at least I've yet to encounter an occurrence with a third party app). I believe it has nothing to do with iTerm2 or oh-my-zsh (although I use both, too). What I believe is that this is a ...


1

The reason this does not work is because zle -U "mc" pushes "mc" onto the input stack, it does not replace the current command buffer. What your widget actually does is: empty line put "mc" on the input stack accept the empty line After the line gets accepted, zsh pulls "mc" from the input stack and puts in the now current buffer. That is why it seems ...


1

Here are a few online references to resources regarding zsh and prompts: http://zsh.sourceforge.net/Intro/intro_14.html http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html https://wiki.archlinux.org/index.php/zsh#Prompts


1

I think this is not as straight forward as one might think. You have to intercept STDOUT, as external programs directly write to that channel. The following is kind of a proof of concept . Be aware, that this will break a lot of things, namely interactive programs like man, less etc. So it's not usable for every-day-use, but to easily format a shell session ...


1

Generally, if you run setopt xtrace in a zsh session or start zsh with zsh -x, zsh will print each command and its arguments as it is executed, including the internal ones used to set up the prompt or other hook functions. This will probably create a lot of output as oh-my-zsh may run quite a few functions just to display the prompt. It will look something ...



Only top voted, non community-wiki answers of a minimum length are eligible