zsh

Which shell I am using in mac

偶尔善良 提交于 2019-12-22 04:15:19
问题 Default shell in my mac was bash. I have tried to change it into ZSH by command chsh -s /bin/zsh . Now when I am trying to check the shell type, I am getting different responses. COMMAND-1 input : echo $SHELL output : /bin/zsh COMMAND-2 input : ps $o output : 7655 ttys002 0:00.03 -bash COMMAND-3 input : ps -p $$ | awk '$1 == PP {print $4}' PP=$$ output : -bash I am not sure which shell I am using. Do I need to do something additional to change my shell into ZSH . 回答1: macOS's Terminal allows

terminal vim not loading .zshrc

谁说胖子不能爱 提交于 2019-12-22 01:52:00
问题 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) 回答1: From the manual: Commands are first read from /etc/zshenv; this cannot be overridden. [...] Commands are then read

zsh: permission denied: gam

断了今生、忘了曾经 提交于 2019-12-21 21:43:48
问题 I am using ZSH on macOS 10.12 with Oh My ZSH installed. I recently installed GAM on my computer using the provided install script bash <(curl -s -S -L https://git.io/install-gam) The script installs the command line tool gam to ~/bin/gam/gam , which is in my PATH . However, when trying to execute any gam command in ZSH, I get the following: ➜ ~ gam info user zsh: permission denied: gam However, when executing the same (or any) command in bash, the tool works as expected. I have been able to

Find and delete all symlinks in home folder, having trouble making it work

穿精又带淫゛_ 提交于 2019-12-21 19:20:30
问题 I have the following: read -p 'Delete old symlinks? y/n: ' prompt if [ $prompt == [yY] ] then current_dir=$(pwd) script_dir=$(dirname $0) if [ $script_dir = '.' ] then script_dir="$current_dir" fi for sym in {find $PATH -type l -xtype d -lname "~"} do rm $sym echo "Removed: $sym" done fi What I'm trying to achieve is the following: If prompt equals y (yes) Then: Find all the symlinks in ~ (home directory) and do a for loop on them which would delete them and output which one it deleted.

Find and delete all symlinks in home folder, having trouble making it work

大兔子大兔子 提交于 2019-12-21 19:19:01
问题 I have the following: read -p 'Delete old symlinks? y/n: ' prompt if [ $prompt == [yY] ] then current_dir=$(pwd) script_dir=$(dirname $0) if [ $script_dir = '.' ] then script_dir="$current_dir" fi for sym in {find $PATH -type l -xtype d -lname "~"} do rm $sym echo "Removed: $sym" done fi What I'm trying to achieve is the following: If prompt equals y (yes) Then: Find all the symlinks in ~ (home directory) and do a for loop on them which would delete them and output which one it deleted.

Zsh: read lines from file into array

痴心易碎 提交于 2019-12-21 17:23:40
问题 I'm trying to read in a file as an array of lines and then iterate over it zsh, and the code I've got works most of the time, except if the input file contains certain characters (such as brackets). Here's a snippet of it: #!/bin/zsh LIST=$(cat /path/to/some/file.txt) SIZE=${${(f)LIST}[(I)${${(f)LIST}[-1]}]} POS=${${(f)LIST}[(I)${${(f)LIST}[-1]}]} while [[ $POS -le $SIZE ]] ; do ITEM=${${(f)LIST}[$POS]} # Do stuff ((POS=POS+1)) done What would be an easier way of doing this? I also need to

bind key to complete filename wherever the context is in Zsh

做~自己de王妃 提交于 2019-12-21 14:01:06
问题 Sometimes I want a filename instead of what zsh guesses for me. For example, I have a PNG file without a proper .png suffix, which makes zsh think it isn't a picture and won't list it when I type Tab to complete arguments of display . I am wondering if there is a key sequence that completes for a filename wherever the context is, like ^XC for _correct_filename , or how to configure zsh to do the thing? 回答1: You can add a key binding to do what you want: zle -C complete complete-word complete

RVM set ruby default, when open new terminal erase the RVM setting, go back to system ruby

余生长醉 提交于 2019-12-21 12:09:12
问题 I just got a new MacBook Pro and tried to setup the RVM in the system. I installed RVM and set the default to ➜ rvm list default Default Ruby (for new shells) ruby-1.9.3-p194 [ x86_64 ] My RVM version is ➜ rvm --version rvm 1.16.8 (master) by Wayne E. Seguin , Michal Papis [https://rvm.io/] I have put [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. at the bottom of the .bashrc_profile . When I open the new Terminal window, I have

Z Shell “autoload” builtin - what is it good for?

雨燕双飞 提交于 2019-12-20 16:47:38
问题 I have been using the Z shell for a while now, and I am starting to be curious. One thing I have stumbled at when writing my own functions is "autoload". According to the zshbuiltins(1) man page autoload is "equivalent to functions -u " (with an exception), which is "equivalent to typeset -f " (with an exception). However, after looking at the autlooad use of, say functions/Prompts/promptinit , I think I have an idea what it does. I think of autoload as, well, kind of "import" statement. But

ZSH RPROMPT weird spacing?

天大地大妈咪最大 提交于 2019-12-20 10:58:32
问题 Here is my ZSH prompt theme function git_prompt_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" } PROMPT='$fg[yellow]%}⚡︎ $fg[cyan]%~ $(git_prompt_info) %{$reset_color%}→ ' ZSH_THEME_GIT_PROMPT_PREFIX="[git:" ZSH_THEME_GIT_PROMPT_SUFFIX="]$reset_color" ZSH_THEME_GIT_PROMPT_DIRTY="$fg[red]+" ZSH_THEME_GIT_PROMPT_CLEAN="$fg[green]" RPROMPT='%T' Which looks like When I move the $(git