zsh

Zsh tab-completion for “cd ..” [closed]

牧云@^-^@ 提交于 2020-06-24 04:59:04
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Improve this question How can I configure the Zsh tab-completion such that when I type cd ..<TAB> it expands to cd ../ and after pressing <TAB> again proposes the folders in the parent directory for completion? E.g. it should show the same behavior as when typing for example cd Documents<TAB> which expands to cd

zsh can neither find nor execute custom user scripts in ~/bin although they are executable and in the $PATH environment variable

こ雲淡風輕ζ 提交于 2020-06-17 09:45:13
问题 Problem: I have recently upgraded from macOS Mojave 10.14.6 to macOS Catalina 10.5.5. Now that zsh is the default shell, I migrated my .bashrc to .zshrc : Aliases work fine. But for some unexplainable reason, my custom user scripts in ~/bin/my/ and ~/bin/dev/ are not completed by autocompletion cannot be evoked when typed entirely, I then get zsh: command not found: myScript.sh Investigation & Troubleshooting: When changing the shell back to bash, everything still works, so data-loss

awk, if else conditional when record contains a value

依然范特西╮ 提交于 2020-06-16 17:27:11
问题 I'm having trouble getting an awk if/else conditional to properly trigger when the record contains a value. Running this in zsh on Mac OS Catalina. This script (issue is on second to last line)... echo "abcdefgh" > ./temp echo "abc\"\(\"h" >> ./temp echo "abcdefgh" >> ./temp echo "abcde\(h" >> ./temp val='"\("' key="NEW_NEW" file="./temp" echo $val echo $key echo $file echo "" echo "###############" echo "" awk ' BEGIN { old=ARGV[1]; new=ARGV[2]; ARGV[1]=ARGV[2]=""; len=length(old) } ($0 ~

awk, if else conditional when record contains a value

狂风中的少年 提交于 2020-06-16 17:25:28
问题 I'm having trouble getting an awk if/else conditional to properly trigger when the record contains a value. Running this in zsh on Mac OS Catalina. This script (issue is on second to last line)... echo "abcdefgh" > ./temp echo "abc\"\(\"h" >> ./temp echo "abcdefgh" >> ./temp echo "abcde\(h" >> ./temp val='"\("' key="NEW_NEW" file="./temp" echo $val echo $key echo $file echo "" echo "###############" echo "" awk ' BEGIN { old=ARGV[1]; new=ARGV[2]; ARGV[1]=ARGV[2]=""; len=length(old) } ($0 ~

zsh sed expanding a variable with special characters and keeping them

蓝咒 提交于 2020-06-16 17:24:09
问题 I'm trying to store a string in a variable, then expand that variable in a sed command. Several of the values I'm going to put in the variable before calling the command will have parentheses (with and without slashes before the left parentheses, but never before the right), new lines and other special characters. Also, the string will have double quotes around it in the file that's being searched, and I'd like to use those to limit only to the string I'm querying. The command needs to be

zsh and parallel: How to use functions. It says command not found

早过忘川 提交于 2020-06-16 03:30:08
问题 I have a script file filename: test_sem_zsh.sh main() { echo "Happy day" } export -f main sem --id testing --fg main I am trying to run it using zsh $ zsh test_sem_zsh.sh test_sem_zsh.sh:export:4: invalid option(s) zsh:1: command not found: main It says two error's 1) main command not found and 2) export:4: invalid option(s) Where as when i try with bash it works $ sh test_sem_zsh.sh Happy day So how to get this script working with zsh also 回答1: Not certain what you are trying to do, but this

Zsh zle shift selection

血红的双手。 提交于 2020-06-10 12:44:46
问题 How to use shift to select part of the commandline (like in many text editors) ? 回答1: shift-arrow() { ((REGION_ACTIVE)) || zle set-mark-command zle $1 } shift-left() shift-arrow backward-char shift-right() shift-arrow forward-char shift-up() shift-arrow up-line-or-history shift-down() shift-arrow down-line-or-history zle -N shift-left zle -N shift-right zle -N shift-up zle -N shift-down bindkey $terminfo[kLFT] shift-left bindkey $terminfo[kRIT] shift-right bindkey $terminfo[kri] shift-up

Oh My Zsh multiple commands with one alias

て烟熏妆下的殇ゞ 提交于 2020-06-10 02:45:16
问题 I'm using Oh My Zsh, and was wondering if there is a way to create a function or alias to run multiple commands. Just as an example, running an 'update' command will update specific gems, but not all of them. 回答1: As you've discovered, you can chain commands in a single alias using ; : alias update_my_gems="echo foo; echo bar" Alternatively, you can write a function very easily in your ~/.zshrc file: update_my_gems() { echo foo echo bar } For readability, I'd personally go for a function for

Oh My Zsh multiple commands with one alias

三世轮回 提交于 2020-06-10 02:45:10
问题 I'm using Oh My Zsh, and was wondering if there is a way to create a function or alias to run multiple commands. Just as an example, running an 'update' command will update specific gems, but not all of them. 回答1: As you've discovered, you can chain commands in a single alias using ; : alias update_my_gems="echo foo; echo bar" Alternatively, you can write a function very easily in your ~/.zshrc file: update_my_gems() { echo foo echo bar } For readability, I'd personally go for a function for

Homebrew’s `git` not using completion

泪湿孤枕 提交于 2020-06-09 07:21:06
问题 When using OSX’s git, after I modify a file I can simply do git commit <tab> , and that’ll auto complete the file’s name to the one that was modified. However, if I install a newer version of git from homebrew and I use it, that feature no longer works (meaning I press <tab> and it just “asks” me what file I want to do it on, even including the ones that have no changes). Can anyone shed some light as to why, and how to solve that? I’d prefer using homebrew’s git, since it’s more up-to-date.