zsh

Unable to combine pwd with filenames in Zsh

Problem: to combine PATHs with filenames, such that I can easily source many files. I have two files A and B. ls gives their names clearly. I run pwd `ls` I get the error message too many arguments I did not find an option for pwd which would allow me to have more than one argument. How can you combine pwd's output to filenames....

Unable to have Bash-like C-x-e in Zsh

I found the following command in Bash which Zsh does not have in the same buttons at the thread. Ctrl-x-e It opens the current input in terminal to an editor. How can you have the same command in Zsh? ...

Unable to echo a-z in two columns by Zsh

I need to print the following sequence for illustration purposes in two columns a-z which has alphabets from a to z such that they are in 13-character columns. How can you echo the characters from a to z into two columns? ...

Unable to have '0700'-protected programs startable at login in Zsh

I have the following code which should put programs startable in Bash. if [ "`uname`" = "Darwin" ]; then compctl -f -x 'p[2]' -s "`/bin/ls -d1 /Applications/*/*.app /Application:/*.app | sed 's|^.*/\([^/]*\)\.app.*|\\1|;s/ /\\\\ /g'`" -- open alias run='open -a' fi However, it does not work in my Zsh at all. I ...

Unable to find a substitute command for Bash's complete in Zsh

I put the newest git-completion.bash to my .zshrc and I get /Users/Masi/bin/shells/git/git-completion.bash:2116: command not found: complete /Users/Masi/bin/shells/git/git-completion.bash:2118: command not found: complete The lines are complete -o bashdefault -o default -o nospace -F _git git 2>/dev/null \ || complete -o defaul...

how to integrate ZSH and (i)python ?

I have been in love with zsh for a long time, and more recently I have been discovering the advantages of the ipython interactive interpreter over python itself. Being able to cd, to ls, to run or to ! is indeed very handy. But now it feels weird to have such a clumsy shell when in ipython, and I wonder how I could integrate my zsh and m...

How can I create directories during a copy in Zsh?

I get the following messages often, for instance when coping dev files to a master branch cp: /Users/Masi/gitHub/shells/zsh/dvorak: No such file or directory cp: /Users/Masi/gitHub/shells/zsh/dvorak2: No such file or directory I would like to be asked about the creation of the given folders such that my initial command will be run if ...

How do I make the dock icon stop bouncing after my app wrapper script starts?

So I recently made an .app wrapper for a zsh script, but when I run it, the icon for the app keeps hopping in the Dock. The app is basically: % find Example.app -type f Example.app/Contents/Info.plist Example.app/Contents/MacOS/wrapper.sh % cat Example.app/Contents/Info.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLI...

Programming customized tab completion for zsh

Sorry if my google fu is too weak, but: I simply want to adjust zsh so that I can tab complete someappname -s using the contents (filenames) of ~/somedir For example: someapp -s f<tab> should cycle through completions based on the files starting with the letter f in ~/somedir . So I might end up with a command line like: "someapp...

To have extra info at a prompt for Git by Zsh

Torvalds seems to have the following prompt. [torvalds@g5 git]$ The first word is username. g5 seems to be a branch in Git repo, while git shows that it is a branch in Git. My current prompt PROMPT="$" How can you have a similar prompt as Torvalds'? ...

To understand Typeset for PythonPath

One recommends me the following code apparently only in .zshrc without explaining its purpose clearly. typeset -U PYTHONPATH I am interested in how you can use the code in .bashrc. My Bash goes upset about the command. How can you use the command in Bash? ...

To get a prompt which indicates Git-branch in Zsh

I run the following codes separately as my prompt unsuccessfully in .zshrc. This suggests me that apparently I do not have a program called __git_ps1. It is not in MacPorts. #1 PROMPT="$(__git_ps1 " \[\033[1;32m\] (%s)\[\033[0m\]")\$"$ #2 PROMPT="$(__git_ps1 " (%s)")\$"$ #3 # Get the name of the branch we are on git_prompt_i...

To get Git-prompt work in Zsh without a bug in a function

This question is based on the thread. I have the following Git-prompt at the moment. I get the following warning after cding to a non-Git folder. fatal: Not a git repository (or any of the parent directories): .git fatal: git diff [--no-index] takes two paths fatal: Not a git repository (or any of the parent directo...

Case-Insensitive ZSH Suffix Aliases

In my .zshrc I've set up suffix completion aliases like this so that I can open files more easily: alias -s -- txt='mate -w' Which allows me to open text files in my text editor without prepending the editor command. There is a problem, however, when I am attempting to open a file with a capitalized suffix. ZSH will recognize '.txt' ...

Altering zsh's $path variable in a script that is to be sourced

I've inherited a zsh script which sets up a bunch of environment variables for some simulations. It wants to edit the $path variable so that some perl scripts can be found: typeset -U path path=( ${SIMENV_BIN} $path ) However, when I source the script (source setup.source) the $path variable remains untouched. If I copypaste these li...

How exactly does zsh expand globs?

I have a C program that displays it's command-line by iterating through the argv variable. #include <stdio.h> int main(int argc, char *argv[]){ int i = 0; printf("----------\n"); for(i = 0; i < argc; i++) printf("%s\n", argv[i]); return 0; } I invoked the program in a folder containing a large C++ source tree lik...

To get colors to Less in Ubuntu's Zsh

How can you get similar highlightings to Zsh's Less than Bash's Less in Ubuntu? I switched from OS X to Ubuntu. My Less do not work as expected in Zsh. Manuals in my Less are green and black with or without the following code. # comment these out in Ubuntu export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking exp...

How to make zsh run as a login shell on Mac OS X (in iTerm)?

When zsh is set as a login shell on Mac OS X, when it is started by iTerm, zsh doesn't consider that it's being run as a login shell, although it's started as ‘-zsh’ (‘-’ is put as the first character of arg[0]) which is supposed to mean that it should start as a login shell. So, when I set the login shell to bash, bash recognizes this ...

Enable zsh using 8th bit as Meta without warning

In my quest to configure my shell to work exactly how I want it with respect to the alt/meta key I am having some trouble. Recently I added "bindkey -m" to my .zshrc and now whenever I start a zsh shell (ie open a terminal window) I get this error "warning: `bindkey -m' disables multibyte support". Now since I don't care much about mult...

pipe the output of a command into less or into cat depending on length

First, let me state that this is a programming question (and thus does not belong on superuser et. al.) because I'm talking shell programming. This could almost be a golf question, but I do not have an answer to begin with, so any help would be appreciated :-) So, the story is: I like to pipe stuff into less with the --quit-if-one-scree...