zsh

Alter $PATH in vim/macvim so as to find the right ruby binary

雨燕双飞 提交于 2019-11-29 22:50:49
问题 In trying to harmonize environments between a ZSH session and the vim/macvim access of the shell, a which ruby from the shell shows $HOME/.rvm/rubies/ruby-1.9.3/bin/ruby , which is good, while from inside vim/macvim a !which ruby shows /opt/local/bin/ruby , which is bad. I thought copying the invocation of RVM from .zshrc to .zshenv would work but doing so interferes with other utilities. After several days trying to sort this out, I feel stumped. Any suggestions of where documentation to

Fix key settings (Home/End/Insert/Delete) in .zshrc when running Zsh in Terminator Terminal Emulator

久未见 提交于 2019-11-29 21:27:59
I'm running Ubuntu 11.04. I installed the Terminator Terminal Emulator 0.95, and Zsh, version 4.3.15. I have (commonly known) problems with my keys inside the Zsh. At least these: Home/End, nothing happens Insert/Delete/PageUp/PageDown: a "~" is typed I already tried some configurations for .zshrc which should solve the problem, but no approach really worked so far. Maybe this is related to the combination of Terminator and Zsh. I took the 2 configs on this page: https://bbs.archlinux.org/viewtopic.php?pid=428669 . Does oneone have a similar configuration (especially Terminator and Zsh) and

Getting a weird percent sign in printf output in terminal with C

99封情书 提交于 2019-11-29 21:22:11
I have this printf statement at the end of my program: printf("%d", total_candies); total_candies is an int , and while I expect everything to work correctly, along with the actual number, I'm getting a weird percent sign at the end. Can anyone tell me why this is happening? When (non-null) output from a program doesn't include a trailing newline, zsh adds that color-inverted % to indicate that and moves to the next line before printing the prompt; it's generally more convenient than bash's behavior, just starting the command prompt where the output ended. 来源: https://stackoverflow.com

【0916】Linux shell基础知识1

你离开我真会死。 提交于 2019-11-29 20:54:32
【0916】Linux shell基础知识1 8.1 shell介绍 8.2 命令历史 8.3 命令补全和别名 8.4 通配符 8.5 输入输出重定向 8.6 管道符和作业控制 一、shell基础 查看系统是否安装了zsh、ksh 二、修改命令历史格式 1、使用hosiery查看历史使用过的命令,最多储存1000条,由系统内置的环境变量控制。 2 使用history -c清除内存中的命令历史(之前敲过的命令将被清除) 3、只有退出终端时,才会将使用过的命令保存到.bash.history中 4、环境变量HISTSIZE 修改后重启终端,或者使用 source /etc/profile 5、记录命令是何时运行的 将变量重新赋值 HISTTIMEFORMAT=“%Y/%m/%d %H:%M:%S ” 想让环境变量永久生效 使用vim /etc/profile 进入编辑模式 输入/HISTSI查找定位 6、永久保存命令 chattr + a ~/.bash_history 修改文件权限后记录命令历史使用记录的文件只能追加不能删除 7、!!、!n、!word !!:运行history中最后一条命令 !n:运行history中第n行命令 !word:运行history中倒数的第一个以word关键字运行的命令 三、命令补全和别名 1、tab键,补全命令或路径 安装包,安装后重启

set -e and short tests

╄→гoц情女王★ 提交于 2019-11-29 20:52:19
When I was new to shell scripting, I used a lot of short tests instead of if statements, like false && true . Then later I learned using set -e , and found my scripts were dying for some reason, and they would work if I replaced the short tests with full if statements. Now, the time has gone, and I still use full if statements only. The most interesting is that if I open an interactive shell and do the following: set -e false && true echo $? it returns 1 but the shell doesn't die! I see that I have been wasting too many lines of code. Anyone could explain to me how can I use set -e with short

Can I profile my .zshrc/.zshenv?

老子叫甜甜 提交于 2019-11-29 20:15:31
It seems like my shell is taking way too long to start up. Is there any way to profile it so I can figure out what's slowing it down so much? Try adding this at the beginning of the file: # set the trace prompt to include seconds, nanoseconds, script name and line number # This is GNU date syntax; by default Macs ship with the BSD date program, which isn't compatible PS4='+$(date "+%s:%N") %N:%i> ' # save file stderr to file descriptor 3 and redirect stderr (including trace # output) to a file with the script's PID as an extension exec 3>&2 2>/tmp/startlog.$$ # set options to turn on tracing

commands not found on zsh

心已入冬 提交于 2019-11-29 19:07:31
I am using the z Shell ( zsh ) instead of the default bash, and something wrong happen so that all commands who used to work are no longer recognized: ls zsh: command not found: ls open -e .zshrc zsh: correct 'open' to '_open' [nyae]? I don't know how to reset zsh or how to fix this. Here is the content of $PATH variable: echo $PATH /Users/Malloc/bin/Sencha/Cmd/3.1.2.342:/usr/local/bin/mate I cannot open the .bash_profile file nor .zshrc file, seems the only solution is to reset the zsh . Any ideas? EDIT: I even tried to reset zsh as indicated in this thread , but always got command not found

How can I change the color of my prompt in zsh (different from normal text)?

China☆狼群 提交于 2019-11-29 18:56:18
To recognize better the start and the end of output on a commandline, I want to change the color of my prompt, so that it is visibly different from the programs output. As I use zsh, can anyone give me a hint? Here's an example of how to set a red prompt: PS1=$'\e[0;31m$ \e[0m' The magic is the \e[0;31m (turn on red foreground) and \e[0m (turn off character attributes). These are called escape sequences. Different escape sequences give you different results, from absolute cursor positioning, to color, to being able to change the title bar of your window, and so on. For more on escape sequences

OSX 10.10 yosemite beta on git pull: git-sh-setup: No such file or directory

馋奶兔 提交于 2019-11-29 18:56:10
After upgrading to OSX 10.10 Yosemite Beta, running git pull is returning the following error: /Library/Developer/CommandLineTools/usr/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory I've checked the referenced git-core directory and the git-sh-setup.sh is there. Other git commands are working exactly as expected I think the cleanest solution for this for now is to change the initial command in your iTerm session to be /usr/bin/login -f <your user name> This fixes the issue for me. A further data point for analysis of the issue: It seems that in 10.10, multiple

Adding a new entry to the PATH variable in ZSH

社会主义新天地 提交于 2019-11-29 18:54:11
I'm using zsh and I'm trying to add a new entry ( /home/david/pear/bin ) to the PATH variable but I don't know how. The thing that confuses me the most is that there's not a single reference to a PATH variable in my ~/.zshrc file, but doing echo $PATH returns: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games So a PATH variable is being set somewhere. Here: export PATH=/home/david/pear/bin:$PATH ony Actually, using ZSH allows you to use special mapping of environment variables. So you can simply do: # append path+=('/home/david/pear/bin') # or