zsh

zsh tab completion bug on ubuntu

亡梦爱人 提交于 2019-12-05 04:40:02
I'm getting a really annoying bug here: % git s<TAB> becomes % git sgit s send-email -- send collection of patches as emails send-pack -- push objects over git protocol to another repository ... It just duplicates the command. If I resize the screen, it goes back to normal: git s How do I fix this? BPm I got it! Darn. It's my prompt instead of: PS1=$'%B%F{$fg[green]%}${PWD/#$HOME/~}%{$reset_color%} git-prompt ${VIMODE} ' I should just do PS1=$'%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}git-prompt ${VIMODE} ' And everything works fine now... 来源: https://stackoverflow.com/questions

What special meaning does an equal-sign have in zsh?

守給你的承諾、 提交于 2019-12-05 02:50:45
In my zsh script, I had a line echo some text ================================ To my surprise, an error message was issued for this line: zsh: =============================== not found Experimenting from the command line, I found that the shell gets upset when there is an equal sign: $ echo =z zsh: z not found But here, we have: $ echo =echo /usr/bin/echo From this observation, it looks, as if =XXX would be interpreted like $(which XXX) However, I didn't find anything about this "substitution" in the zsh manpage. Where is this piece of magic described? From the docs : 14.7.3 ‘=’ expansion If a

Share history between panes/windows

落花浮王杯 提交于 2019-12-05 02:40:19
Is there a way to share the shell command history between panes/windows in a tmux session? shell history has precious little to do with tmux, it has to do with the shell you are using. So if you chose to use zsh it is enabled iirc by default. With bash you need to add some magic to your .bashrc export PROMPT_COMMAND="history -a; history -n" this appends your last command to history and reloads your history after each command. See this post for more information. Add these options to your .zshrc : setopt inc_append_history I also find hist_ignore_dups hist_ignore_space useful. See also Zsh »

Shell execution: time vs. /usr/bin/time

拜拜、爱过 提交于 2019-12-05 01:34:40
What is going on when bash/zsh does the following: ~ » /usr/bin/time -l sleep 1 1.00 real 0.00 user 0.00 sys 516096 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 145 page reclaims 0 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 0 voluntary context switches 2 involuntary context switches ------------------------------------------------------------ ~ » time -l sleep 1 zsh: command not found: -l -l sleep 1 0.00s user 0.00s system 52% cpu 0.001 total -

oh-my-zsh plugins not working

牧云@^-^@ 提交于 2019-12-05 00:44:08
I've just discovered oh-my-zsh, but I can't get it to work. While themes work just perfectly, plugins do not. I have some plugins selected, eg. macports, but neither I get port command completion nor do appropriate aliases work. Here's my .zshrc: # Path to your oh-my-zsh configuration. export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. export ZSH_THEME="steeef" # Set to this to use case-sensitive completion # export CASE_SENSITIVE="true" # Comment

Setting environment variable in ZSH gives number expected

浪子不回头ぞ 提交于 2019-12-05 00:24:22
问题 I'm trying to set an array in ZSH (configured using oh-my-zsh). export AR=(localhost:1919 localhost:1918) but I'm getting an error like such: zsh: number expected If I don't add the export command, it's just fine. I'm not typing the above in a *rc file, just in the zsh prompt. What could be the problem? 回答1: You can't export an array in zsh. For more info: http://zsh.sourceforge.net/Guide/zshguide02.html Note that you can't export arrays. If you export a parameter, then assign an array to it,

terminal vim not loading .zshrc

橙三吉。 提交于 2019-12-04 23:39:31
My terminal vim configuration is not loading the ~/.zshrc. Zsh is the environment login shell. What is the proper configuration for this situation? Here are some measures I've already taken and since removed: set shell=zsh (uses zsh as shell but doesn't source the rc) set shellcmdflag=-ci (all output suspended) cat ~/.zshenv $ source ~/.zshrc (many errors when opening vim) From the manual: Commands are first read from /etc/zshenv; this cannot be overridden. [...] Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zprofile and then $ZDOTDIR/

zsh change prompt input color

一世执手 提交于 2019-12-04 22:31:35
问题 I want to change the color of the input text in zsh (the text that I type for each command). Example: in user@host> ls ~/ I would want ls ~/ to be yellow to stand out from standard output. I know I can accomplish this in bash using export PS1=" $BIGreen \u@\h \w \$ $IYellow" At the end of the prompt, the color is set to Yellow, input text I type is yellow (with the appropriate color variables defined). And then trap 'echo -ne "\e[0m"' DEBUG Which resets the color to normal when the outputs of

How do you get nth argument of a previous command at command line?

房东的猫 提交于 2019-12-04 19:32:38
问题 If you're at an interactive shell and you type something like: echo this is it Then later you can expand the first argument: echo !^ #=> echo this Or you can expand the last argument: echo !$ #=> echo it But now I'm wondering: How would I access the n th argument? I looked through a related bash question, but it seems like that only works when in a script, because !n just goes through my command history (instead of my argument history) - for example echo !1 #=> echo ls which makes sense,

记录一次Ubuntu基础配置和美化

非 Y 不嫁゛ 提交于 2019-12-04 19:07:27
记录一次Ubuntu基础配置和美化 配置 更新为国内源 打开软件更新器,选择设置选择国内源(例如阿里源)。 更新源 sudo apt update sudo apt upgrade 安装Chrome浏览器 wget -q -O - https://raw.githubusercontent.com/longhr/ubuntu1604hub/master/linux_signing_key.pub | sudo apt-key add sudo sh -c 'echo "deb [ arch=amd64 ] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' sudo apt-get update sudo apt-get install google-chrome-stable 美化 更换gnome主题,先安装gnome-tweak-tool。 sudo apt-get install gnome-tweak-tool 之后我们就可以对一些基础的主题设置进行修改了,要进行高级的设置我们还需要安装gnome-shell-extensions。 sudo apt-get install gnome-shell-extensions