zsh

Opening a new terminal tab in OSX(Snow Leopard) with the opening terminal windows directory path

Hi all. I've been Googling for a while looking for a simple way to do this, and I can't find one. I have a custom terminal environment set up (zsh) with various aliases and functions to make things easier. One thing I keep running into is that I will quickly APPLE-t to create a new tab and then type a command relative to the path of th...

How does one override an existing zsh keyboard completion?

I would like to enable zsh to autocomplete modules for yast2 (an OpenSuSE control panel), but it seems to already have some things defined. I can run compctl -k "(hello world)" nonexistantprogram just fine, but compctl -k "(hello world)" yast2 doesn't work at all. Some things for yast2 seem to be already defined, namely the "-" opt...

Command as window's name in Ubuntu's ZSH

How can you convert the following command for Ubuntu's ZSH? DavidPashley's command for Bash trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUG if [ "$SHELL" = '/bin/bash' ] then case $TERM in rxvt|*term) set -o functrace trap 'echo -ne "\e]0;$BASH_COMMAND\007"' DEBUG export PS1="\e]0;$TERM\00...

How to enable git file tab completion with zsh compinit?

I have a problem with the zsh tab completion: After running: autoload -U compinit compinit Git tab completion for files does not work any more. For example if I type git add my_f to complete my_file, nothing happens. The zsh git completion only seems to work for git branches and tags. Without the compinit stuff, git file completion wo...

ZSH Prompt/RPrompt Conflict

I currently have my ZSH PROMPT variable set up as: PROMPT=$'[%{\e[0;32m%}%n@%m:%~%{\e[0m%}]> and my RPROMPT variable as: RPROMPT=$'[%{\e[0;32m%}%T\e[0m%}]' The effect I'm working for is to make the brackets and ">" white (using Terminal text-color settings) and everything inside of those green. However, when RPrompt is enabled in OS ...

Text disappears when typing long commands in zsh on OSX?

When I'm typing a command longer than around 20 characters the text disappears and the cursor moves to a different location in the terminal. How do I stop this? I find it difficult to understand what I'm doing when this happens. ...

Recommendation - Zsh vs FishShell. Scripting, productivity and poweruser perse.

I have spent sometime trying to pick one, on net comparisons are for zsh vs bash and fish vs bash. But, I Could not find any comparison for zsh vs fish. I program in c/c++, apart from hello-world types, never done any major scripting. But now trying my hands at python and shell-scripts. Which shell keeps more juice in terms of productivi...

bindkey with zsh on Mac

Hi, I've been trying to bind keys in zzh on a Mac but am having some trouble. I know I should be Googling this but couldn't find what I need... I've been trying to bind ctrl-backspace to be an equivalent of ctrl-w, ie delete one word. But I can't find the key code for it. Nothing shows up when I do it with 'read'. I can't find a chart ...

Rename files based on sorted creation date?

Hi, I have a directory filled with files with random names. I'd like to be able to rename them 'file 1' 'file 2' etc based on chronological order, ie file creation date. I could be writing a short Python script but then I wouldn't learn anything. I was wondering if there's a clever 1 line command that can solve this. If anyone could poi...

How do I require a minimum version of zsh?

I want to use a feature only present in newer versions of zsh: [[ "$foo" =~ "regexp" ]] where regexp is a regular expression. Is it possible to do this check? Something like: if [[ $ZSH_VERSION > 4.3.9 ]]; then .... fi Except that > won't work. Ciao! ...

Best resource to learn zsh?

I want to learn how to use Zsh. What is the best source to learn Zsh? Thanks! ...

Tell if a user has SUed in a shell script?

I have a script which executes a git-pull when I log in. The problem is, if I su to a different user and preserve my environment with an su -lp, the script gets run again and usually gets messed up for various reasons because I'm the wrong user. Is there a way to determine in a shell script whether or not I'm currently SUing? I'm looking...

Kill/Yank (cut/paste) in ZSH

I use zsh and have the Emacs keybindings set up for it. I'd love to have it replicate all my regular Emacs text manipulation commands. One which I miss is the Kill/Yank keys. It would be nice if I could select text (using C-SPC - this works) and then do something like a kill-region (C-w - This right now deletes the previous word). The ya...

Escape @ from python line command

I don't know if this is a problem with python or with the shell (zsh on linux), I've an argument like this: "@xyz" that starts with a "@" python the_script.py first_argument @second_argument third_arg I tried to escape @ with \ or \\, or use "" but the program doesn't start. If I leave the @ from @second_arguments everything's ok. ...

zsh handling of arguments

In the zsh programming language, how do I get the entire list of arguments as a string in "" ? i.e. in myzshcommand 1 2 3 foo bar I want something to match me "1 2 3 foo bar" Thanks! ...

zsh alias -> function ?

Suppose I have: alias gg="git grep" then stuff like: gg "int x" works, but gg int x gets complaints. Is there a way to rewrite gg as a function in zsh so that it takes all the arguments after gg, and stuffs them into a string? Thanks! ...

zsh doesn't complete local dir name when trying to execute local executable

Hi, I have a local directory with executable in it (e.g. foo_dir/bin/bar). I typed "foo", but foo_dir wasn't suggested. What cames out is other program in $PATH (such as bootlogd). How should I config my zshrc? Thanks ...

zsh: check if current directoy is git repo

I am writing a series of script for zsh/git management. How do I check if the current directory is a git repo? (When I'm not in a git repo, I don't wnat to execute a bunch of commands and get a bunch of 'fatal, not git repo' responses). Thanks! ...

in zsh, how do I do a conditional on the exit status of a program?

I wnat to do something like: if [[ git status &> /dev/null ]]; then echo "is a git repo"; else echo "is not a git repo"; fi except I don't know how to do checking on the exit status. How do I fix this? Thanks ...

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 itself every second? Thanks! ...