命令行自动提示
打赏作者

qwerghtyu56

请问这个是什么配色方案呐?

JellyBool

这个下一个视频就会简单介绍iTerm2.会讲到 @qwerghtyu56

qwerghtyu56

@JellyBool 自动补全怎么选中?

MiYogurt

这个插件不错。

yejiangdana

不知道为什么 我配置成功后 zsh自动补全会有咚咚的响声,貌似是mac的错误提示音,有同样遇到的人吗

DavidWang

有人遇到我这个问题吗?
终端是配置成功了。但是PHPStorm中的Terminal没有配置成功。

wzq1992 回复 DavidWang

PHPStorm 的命令行中执行下 source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh 就可以了…

高永立 回复 wzq1992

将以下内容添加到 .zshrc 文件中:
source〜/ .zsh / zsh-autosuggestions / zsh-autosuggestions.zsh

John1024

想请问 你的盗链是怎么设置的 右键另存为不能使用了

lepig

想请问一下。在iterm2中使用发现每次敲击键盘都会发布提示音(就是一直按delete删完所有命令后的提示音) 不知道如何关闭

PS :貌似发现是切换到zsh的时候输入在终端,不管是自带终端还是iterm2都会有提示音,这个要如何关闭掉。

JellyBool

这个貌似我都没有遇到过唉。。。 @lepig

forecho

按 tab 键不是提示了,而是清楚上一行命令,为什么这样了

forecho

注释掉 vim ~/.zshrc 中 COMPLETION_WAITING_DOTS 这行配置,问题已经解决了。

alan

@yejiangdana @lepig 请问二位遇到的输入时咚咚的声音问题,解决了么?

JellyBool
  1. 打开 Terminal.
  2. 找到 Terminal > Perferences.
  3. 打开 Settings > Advanced
    4. 去掉 “Audible Bell” 钩钩

@alan @yejiangdana @lepig 这样试试?

alan

@JellyBool 按照你的方法,搞定了。多谢。

glon

.zshrc这个文件是怎么生成的,在下载下来的文件里面没有发现这个

kanjiushi

.zshrc文件在哪里?git下来的两个文件夹中没有这个文件

JellyBool

这个文件是在你装zshell的时候生成的,就在你的home目录之下

~/.zshrc

@kanjiushi

lovezsl2

你好,以前没有用过zsh,看着文档安装了

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

