Tag Info

New answers tagged

0

That history hack is a really strange way to solve this problem, and it's pretty fragile. It won't work with some characters that are valid in Windows file names such as parentheses. There's a much easier way to use to a pasted Windows path. Instead of pasting it into the line editor, call the getclip utility (which is in cygutils-extra in recent versions ...


0

There isn't any zstyle setting for that. What you can do is try completion with an empty cdpath, and if that fails, try with cdpath. _cd_try_without_cdpath () { CDPATH= _cd "$@" || _cd "$@" } compdef _cd_try_without_cdpath cd pushd


0

you may want the bold white color: PS1='%F{green}%n%f@%B%F{white}%m%f%b:%F{yellow}%~ $(stuff)%B%F{white}\$%f%b '


1

First of all check if setting variable ZLE_RPROMPT_INDENT to 0 helps. The default is 1. From zsh manual: ZLE_RPROMPT_INDENT If set, used to give the indentation between the right hand side of the right prompt in the line editor as given by RPS1 or RPROMPT and the right hand side of the screen. If not set, the value 1 is used.


0

Did you notice where it put your cursor? Since all files end with .R, it's automatically appending the possible suggestion for you. The autocomplete is using "both ends" as described by Tshepang. Try dropping a file into this folder without a .R name, and you'll see that .R bit go away. Honestly, autocomplete actually needs something to "complete" not a ...


2

Use an array since that can expand to a variable number of arguments: #!/bin/bash # This is file caller.bash switch=() if [[ ${1-x} == x ]] then switch=("--abc=long argument") fi some_command.sh "--exclude=*~" "${switch[@]}" arg Or you could use the ${var+...} syntax: #!/bin/sh # This is file caller.sh unset switch if [ "${1-x}" = x ] then ...


4

This feature can be tuned with ZLE_REMOVE_SUFFIX_CHARS and ZLE_SPACE_SUFFIX_CHARS shell parameters. If the ZLE_REMOVE_SUFFIX_CHARS variable is set, it should contain a set of characters that, when typed, will cause automatic suffixes from the completion to be removed. If ZLE_REMOVE_SUFFIX_CHARS is unset, the default behaviour equates to ...


1

You basically already know the answer from here. It's quite easy to put this all together like this: function insert_files() { vifm -f < /dev/tty > /dev/tty while read l; do LBUFFER+="'$l' " done < ~/.vifm/vimfiles zle reset-prompt } zle -N insert_files bindkey '^t' insert_files I'm not a zsh-user, so I stole structure ...


4

set | grep COLUMNS should display “Binary file (standard input) matches” (with GNU grep). muru has correctly identified the culprit: under zsh, IFS contains the null byte in addition to the standard characters space, tab, newline. Run set | grep --text COLUMNS to make grep ignore its inclination to skip binary files. Running set is not a portable, reliable ...


3

If I were to guess, I'd suspect IFS. set lists IFS too. And for me, IFS is (space, horizontal tab, newline and nul): $ printf "%s" "$IFS" | od -a 0000000 sp ht nl nul 0000004 The presence of the NUL character (\0) causes grep to treat it as a binary file, so depending on your grep, you may see: $ set | grep COLUMNS Binary file (standard input) ...


3

All terminal emulators that I've seen only let you resize the window in steps that correspond to the width of one character column. However, if your full-screen window width is not a multiple of the character width, there's not really anything you can do (other than choose a different font size to make it come better).


1

Although the ultimate decision comes from the software developer, this seems to be more in line with files zsh uses (from the man page): $ZDOTDIR/.zshenv $ZDOTDIR/.zprofile $ZDOTDIR/.zshrc $ZDOTDIR/.zlogin $ZDOTDIR/.zlogout ${TMPPREFIX}* (default is /tmp/zsh*) /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout ...


1

unhash -mf "*" can be used to clear all functions. Since it will wipe out the standard zsh goodness functions you will need to reload /etc/zsh/zshrc. I have the following at the beginning of my .zshrc: # Clear all functions and aliases unhash -mf "*" unhash -ma "*" . /etc/zsh/zshrc # reload standard functions and aliases


3

Zsh allows you to bind a shell function to a key and also has a builtin to put text into your command line. So you can do something like this (in zsh): # define a function that does the work function my_browser_function () { local result result=$( some command that returns the filename ) # print -z $result (see comments) LBUFFER+=$result } # turn ...


0

Inside your .zshrc, put [[ $TMUX = "" ]] && export TERM="xterm-256color" And, inside your .tmux.conf set -g default-terminal "screen-256color"


1

To expand parameter, arithmetic and command substitutions (and not aliases and other forms of expansions), you could do: my-expand() BUFFER=${(e)BUFFER} CURSOR=$#BUFFER zle -N my-expand bindkey '\e^E' my-expand (it would have similar limitations and could be almost as dangerous as bash's one though).


1

You can set up compinit to expand parameters in your ~/.zshrc: zstyle ':completion:*' completer _expand _complete autoload -Uz compinit compinit This is a minimal setting, if you have compinit already enabled, it should be sufficient to add _expand to the settings of completer There is also the expand-word widget that is by default bound to ^X* (Ctrl+x ...


2

if [[ $ZSH_EVAL_CONTEXT == 'toplevel' ]]; then # We're not being sourced so run the colors command which in turn sources # this script and uses its content to produce representative output. colors fi Via Kurtis Rader on the zsh-users mailing list.


1

zsh's jobs builtin can change the shell's process name. jobs -Z newname


2

You could make your script recursive this way: #! /bin/sh - do-something-with "$1" shift [ "$#" -eq 0 ] || exec "$0" "$@" Then when running your-script a b c, the ps output would show in turn: your-script a b c your-script a b your-script a


1

The prompt escape %~ abbreviates the current directory using hashed directories whenever possible. To stop using directory abbreviations, you can use %/ instead, but that doesn't abbreviate the home directory either. To abbreviate the home directory only, set the prompt_subst option (this may require adding additional backslashes in places in your prompt). ...



Top 50 recent answers are included