[Share Experiences] 修改bash的命令提示,更改为zsh那种提示方式 Resolved
Tofloor
poster avatar
Kiah
deepin
2023-01-30 20:13
Author

为什么要使用这个插件?

也许很多人和我一样,使用过zsh的命令提示功能,而且会匹配自己之前执行的命令显示,只需要按→键就可以完成之前的命令。

但是bash默认并没有这么好用的功能,你按tab他只会列出一大堆命令,并不智能。

所以经过我的查找,发现了一个插件, 就是今天的主角:ble.sh ―Bash Line Editor―

github仓库是:https://github.com/akinomyoga/ble.sh

插件的安装

git clone --recursive https://github.com/akinomyoga/ble.sh.git
make -C ble.sh
source ble.sh/out/ble.sh

如果clone失败,可以通过以下分享的代理网站进行修改。

https://ghpr

eg:把原来clone仓库修改为代理的地址 git clone --recursive https://ghpr

或者像我之前的文章https://bbs.deepin.org/zh/post/248585,这样先拉取到自己的仓库再进行clone。

image.png

当我输入ls 的时候 后面内容就自动提示了,这时候按→键就自动补全了。

但是,这时候你会发现你重启终端的时候,这个自动补全的提示就没了。

这时候我们需要修改个人用户目录下的 .bashrc 文件

可以通过 vim 或者 vi 进行编辑

vi ~/.bashrc  #或者  vim ~/.bashrc 
# bashrc

#将这一行放在文件内容开头
[[ $- == *i* ]] && source /path/to/blesh/ble.sh --noattach 
# /path/to/blesh/     这部分要根据自己的实际情况修改
#如果刚才和我文章一样执行的话 是在 ~/ble.sh/out/ble.sh 
#所以为: [[ $- == *i* ]] && source ~/ble.sh/out/ble.sh  --noattach
# your bashrc settings come here...

#这一行放在文件内容末尾
[[ ${BLE_VERSION-} ]] && ble-attach
source ~/.bashrc   #重新加载一下我们修改的文件

image.png

image.png

效果展示

image.png

image.png

Reply Favorite View the author
All Replies
辉夜
deepin
2023-01-30 20:33
#1

收藏了,有机会试试

Reply View the author
辉夜
deepin
2023-01-30 20:34
#2

标题错别字

Reply View the author
蔡EEPIN
deepin
2023-01-30 21:13
#3

https://ghproxy.com/ 试试哪里敏感

Reply View the author
wyz144343
deepin
2023-01-30 21:39
#4

lgq@lgq-PC:~/Desktop$ git clone --recursive https://github.com/akinomyoga/ble.sh.git
正克隆到 'ble.sh'...
fatal: unable to access 'https://github.com/akinomyoga/ble.sh.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.

没成功哦, 修改代理的方法能稍微详细点说么?

Reply View the author
Kiah
deepin
2023-01-30 23:11
#5
wyz144343

lgq@lgq-PC:~/Desktop$ git clone --recursive https://github.com/akinomyoga/ble.sh.git
正克隆到 'ble.sh'...
fatal: unable to access 'https://github.com/akinomyoga/ble.sh.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.

没成功哦, 修改代理的方法能稍微详细点说么?

git clone --recursive https://ghpr《》oxy.com/https://github.com/akinomyoga/ble.sh.git

克隆地址修改为这个链接。

真的敏感呀,发布出去

Reply View the author
Kiah
deepin
2023-01-30 23:13
#6
蔡EEPIN

https://ghproxy.com/ 试试哪里敏感

为什么你发的出去啊????我一发就铭感

Reply View the author
蔡EEPIN
deepin
2023-01-30 23:22
#7
Kiah

为什么你发的出去啊????我一发就铭感

我也不知道啊。。我就随手一发

Reply View the author
master
deepin
2023-04-25 05:25
#8

太赞了.用过一段zsh,有时候处理一些带变量的命令的时候会出问题,今天重新安装了 20.9,就看到这个帖子了.果断测试了一下,很好用.感谢楼主啊.

截图_deepin-terminal_20230424212230.jpg

Reply View the author
master
deepin
2023-04-27 01:37
#9

发现一个bug,直接复制上去的命令,如果后边带回车的话,或者是复制两行命令的时候,就会报错了

-- MULTILINE -- (RET or C-m: insert a newline, C-j: run)

image.png

也不一定是bug,或许是我不会使用.

Reply View the author
Kiah
deepin
2023-05-04 07:32
#10
master

发现一个bug,直接复制上去的命令,如果后边带回车的话,或者是复制两行命令的时候,就会报错了

-- MULTILINE -- (RET or C-m: insert a newline, C-j: run)

image.png

也不一定是bug,或许是我不会使用.

我没有遇到这种情况,如果有解决方案可以分享一下。

Reply View the author
Kiah
deepin
2023-07-19 19:54
#11

大家还是用 ohmyzsh吧,我又变回 ohmyzsh了。。

Reply View the author
master
deepin
2024-11-18 14:53
#12
Kiah

大家还是用 ohmyzsh吧,我又变回 ohmyzsh了。。

哈哈哈,为啥?

Reply View the author