zsh & oh-my-zsh
zsh & oh-my-zsh
The pre-installed shell of most Linux distributions is bash. But, zsh is more powerfull tool on the terminal.
zsh
1 |
|
Note: Because the Shell can set different default values according to each account, so referring to the syntax of this article, a whoami technique is used to dynamically obtain the name of the currently logged-in account through the command to set it.
Install oh-my-zsh
After installing zsh in the previous step, we can start to adjust the command line appearance settings we want, but the original zsh was too difficult to set up, so it didn’t receive much attention when it first appeared many years ago, until someone wrote a set The framework called oh-my-zsh helps everyone use zsh, and zsh became popular. Now almost all zsh useful tools support oh-my-zsh, so of course it is necessary to install this thing
Installation 1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
However, oh-my-zsh has a lot of built-in themes, and there are many screenshots on its github wiki for reference > https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
It is very simple to switch the built-in theme, directly modify your ~/.zshrc, and change the original ZSH_THEME="robbyrussell" to what you want
Edit .zshrc
1 |
|
ZSH_THEME=”agnoster” # Try changing robbyrussell to agnoster After any zsh settings are modified, the following commands must be executed to take effect
1 |
|
Conda problem
1 |
|
do 1
conda init zsh
zsh-autosuggestions
1 |
|
In .zshrc, > plugins=(zsh-autosuggestions) and then, source ~/.zshrc
Usage > If you think it is correct, you can press CTRL+F to accept it
quick jump: cd -
As mentioned earlier, switching between different paths is a headache in command line work. In addition to the abbreviation completion mentioned above, is there a faster way for me to immediately switch to a certain path I recently jumped to? path? Of course there is the "cd -" command
After inputting cd followed by a minus sign, press tab once to list the recent paths visited after this login, and then enter the number according to the prompt below and press Enter to pass, for example, input:** $ cd -5 < Press Enter>** to jump to the ~/software/libclang-python3 path. Of course, instead of entering numbers, you can press tab again to enter the selection mode, use the up and down keys or ctrl+n/p to select, press Enter to confirm, and ctrl+g to return.
jump: d
Zsh's directory jump is more intelligent, you don't need to enter cd, just enter the path directly. .. means back one directory, ../../ means back two levels, and so on. (The function of ... is the same as that of ../../) Enter d to list all directories visited by the current session, and then press the number prompted to enter the corresponding directory. 1
2
3
4
5
6
7~ > d
0 ~
1 ~/Applications
2 ~/.proxychains
3 /opt/homebrew-cask/Caskroom
~ > 1
~/Applications
zsh mkdir/source/...: not found
Using bash for all script, > #!/bin/bash
Building zsh without root
No terminal handling library found
Have to install ncurses 1
2wget https://invisible-island.net/ncurses/#download_ncurses
ex1
2
3
4
5
6
7
8
9
10
11
12
13
14=== output ===
** Configuration summary for NCURSES 6.3 20211021:
extended funcs: yes
xterm terminfo: xterm-new
bin directory: /home/wpsze/zsh/ncurses/bin
lib directory: /home/wpsze/zsh/ncurses/lib
include directory: /home/wpsze/zsh/ncurses/include/ncurses
man directory: /home/wpsze/zsh/ncurses/share/man
terminfo directory: /home/wpsze/zsh/ncurses/share/terminfo
** Include-directory is not in a standard location
=====
1 |
|
Error 1
2
3/usr/bin/ld: /home/wpsze/zsh/ncurses//lib/libncurses.a(comp_captab.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18zsh configuration
-----------------
zsh version : 5.9
host operating system : x86_64-pc-linux-gnu
source code location : .
compiler : gcc -std=gnu11
preprocessor flags : -I/home/wpsze/zsh/ncurses//include
executable compiler flags : -I/home/wpsze/zsh/ncurses//include -fPIC
module compiler flags : -I/home/wpsze/zsh/ncurses//include -fPIC -fPIC
executable linker flags : -L/home/wpsze/zsh/ncurses//lib -rdynamic
module linker flags : -L/home/wpsze/zsh/ncurses//lib -shared
library flags : -ldl -lncurses -lrt -lm -lc
installation basename : zsh
binary install path : /home/wpsze/zsh/bin
man page install path : /home/wpsze/zsh/share/man
info install path : /home/wpsze/zsh/share/info
functions install path : /home/wpsze/zsh/share/zsh/5.9/functions
See config.modules for installed modules and functions.cat stamp-modobjs
-ldl -lncurses -lrt -lm -lc
recompile with -fPIC
Not solved
1 |
|