zsh

zsh not re-computing my shell prompt

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This might be a bit fringe, but I recently moved to zsh and am having a problem customizing my shell prompt. Part of my .zshrc looks like this: # keeping this simple right now by just printing the date, but imagine this function would look for something specific when moving to a new directory each time function parse_special { print $ ( date ) } autoload - U colors && colors PS1 = "%{$fg[green]%}%n@%m %{$fg[blue]%}%c %{$fg[yellow]%}%{$(parse_special)%} %{$reset_color%}%# " When I launch terminal, everything looks good; my prompt is

Which shortcut in Zsh does the same as Ctrl-U in Bash?

梦想的初衷 提交于 2019-12-03 02:10:04
问题 In Bash, when I am typing a command, I press Ctrl + U , all characters from the beginning of the line to the cursor are going to be removed. However, in zsh, if I pressed Ctrl + U , the whole line is gone. How to do the same in Zsh as in Bash? 回答1: It sounds like you'd like for Ctrl + U to be bound to backward-kill-line rather than kill-whole-line , so add this to your .zshrc : bindkey \^U backward-kill-line The bindkey builtin and the available editing commands (“widgets”) are documented in

bash vs csh vs others - which is better for application maintenance? [duplicate]

烈酒焚心 提交于 2019-12-03 02:08:52
This question already has answers here : What Linux shell should I use? [closed] (19 answers) Possible Duplicate: What Linux shell should I use? I am starting to get proficient in a Linux environment and i'm trying to pick a weapon of choice in terms of command shell scripting (as i'm still a big n00b at this) that will help me (and others) manage, test and administer a set of server side applications running on a *NIX environment. My question is: What is(are) the preferred command shell(s) out there when the following criteria are considered: How easy is it to learn/understand for a junior

Zsh wants to autocorrect a command, with an _ before it

时间秒杀一切 提交于 2019-12-03 01:59:55
问题 I just started using Zsh lately for some of the integrated support in the shell prompt for my Git status etc. When I type in: ruby -v to confirm the version of ruby I'm running, Zsh asks if I want to change the command to _ruby. Well after saying no at the prompt and the command completing as expected I continue to get the question at the prompt after confirming my command is correct. I'm assuming there is a completion file or something of the sort. Thanks Update: The shell is no longer

Zsh Docker Plugin not Working

匿名 (未验证) 提交于 2019-12-03 01:33:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been using oh-my-zsh for a while now and the docker plugin as recently stopped working for me for some reason. I checked my ~/.zshrc file and the plugin is included plugins=(git colored-man colorize github jira vagrant virtualenv pip python brew osx zsh-syntax-highlighting docker) I checked the ~/.oh-my-zsh/plugins/docker directory and there is a _docker file in there. Yet when I type docker and press Tab, I get none of the autocomplete shortcuts that I used to get. I can confirm that my git plugin works just fine but not the docker

ZSH complains about RVM __rvm_cleanse_variables: function definition file not found

旧巷老猫 提交于 2019-12-03 01:32:45
问题 When using the latest ZSH and RVM on Mac OS X 10.7.4 ZSH complains about this: __rvm_cleanse_variables: function definition file not found 回答1: Running the following solved the problem: rm -f ~/.zcompdump* Note: The * is incase there are multiple .zcompdump files. 回答2: Sometime there is also ~/.zcompdump-<COMPUTER NAME>-<VERSION> file, so use: rm -f ~/.zcompdump * 回答3: To disable the .zcompdump* file(s), you could look in your .zshrc (or /etc/zsh/* files ) for compinit and add the -D flag.

How to show zsh function definition (like bash “type myfunc”)?

烈酒焚心 提交于 2019-12-03 01:26:50
问题 How do I show the definition of a function in zsh? type foo doesn't give the definition. In bash: bash$ function foo() { echo hello; } bash$ foo hello bash$ type foo foo is a function foo () { echo hello } In zsh: zsh$ function foo() { echo hello; } zsh$ foo hello zsh$ type foo foo is a shell function 回答1: The zsh idiom is whence , the -f flag prints function definitions: zsh$ whence -f foo foo () { echo hello } zsh$ In zsh, type is defined as equivalent to whence -v , so you can continue to

zsh: command not found: express

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed node and npm and both work fine. However, when I try to install express via npm install -g express I get: zsh: command not found: express. I Have tried adding various paths in my .zshrc file with no luck. If I echo $path I get this: Users/Adam/.nvm/v0.10.26/bin /usr/local/heroku/bin /Users/Adam/.rbenv/shims /usr/local/bin /usr/bin /bin /usr/sbin /sbin If i run npm - prefix -g i get this: npm@1.4.3 /Users/Adam/.nvm/v0.10.26/lib/node_modules/npm Using mac osx 10 with zsh. 回答1: it seems that you need to install express-generator too

Arrow keys no longer work in Python shell after upgrading Mac OS to Sierra

倾然丶 夕夏残阳落幕 提交于 2019-12-03 01:23:00
I'm using zsh, iTerm2 (3.0.9), and pyenv (1.0.2) with pyenv global set to 3.5.2. In the Python shell, the up and down arrow keys used to work, to access the previous commands in the history. But now after upgrading to OSX 10.12, instead it shows control characters. For example up arrow displays: ^[[A I've tried installing readline as suggested in Seeing escape characters when pressing the arrow keys in python shell but that didn't help. I don't have the PYTHONSTARTUP variable but didn't used to before, and not sure how that interacts with pyenv. I solved it by installing python from homebrew:

Case-insensitive Glob on zsh/bash

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How? I am using zsh, but a bash solution is also welcome. 回答1: ZSH: $ unsetopt CASE_GLOB Or, if you don't want to enable case-insensitive globbing in general, you can activate it for only the varying part: $ print -l (#i)(somelongstring)* This will match any file that starts with "somelongstring" (in any combination of lower/upper case). The case-insensitive flag applies for everything between the parentheses and can be used multiple