******MacBook-Pro:~ zhangshilong$ source .zshrc 
-bash: autoload: command not found
-bash: /Users/********/.oh-my-zsh/oh-my-zsh.sh: line 31: syntax error near unexpected token `('
-bash: /Users/*******/.oh-my-zsh/oh-my-zsh.sh: line 31: `for config_file ($ZSH/lib/*.zsh); do'

然后根据视频中的操作

git clone git://github.com/tarruda/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
# Load zsh-autosuggestions.
source ~/.zsh/zsh-autosuggestions/autosuggestions.zsh

# Enable autosuggestions automatically.
zle-line-init() {
    zle autosuggest-start
}
zle -N zle-line-init

然后执行 source .zshrc
报错:

-bash: autoload: command not found
-bash: /Users/*******/.oh-my-zsh/oh-my-zsh.sh: line 31: syntax error near unexpected token `('
-bash: /Users/*******/.oh-my-zsh/oh-my-zsh.sh: line 31: `for config_file ($ZSH/lib/*.zsh); do'
-bash: zmodload: command not found
-bash: /completion-client.zsh: No such file or directory
-bash: autoload: command not found
-bash: /Users/*******/.zsh/zsh-autosuggestions/autosuggestions.zsh: line 28: syntax error near unexpected token `}'
-bash: /Users/*******/.zsh/zsh-autosuggestions/autosuggestions.zsh: line 28: `}'
-bash: zle: command not found

这个到底是什么情况,有没遇到同样情况的兄弟,望支招解决

sljv2go 回复 lovezsl2

最后解决了吗。我跟你的问题一模一样

xiaoyuchen 回复 lovezsl2

这个问题我也遇到了,你可以先装https://github.com/robbyrussell/oh-my-zsh,然后再把

1、Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Add the plugin to the list of plugins for Oh My Zsh to load:
2、把下面这句话添加~/.zshrc文件中
plugins=(zsh-autosuggestions)

3、Start a new terminal session.

lovezsl2

@JellyBool 用的是终端Terminal

237552032

@JellyBool 汗!搞了半天发现是Mac开发大杂烩

chriswang

安装后 fn+左 回到行首失效了,无奈我又卸掉了

sean90

这个视频最后一句话说的是什么?

GeekCn

不错!

JellyBool

哈哈哈,恩,我也觉得挺好的 @GeekCn

thinkings

试了,谢谢。问一下,如果出来的提示正是我需要的,这时候按什么或是怎么弄才能不用继续提后续的字符。

thinkings

我这折腾试出来按右箭头可以。但是这样按太累了。可有其它 按法啦?

JellyBool

这个我目前也没有更好地办法 @thinkings

hezhiying

@JellyBool 我的mac上只有.bashrc 没有.zshrc 看到你前面说要安装zshell,请问zshell怎么安装,我用MAC时间不长,不太会用密码,现在正努力多命令!能不能告诉zshell怎么安装,我再去安装这个autosuggest

yuzhewo

我也好奇哈哈~

shuliangfu

-bash: zle: command not found
-bash: zsh-autosuggestions.zsh: line 126: syntax error near unexpected token (' -bash: zsh-autosuggestions.zsh: line 126: user:zsh_autosuggest(bound|orig)_*);;'
报这个错是怎么回事??有碰到的么?怎么解决?

JellyBool 回复 shuliangfu

这种一般都是你哪一行配置多了一个 什么的。

chinkiver 回复 shuliangfu

You are sourcing your .zshrc from Bash. Please note that OMZ is a collection of plugins made for zsh, which is not the same shell as Bash.

You can simply use the zsh command to launch zsh from Bash. Alternatively, you can definitely set your user shell to zsh with chsh -s /bin/zsh — then just open a new terminal to launch zsh.

chinkiver 回复 shuliangfu

先执行zsh
然后再执行source .zshrc
然后exit退出
重启就OK

MiddleFingerMonster

为什么装好后启动它,键入任何按键都一直有提示声…

liupeiyu

弱弱问下,有没有windows下的类似工具,看着很NB的样子

JellyBool 回复 liupeiyu

这个我不太清楚

liupeiyu 回复 JellyBool

phpstrom里面的命令行支持laravel的命令行,只是没有zsh-autosuggestion那个软件哪么智能!

Enoch97

~/.zshrc这个文件不存在啊

大喵

这个github的作者好像换地址了,是这个吗?
https://github.com/zsh-users/zsh-autosuggestions

chinkiver

我来写一个完整的吧。

第一步:安装oh-my-zsh,分别在终端执行下述命令
1、git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
2、cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
3、zsh //此时会进入zsh环境
4、在zsh环境中输入source .zshrc
5、输入exit退出zsh环境
6、重启终端

第二步:代码提示
1、git clone git://github.com/tarruda/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
2、将下述命令加入至.zshrc的末尾(记得vim .zshrc)
source ~/.zsh/zsh-autosuggestions/autosuggestions.zsh
3、重启终端

OK!

duo 回复 chinkiver

第二步,source ~/.zsh/zsh-autosuggestions/autosuggestions.zsh
改为source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh

zhujie

有个问题问下,如果能让自动提示出现的文字变淡?我现在自动出现的文字都跟正常显示的字色一样。用的是cloud的主题配色

JellyBool 回复 zhujie

这个是 iTerm 2 主题的配色问题吧。你自己在 iTerm 的 preferences 那调一下就可以了

zhujie 回复 JellyBool

我终于发现问题了,包括我后面那个iTerm配色的视频,没有效果的原因是应为在设置里面的Terminal选项里面,Report Terminal Type 要选xterm-256color,我之前一直是xterm-new,所以配色一直都不行。

Young

视频界面大小在MBP15下有点大,而且使用鼠标滑动时音量也跟着变大变小 (双指滑动也会出现前面说过的情况)
希望jellybool 能调整一下

JremeryHe

win10可以弄这个么?

sunding0308

在本机上是有了,进入homestead 虚拟机里就不自动提示了?

ICanFly

主题挺酷的~

jiiiiiin

请问 我配置zsh之后,atom相关的terminal 字体显示就出错了,你有使用atom的体验么?

JellyBool 回复 jiiiiiin

没有。。。目前还没有使用过 Atom

MikeMaldini

我想问下这是基于session的么。因为我现在的情况是推出iterm2后 就没提示了 重启iterm2后至少要再输一次命令才能出现提示 关了iterm2后又没了

JellyBool 回复 MikeMaldini

这个应该是 session 吧,但是我这边没出现你的情况

q530004000

感谢分享. 今天一整天都在看你的视频.

JellyBool 回复 q530004000

阔以,非常感谢支持。如果想订阅的话,这两天有半价优惠

q530004000 回复 JellyBool

新年快乐. 现在还有这个优惠么? 希望能出单个视频购买的功能.

JellyBool 回复 q530004000

单个视频购买应该暂时不会出,明天你关注一下优惠

q530004000 回复 JellyBool

好的. 谢谢. 已经订阅了半年. 感谢出了这么多优秀的教程. 期待更多的干货. 新年快乐.

ayaup

source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
-bash: autoload: command not found
-bash: zmodload: command not found
-bash: /Users/kaodao/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh: line 169: syntax error near unexpected token (' -bash: /Users/kaodao/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh: line 169: user:zsh_autosuggest(bound|orig)_*);;’

source 的时候,报错~

JellyBool 回复 ayaup

token ('

感觉是哪里写错了,多了括号或者其他的字符

ayaup 回复 JellyBool

程序里面_zsh_autosuggest_bind_widget() {
typeset -gA _ZSH_AUTOSUGGEST_BIND_COUNTS

local widget=$1
local autosuggest_action=$2
local prefix=$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX

local -i bind_count

# Save a reference to the original widget
case $widgets[$widget] in
	# Already bound
	user:_zsh_autosuggest_(bound|orig)_*);;

	# User-defined widget
	user:*)
		_zsh_autosuggest_incr_bind_count $widget
		zle -N $prefix${bind_count}-$widget ${widgets[$widget]#*:}
		;;

	# Built-in widget
	builtin)
		_zsh_autosuggest_incr_bind_count $widget
		eval "_zsh_autosuggest_orig_${(q)widget}() { zle .${(q)widget} }"
		zle -N $prefix${bind_count}-$widget _zsh_autosuggest_orig_$widget
		;;

	# Completion widget
	completion:*)
		_zsh_autosuggest_incr_bind_count $widget
		eval "zle -C $prefix${bind_count}-${(q)widget} ${${(s.:.)widgets[$widget]}[2,3]}"
		;;
esac

_zsh_autosuggest_get_bind_count $widget

# Pass the original widget's name explicitly into the autosuggest
# function. Use this passed in widget name to call the original
# widget instead of relying on the $WIDGET variable being set
# correctly. $WIDGET cannot be trusted because other plugins call
# zle without the `-w` flag (e.g. `zle self-insert` instead of
# `zle self-insert -w`).
eval "_zsh_autosuggest_bound_${bind_count}_${(q)widget}() {
	_zsh_autosuggest_widget_$autosuggest_action $prefix$bind_count-${(q)widget} \$@
}"

# Create the bound widget
zle -N $widget _zsh_autosuggest_bound_${bind_count}_$widget

}
不知道哪里的问题,

JellyBool 回复 ayaup

确定你用的是 zshell ?

chenlulinlin

看了半天都不行,最晚回答也是两年前了