From 6b51bdcb88d71027e3edc71c6b5e6c0069e29912 Mon Sep 17 00:00:00 2001 From: Rukkhadevata123 <3230102179@zju.edu.cn> Date: Mon, 14 Oct 2024 23:24:12 +0800 Subject: [PATCH] Site updated: 2024-10-14 23:24:11 --- 2024/09/26/zsh/index.html | 119 +++++++++++------------------------ 2024/10/13/ubuntu/index.html | 8 +-- about/index.html | 2 +- index.html | 2 +- local-search.xml | 4 +- 5 files changed, 46 insertions(+), 89 deletions(-) diff --git a/2024/09/26/zsh/index.html b/2024/09/26/zsh/index.html index b1475e2..fec2a47 100644 --- a/2024/09/26/zsh/index.html +++ b/2024/09/26/zsh/index.html @@ -21,16 +21,16 @@ - + - + - + @@ -248,7 +248,7 @@ - 79 字 + 140 字 @@ -259,7 +259,7 @@ - 1 分钟 + 2 分钟 @@ -407,8 +407,8 @@

ChatGPT-4o辅助的zsh配置

-

zshneovim完整配置请查看本人的GitHub仓库

Zsh Key Bindings and Aliases Overview

This document provides a breakdown of the key bindings and aliases in your Zsh configuration.

-

Key Bindings

Emacs Key Bindings

+

zshneovim完整配置请查看本人的GitHub仓库

Zsh Key Bindings and Aliases Overview

This document provides a simplified and accurate breakdown of the key bindings and aliases in your Zsh configuration.

+

Essential Key Bindings

@@ -441,11 +441,11 @@

Special Bindings

Key Combination
+

Simplified Editing and Navigation

@@ -468,6 +464,10 @@

History Search Bindings

Key Combination
+
@@ -489,18 +489,15 @@

Terminfo Key Bindings

Key Combination
+

Terminfo Key Bindings

(These are optional key bindings using terminfo for portability.)

+
@@ -508,84 +505,44 @@

Application Mode Handling

Key Combination
- - - - - - - - - - - - - - -
ActionDescription
Enter Application ModeSwitch to application mode
Exit Application ModeSwitch back from application mode
-

Word Navigation Bindings

- - - - - - - - - - - - - + +
Key CombinationAction
Ctrl + Left ArrowMove backward one word
Ctrl + Right ArrowMove forward one word${terminfo[knp]}Move to the end of the history (Page Down)

Aliases

diff --git a/2024/10/13/ubuntu/index.html b/2024/10/13/ubuntu/index.html index 01fb6ff..9b75544 100644 --- a/2024/10/13/ubuntu/index.html +++ b/2024/10/13/ubuntu/index.html @@ -30,7 +30,7 @@ - + @@ -249,7 +249,7 @@ - 2.2k 字 + 1.8k 字 @@ -260,7 +260,7 @@ - 19 分钟 + 15 分钟 @@ -462,7 +462,7 @@

配置zsh

安装插件

1
2
3
4
5
6
sudo apt install zsh-autosuggestions zsh-syntax-highlighting
echo 'source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc
echo 'source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc
sudo git clone https://github.com/zsh-users/zsh-history-substring-search.git /usr/share/zsh-history-substring-search
echo 'source /usr/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
source ~/.zshrc

额外配置

1
sudo apt install eza

把以下内容追加~/.zshrc文件的三个source后面

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
autoload -Uz run-help
(( ${+aliases[run-help]} )) && unalias run-help
alias help=run-help
autoload -Uz run-help-git run-help-ip run-help-openssl run-help-p4 run-help-sudo run-help-svk run-help-svn

autoload -Uz compinit promptinit
compinit
promptinit

HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000

TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'

# Case-insensitive tab completion (match lower and upper case)
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

# Use colors for completion listings (different colors for directories, files, etc.)
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"

# Enable rehash so new executables in the PATH are automatically found
zstyle ':completion:*' rehash true

# Enable menu selection (highlight options when navigating with tab)
zstyle ':completion:*' menu select

# Automatically accept exact matches in completion, even if partially typed
zstyle ':completion:*' accept-exact '*(N)'

# Enable caching for faster completion, and define the cache path
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

# Add auto-description for completion items (shows additional information)
zstyle ':completion:*' auto-description 'specify: %d'

# Specify completion methods: first expand aliases, then complete commands
zstyle ':completion:*' completer _expand _complete

# Format the completion display with a message indicating what is being completed
zstyle ':completion:*' format 'Completing %d'

# Remove group names from completion listings
zstyle ':completion:*' group-name ''

# List prompt for showing how to navigate through completion options
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s

# Select prompt for scrolling through completion menu
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s

# Disable the use of older `compctl` completions (use new style completion)
zstyle ':completion:*' use-compctl false

# Enable verbose completion output
zstyle ':completion:*' verbose true

# Custom completion style for `kill` command, listing processes with detailed information
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'

# Set colors for the `kill` command completion (red color for process IDs)
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'

EDITOR=vim
alias c='clear'
alias nf='fastfetch'
alias pf='fastfetch'
alias ff='fastfetch'
alias ls='eza -a --icons'
alias ll='eza -al --icons'
alias lt='eza -a --tree --level=1 --icons'
alias shutdown='systemctl poweroff'
alias v='$EDITOR'
alias vim='$EDITOR'
alias wifi='nmtui'
alias Qtile='startx'
alias gs="git status"
alias ga="git add"
alias gc="git commit -m"
alias gp="git push"
alias gpl="git pull"
alias gst="git stash"
alias gsp="git stash; git pull"
alias gcheck="git checkout"
alias gcredential="git config credential.helper store"
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg'
alias res1='xrandr --output DisplayPort-0 --mode 2560x1440 --rate 165'
alias res2='xrandr --output DisplayPort-0 --mode 1920x1080 --rate 165'
alias setkb='setxkbmap de;echo "Keyboard set back to de."'
alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias gitu='git add . && git commit && git push'
alias history="history 0"
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias rm='rm -i'
alias ip='ip --color=auto'
alias la='ls -A'

setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one
setopt autocd # if only directory path is entered, cd there.
setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits.
setopt histignorespace # Don't save commands that start with space
setopt prompt_subst
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data

# Enable emacs key bindings
bindkey -e

# Key bindings using raw escape sequences
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[8~' end-of-line # End key
bindkey '^[[H' beginning-of-line # Home key (alternative)
bindkey '^[[F' end-of-line # End key (alternative)
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right arrow key
bindkey '^[[D' backward-char # Left arrow key
bindkey '^[[5~' history-beginning-search-backward # Page Up key
bindkey '^[[6~' history-beginning-search-forward # Page Down key
bindkey '^[[1;5C' forward-word # Ctrl + Right arrow (forward word)
bindkey '^[[1;5D' backward-word # Ctrl + Left arrow (backward word)
bindkey '^[[Z' undo # Shift + Tab undo last action

# Bind Ctrl+Backspace to delete the previous word
bindkey '^H' backward-kill-word # Ctrl + Backspace

# Bind Ctrl+U to delete the line before the cursor
bindkey '^U' backward-kill-line # Ctrl + U

# Ctrl + Delete (Supr) to kill the word
bindkey '^[[3;5~' kill-word # Ctrl + Delete

# Undo action with Shift + Tab
bindkey '^[[Z' undo # Shift + Tab undo

# Configure up/down keys for history substring search
bindkey '^[[A' history-substring-search-up # Up arrow
bindkey '^[[B' history-substring-search-down # Down arrow

# Magic space: perform history expansion on space
bindkey ' ' magic-space # Space bar for history expansion

# Define keys using terminfo variables for portability
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"

# Bind keys according to the terminfo values
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete

# Application mode handling for terminfo keys
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx } # Enter application mode
function zle_application_mode_stop { echoti rmkx } # Exit application mode
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi

# Up/down key bindings with search capabilities
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search

[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search

# Control + Left/Right bindings for word navigation
key[Control-Left]="${terminfo[kLFT5]}"
key[Control-Right]="${terminfo[kRIT5]}"

[[ -n "${key[Control-Left]}" ]] && bindkey -- "${key[Control-Left]}" backward-word
[[ -n "${key[Control-Right]}" ]] && bindkey -- "${key[Control-Right]}" forward-word

# Use lesspipe for better handling of non-text files
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout

# Color man pages
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
+
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
autoload -Uz run-help
(( ${+aliases[run-help]} )) && unalias run-help
alias help=run-help
autoload -Uz run-help-git run-help-ip run-help-openssl run-help-p4 run-help-sudo run-help-svk run-help-svn

autoload -Uz compinit promptinit
compinit
promptinit

HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000

TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'

# Case-insensitive tab completion (match lower and upper case)
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

# Use colors for completion listings (different colors for directories, files, etc.)
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"

# Enable rehash so new executables in the PATH are automatically found
zstyle ':completion:*' rehash true

# Enable menu selection (highlight options when navigating with tab)
zstyle ':completion:*' menu select

# Automatically accept exact matches in completion, even if partially typed
zstyle ':completion:*' accept-exact '*(N)'

# Enable caching for faster completion, and define the cache path
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

# Add auto-description for completion items (shows additional information)
zstyle ':completion:*' auto-description 'specify: %d'

# Specify completion methods: first expand aliases, then complete commands
zstyle ':completion:*' completer _expand _complete

# Format the completion display with a message indicating what is being completed
zstyle ':completion:*' format 'Completing %d'

# Remove group names from completion listings
zstyle ':completion:*' group-name ''

# List prompt for showing how to navigate through completion options
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s

# Select prompt for scrolling through completion menu
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s

# Disable the use of older `compctl` completions (use new style completion)
zstyle ':completion:*' use-compctl false

# Enable verbose completion output
zstyle ':completion:*' verbose true

# Custom completion style for `kill` command, listing processes with detailed information
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'

# Set colors for the `kill` command completion (red color for process IDs)
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'

EDITOR=vim
alias c='clear'
alias nf='fastfetch'
alias pf='fastfetch'
alias ff='fastfetch'
alias ls='eza -a --icons'
alias ll='eza -al --icons'
alias lt='eza -a --tree --level=1 --icons'
alias shutdown='systemctl poweroff'
alias v='$EDITOR'
alias vim='$EDITOR'
alias wifi='nmtui'
alias Qtile='startx'
alias gs="git status"
alias ga="git add"
alias gc="git commit -m"
alias gp="git push"
alias gpl="git pull"
alias gst="git stash"
alias gsp="git stash; git pull"
alias gcheck="git checkout"
alias gcredential="git config credential.helper store"
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg'
alias res1='xrandr --output DisplayPort-0 --mode 2560x1440 --rate 165'
alias res2='xrandr --output DisplayPort-0 --mode 1920x1080 --rate 165'
alias setkb='setxkbmap de;echo "Keyboard set back to de."'
alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias gitu='git add . && git commit && git push'
alias history="history 0"
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias rm='rm -i'
alias ip='ip --color=auto'
alias la='ls -A'

setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one
setopt autocd # if only directory path is entered, cd there.
setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits.
setopt histignorespace # Don't save commands that start with space
setopt prompt_subst
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data

# Enable emacs key bindings
bindkey -e

# Essential key bindings
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[8~' end-of-line # End key
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right arrow key
bindkey '^[[D' backward-char # Left arrow key
bindkey '^[[5~' history-beginning-search-backward # Page Up key
bindkey '^[[6~' history-beginning-search-forward # Page Down key
bindkey '^[[1;5C' forward-word # Ctrl + Right arrow (forward word)
bindkey '^[[1;5D' backward-word # Ctrl + Left arrow (backward word)

# Simplified undo and word deletion
bindkey '^[[Z' undo # Shift + Tab undo
bindkey '^H' backward-kill-word # Ctrl + Backspace
bindkey '^U' backward-kill-line # Ctrl + U
bindkey '^[[3;5~' kill-word # Ctrl + Delete

# History search with up/down keys
bindkey '^[[A' history-substring-search-up # Up arrow
bindkey '^[[B' history-substring-search-down # Down arrow

# Use terminfo for portability (optional, for special cases)
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"

# Use lesspipe for better handling of non-text files
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout

# Color man pages
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline

再输入source ~/.zshrc即可

安装vscode

1
2
3
4
wget "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64" -O code.deb
mv code.deb /tmp
cd /tmp
sudo apt install ./code.deb
diff --git a/about/index.html b/about/index.html index f0c2fe2..a6a6faa 100644 --- a/about/index.html +++ b/about/index.html @@ -283,7 +283,7 @@

工具: GitHub Copilot, Git, Docker, VS Code

联系我

感谢你的访问!

diff --git a/index.html b/index.html index ddc016f..84fe708 100644 --- a/index.html +++ b/index.html @@ -685,7 +685,7 @@

- zsh和neovim完整配置请查看本人的GitHub仓库Zsh Key Bindings and Aliases OverviewThis document provides a breakdown of the key bindings and aliases in your Zsh configuration. Key BindingsEmacs Key Bindings Key Comb + zsh和neovim完整配置请查看本人的GitHub仓库Zsh Key Bindings and Aliases OverviewThis document provides a simplified and accurate breakdown of the key bindings and aliases in your Zsh configuration. Essential Key Bin
diff --git a/local-search.xml b/local-search.xml index b91943f..e5ff37f 100644 --- a/local-search.xml +++ b/local-search.xml @@ -8,7 +8,7 @@ /2024/10/13/ubuntu/ - 重置root密码

1
2
3
sudo su root
passwd root
exit

换源(可选)

换源前请看清楚版本, 这里以24.04为例

1
sudo nano /etc/apt/sources.list.d/ubuntu.sources

加入(或改为)以下内容

1
2
3
4
5
6
7
8
9
10
11
Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

然后刷新软件包

1
sudo apt update && sudo apt upgrade -y

打开Software & Updates, 确保这四个软件仓库都选中了

接下来服务器选择Other, 选择China再点击Select Best Server选择最佳镜像站点

更新系统

1
sudo apt update && sudo apt upgrade -y

加速Snap(存疑)

1
2
sudo snap install snap-store-proxy snap-store-proxy-client
sudo snap refresh

安装解码器和微软字体

1
sudo apt install ubuntu-restricted-addons ubuntu-restricted-extras -y

添加中文(和日语)语言包

安装语言包和输入法

打开Language Support, 添加所需语言, 重启即可

重启后, 去设置添加中文智能拼音, 开启云拼音和词典, 和Manjaro一样

对于日文输入法, 安装后重启, 在设置添加, 并编辑~/.config/mozc/ibus_config.textproto修改active_on_launchTrue

重启输入法

1
ibus write-cache; ibus restart

修复字形

1
sudo gnome-text-editor /etc/fonts/conf.d/64-language-selector-cjk-prefer.conf

修改为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Sans CJK SC</family> <!-- 简体中文 -->
<family>Noto Sans CJK TC</family> <!-- 繁体中文 -->
<family>Noto Sans CJK HK</family> <!-- 香港繁体中文 -->
<family>Noto Sans CJK KR</family> <!-- 韩文 -->
<family>Noto Sans CJK JP</family> <!-- 日文 -->
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>Noto Serif CJK SC</family> <!-- 简体中文 -->
<family>Noto Serif CJK TC</family> <!-- 繁体中文 -->
<family>Noto Serif CJK HK</family> <!-- 香港繁体中文 -->
<family>Noto Serif CJK KR</family> <!-- 韩文 -->
<family>Noto Serif CJK JP</family> <!-- 日文 -->
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Sans Mono CJK SC</family> <!-- 简体中文 -->
<family>Noto Sans Mono CJK TC</family> <!-- 繁体中文 -->
<family>Noto Sans Mono CJK HK</family> <!-- 香港繁体中文 -->
<family>Noto Sans Mono CJK KR</family> <!-- 韩文 -->
<family>Noto Sans Mono CJK JP</family> <!-- 日文 -->
</prefer>
</alias>
</fontconfig>
1
fc-cache -f -v

配置代理

安装拓展

1
2
sudo apt install -y chrome-gnome-shell gnome-shell-extensions gnome-shell-ubuntu-extensions $(apt search gnome-shell-extension- | grep "gnome-shell-extension-" | awk -F '/' '{ print $1 }')
sudo reboot

其他可以在浏览器安装

配置拓展, 设置, 优化等和Manjaro大同小异

需要注意的是, ubuntu-dockdash-to-dock只能开一个

1
sudo apt install gnome-tweaks

美化终端

安装编程字体

1
2
3
4
5
cd
wget https://ghproxy.cn/https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/FiraCode.zip
unzip FiraCode.zip -d ~/.local/share/fonts
rm FiraCode.zip
fc-cache -fv

然后在gnome-terminal改成FiraCodeNerd字体即可

安装zsh

1
2
3
4
sudo apt install zsh
touch ~/.zshrc
chsh -s /usr/bin/zsh
reboot

安装p10k(主题)

1
2
3
4
sudo apt install git
git clone --depth=1 https://ghproxy.cn/https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
zsh

然后回答完所有问题即可

配置zsh

安装插件

1
2
3
4
5
6
sudo apt install zsh-autosuggestions zsh-syntax-highlighting
echo 'source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc
echo 'source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc
sudo git clone https://github.com/zsh-users/zsh-history-substring-search.git /usr/share/zsh-history-substring-search
echo 'source /usr/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
source ~/.zshrc

额外配置

1
sudo apt install eza

把以下内容追加~/.zshrc文件的三个source后面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
autoload -Uz run-help
(( ${+aliases[run-help]} )) && unalias run-help
alias help=run-help
autoload -Uz run-help-git run-help-ip run-help-openssl run-help-p4 run-help-sudo run-help-svk run-help-svn

autoload -Uz compinit promptinit
compinit
promptinit

HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000

TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'

# Case-insensitive tab completion (match lower and upper case)
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

# Use colors for completion listings (different colors for directories, files, etc.)
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"

# Enable rehash so new executables in the PATH are automatically found
zstyle ':completion:*' rehash true

# Enable menu selection (highlight options when navigating with tab)
zstyle ':completion:*' menu select

# Automatically accept exact matches in completion, even if partially typed
zstyle ':completion:*' accept-exact '*(N)'

# Enable caching for faster completion, and define the cache path
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

# Add auto-description for completion items (shows additional information)
zstyle ':completion:*' auto-description 'specify: %d'

# Specify completion methods: first expand aliases, then complete commands
zstyle ':completion:*' completer _expand _complete

# Format the completion display with a message indicating what is being completed
zstyle ':completion:*' format 'Completing %d'

# Remove group names from completion listings
zstyle ':completion:*' group-name ''

# List prompt for showing how to navigate through completion options
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s

# Select prompt for scrolling through completion menu
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s

# Disable the use of older `compctl` completions (use new style completion)
zstyle ':completion:*' use-compctl false

# Enable verbose completion output
zstyle ':completion:*' verbose true

# Custom completion style for `kill` command, listing processes with detailed information
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'

# Set colors for the `kill` command completion (red color for process IDs)
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'

EDITOR=vim
alias c='clear'
alias nf='fastfetch'
alias pf='fastfetch'
alias ff='fastfetch'
alias ls='eza -a --icons'
alias ll='eza -al --icons'
alias lt='eza -a --tree --level=1 --icons'
alias shutdown='systemctl poweroff'
alias v='$EDITOR'
alias vim='$EDITOR'
alias wifi='nmtui'
alias Qtile='startx'
alias gs="git status"
alias ga="git add"
alias gc="git commit -m"
alias gp="git push"
alias gpl="git pull"
alias gst="git stash"
alias gsp="git stash; git pull"
alias gcheck="git checkout"
alias gcredential="git config credential.helper store"
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg'
alias res1='xrandr --output DisplayPort-0 --mode 2560x1440 --rate 165'
alias res2='xrandr --output DisplayPort-0 --mode 1920x1080 --rate 165'
alias setkb='setxkbmap de;echo "Keyboard set back to de."'
alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias gitu='git add . && git commit && git push'
alias history="history 0"
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias rm='rm -i'
alias ip='ip --color=auto'
alias la='ls -A'

setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one
setopt autocd # if only directory path is entered, cd there.
setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits.
setopt histignorespace # Don't save commands that start with space
setopt prompt_subst
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data

# Enable emacs key bindings
bindkey -e

# Key bindings using raw escape sequences
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[8~' end-of-line # End key
bindkey '^[[H' beginning-of-line # Home key (alternative)
bindkey '^[[F' end-of-line # End key (alternative)
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right arrow key
bindkey '^[[D' backward-char # Left arrow key
bindkey '^[[5~' history-beginning-search-backward # Page Up key
bindkey '^[[6~' history-beginning-search-forward # Page Down key
bindkey '^[[1;5C' forward-word # Ctrl + Right arrow (forward word)
bindkey '^[[1;5D' backward-word # Ctrl + Left arrow (backward word)
bindkey '^[[Z' undo # Shift + Tab undo last action

# Bind Ctrl+Backspace to delete the previous word
bindkey '^H' backward-kill-word # Ctrl + Backspace

# Bind Ctrl+U to delete the line before the cursor
bindkey '^U' backward-kill-line # Ctrl + U

# Ctrl + Delete (Supr) to kill the word
bindkey '^[[3;5~' kill-word # Ctrl + Delete

# Undo action with Shift + Tab
bindkey '^[[Z' undo # Shift + Tab undo

# Configure up/down keys for history substring search
bindkey '^[[A' history-substring-search-up # Up arrow
bindkey '^[[B' history-substring-search-down # Down arrow

# Magic space: perform history expansion on space
bindkey ' ' magic-space # Space bar for history expansion

# Define keys using terminfo variables for portability
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"

# Bind keys according to the terminfo values
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete

# Application mode handling for terminfo keys
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx } # Enter application mode
function zle_application_mode_stop { echoti rmkx } # Exit application mode
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi

# Up/down key bindings with search capabilities
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search

[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search

# Control + Left/Right bindings for word navigation
key[Control-Left]="${terminfo[kLFT5]}"
key[Control-Right]="${terminfo[kRIT5]}"

[[ -n "${key[Control-Left]}" ]] && bindkey -- "${key[Control-Left]}" backward-word
[[ -n "${key[Control-Right]}" ]] && bindkey -- "${key[Control-Right]}" forward-word

# Use lesspipe for better handling of non-text files
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout

# Color man pages
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline

再输入source ~/.zshrc即可

安装vscode

1
2
3
4
wget "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64" -O code.deb
mv code.deb /tmp
cd /tmp
sudo apt install ./code.deb
]]> + 重置root密码
1
2
3
sudo su root
passwd root
exit

换源(可选)

换源前请看清楚版本, 这里以24.04为例

1
sudo nano /etc/apt/sources.list.d/ubuntu.sources

加入(或改为)以下内容

1
2
3
4
5
6
7
8
9
10
11
Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

然后刷新软件包

1
sudo apt update && sudo apt upgrade -y

打开Software & Updates, 确保这四个软件仓库都选中了

接下来服务器选择Other, 选择China再点击Select Best Server选择最佳镜像站点

更新系统

1
sudo apt update && sudo apt upgrade -y

加速Snap(存疑)

1
2
sudo snap install snap-store-proxy snap-store-proxy-client
sudo snap refresh

安装解码器和微软字体

1
sudo apt install ubuntu-restricted-addons ubuntu-restricted-extras -y

添加中文(和日语)语言包

安装语言包和输入法

打开Language Support, 添加所需语言, 重启即可

重启后, 去设置添加中文智能拼音, 开启云拼音和词典, 和Manjaro一样

对于日文输入法, 安装后重启, 在设置添加, 并编辑~/.config/mozc/ibus_config.textproto修改active_on_launchTrue

重启输入法

1
ibus write-cache; ibus restart

修复字形

1
sudo gnome-text-editor /etc/fonts/conf.d/64-language-selector-cjk-prefer.conf

修改为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer>
<family>Noto Sans CJK SC</family> <!-- 简体中文 -->
<family>Noto Sans CJK TC</family> <!-- 繁体中文 -->
<family>Noto Sans CJK HK</family> <!-- 香港繁体中文 -->
<family>Noto Sans CJK KR</family> <!-- 韩文 -->
<family>Noto Sans CJK JP</family> <!-- 日文 -->
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>Noto Serif CJK SC</family> <!-- 简体中文 -->
<family>Noto Serif CJK TC</family> <!-- 繁体中文 -->
<family>Noto Serif CJK HK</family> <!-- 香港繁体中文 -->
<family>Noto Serif CJK KR</family> <!-- 韩文 -->
<family>Noto Serif CJK JP</family> <!-- 日文 -->
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Noto Sans Mono CJK SC</family> <!-- 简体中文 -->
<family>Noto Sans Mono CJK TC</family> <!-- 繁体中文 -->
<family>Noto Sans Mono CJK HK</family> <!-- 香港繁体中文 -->
<family>Noto Sans Mono CJK KR</family> <!-- 韩文 -->
<family>Noto Sans Mono CJK JP</family> <!-- 日文 -->
</prefer>
</alias>
</fontconfig>
1
fc-cache -f -v

配置代理

安装拓展

1
2
sudo apt install -y chrome-gnome-shell gnome-shell-extensions gnome-shell-ubuntu-extensions $(apt search gnome-shell-extension- | grep "gnome-shell-extension-" | awk -F '/' '{ print $1 }')
sudo reboot

其他可以在浏览器安装

配置拓展, 设置, 优化等和Manjaro大同小异

需要注意的是, ubuntu-dockdash-to-dock只能开一个

1
sudo apt install gnome-tweaks

美化终端

安装编程字体

1
2
3
4
5
cd
wget https://ghproxy.cn/https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/FiraCode.zip
unzip FiraCode.zip -d ~/.local/share/fonts
rm FiraCode.zip
fc-cache -fv

然后在gnome-terminal改成FiraCodeNerd字体即可

安装zsh

1
2
3
4
sudo apt install zsh
touch ~/.zshrc
chsh -s /usr/bin/zsh
reboot

安装p10k(主题)

1
2
3
4
sudo apt install git
git clone --depth=1 https://ghproxy.cn/https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
zsh

然后回答完所有问题即可

配置zsh

安装插件

1
2
3
4
5
6
sudo apt install zsh-autosuggestions zsh-syntax-highlighting
echo 'source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc
echo 'source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc
sudo git clone https://github.com/zsh-users/zsh-history-substring-search.git /usr/share/zsh-history-substring-search
echo 'source /usr/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
source ~/.zshrc

额外配置

1
sudo apt install eza

把以下内容追加~/.zshrc文件的三个source后面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
autoload -Uz run-help
(( ${+aliases[run-help]} )) && unalias run-help
alias help=run-help
autoload -Uz run-help-git run-help-ip run-help-openssl run-help-p4 run-help-sudo run-help-svk run-help-svn

autoload -Uz compinit promptinit
compinit
promptinit

HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000

TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'

# Case-insensitive tab completion (match lower and upper case)
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

# Use colors for completion listings (different colors for directories, files, etc.)
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"

# Enable rehash so new executables in the PATH are automatically found
zstyle ':completion:*' rehash true

# Enable menu selection (highlight options when navigating with tab)
zstyle ':completion:*' menu select

# Automatically accept exact matches in completion, even if partially typed
zstyle ':completion:*' accept-exact '*(N)'

# Enable caching for faster completion, and define the cache path
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

# Add auto-description for completion items (shows additional information)
zstyle ':completion:*' auto-description 'specify: %d'

# Specify completion methods: first expand aliases, then complete commands
zstyle ':completion:*' completer _expand _complete

# Format the completion display with a message indicating what is being completed
zstyle ':completion:*' format 'Completing %d'

# Remove group names from completion listings
zstyle ':completion:*' group-name ''

# List prompt for showing how to navigate through completion options
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s

# Select prompt for scrolling through completion menu
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s

# Disable the use of older `compctl` completions (use new style completion)
zstyle ':completion:*' use-compctl false

# Enable verbose completion output
zstyle ':completion:*' verbose true

# Custom completion style for `kill` command, listing processes with detailed information
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'

# Set colors for the `kill` command completion (red color for process IDs)
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'

EDITOR=vim
alias c='clear'
alias nf='fastfetch'
alias pf='fastfetch'
alias ff='fastfetch'
alias ls='eza -a --icons'
alias ll='eza -al --icons'
alias lt='eza -a --tree --level=1 --icons'
alias shutdown='systemctl poweroff'
alias v='$EDITOR'
alias vim='$EDITOR'
alias wifi='nmtui'
alias Qtile='startx'
alias gs="git status"
alias ga="git add"
alias gc="git commit -m"
alias gp="git push"
alias gpl="git pull"
alias gst="git stash"
alias gsp="git stash; git pull"
alias gcheck="git checkout"
alias gcredential="git config credential.helper store"
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg'
alias res1='xrandr --output DisplayPort-0 --mode 2560x1440 --rate 165'
alias res2='xrandr --output DisplayPort-0 --mode 1920x1080 --rate 165'
alias setkb='setxkbmap de;echo "Keyboard set back to de."'
alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias gitu='git add . && git commit && git push'
alias history="history 0"
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias rm='rm -i'
alias ip='ip --color=auto'
alias la='ls -A'

setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups # If a new command is a duplicate, remove the older one
setopt autocd # if only directory path is entered, cd there.
setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits.
setopt histignorespace # Don't save commands that start with space
setopt prompt_subst
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data

# Enable emacs key bindings
bindkey -e

# Essential key bindings
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[8~' end-of-line # End key
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
bindkey '^[[C' forward-char # Right arrow key
bindkey '^[[D' backward-char # Left arrow key
bindkey '^[[5~' history-beginning-search-backward # Page Up key
bindkey '^[[6~' history-beginning-search-forward # Page Down key
bindkey '^[[1;5C' forward-word # Ctrl + Right arrow (forward word)
bindkey '^[[1;5D' backward-word # Ctrl + Left arrow (backward word)

# Simplified undo and word deletion
bindkey '^[[Z' undo # Shift + Tab undo
bindkey '^H' backward-kill-word # Ctrl + Backspace
bindkey '^U' backward-kill-line # Ctrl + U
bindkey '^[[3;5~' kill-word # Ctrl + Delete

# History search with up/down keys
bindkey '^[[A' history-substring-search-up # Up arrow
bindkey '^[[B' history-substring-search-down # Down arrow

# Use terminfo for portability (optional, for special cases)
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"

# Use lesspipe for better handling of non-text files
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout

# Color man pages
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline

再输入source ~/.zshrc即可

安装vscode

1
2
3
4
wget "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64" -O code.deb
mv code.deb /tmp
cd /tmp
sudo apt install ./code.deb
]]>
@@ -178,7 +178,7 @@ /2024/09/26/zsh/ - zshneovim完整配置请查看本人的GitHub仓库

Zsh Key Bindings and Aliases Overview

This document provides a breakdown of the key bindings and aliases in your Zsh configuration.

Key Bindings

Emacs Key Bindings

Key CombinationAction
HomeMove to the beginning of the line
EndMove to the end of the line
InsertToggle overwrite mode
DeleteDelete the character under the cursor
Right ArrowMove forward one character
Left ArrowMove backward one character
Page UpMove to the beginning of the history
Page DownMove to the end of the history
Ctrl + Right ArrowMove forward one word
Ctrl + Left ArrowMove backward one word
Shift + TabUndo the last action

Special Bindings

Key CombinationAction
Ctrl + BackspaceDelete the previous word
Ctrl + UDelete the line before the cursor
Ctrl + DeleteDelete the next word

History Search Bindings

Key CombinationAction
Up ArrowSearch up through history
Down ArrowSearch down through history
Space BarPerform history expansion

Terminfo Key Bindings

Key CombinationAction
HomeMove to the beginning of the line
EndMove to the end of the line
InsertToggle overwrite mode
BackspaceDelete the character before the cursor
DeleteDelete the character under the cursor
Up ArrowMove up one line or navigate history
Down ArrowMove down one line or navigate history
Left ArrowMove backward one character
Right ArrowMove forward one character
Page UpMove to the beginning of the buffer
Page DownMove to the end of the buffer
Shift + TabReverse menu completion

Application Mode Handling

ActionDescription
Enter Application ModeSwitch to application mode
Exit Application ModeSwitch back from application mode

Word Navigation Bindings

Key CombinationAction
Ctrl + Left ArrowMove backward one word
Ctrl + Right ArrowMove forward one word

Aliases

AliasCommand
cclear
nffastfetch
pffastfetch
fffastfetch
lseza -a --icons
lleza -al --icons
lteza -a --tree --level=1 --icons
shutdownsystemctl poweroff
v$EDITOR
vim$EDITOR
wifinmtui
Qtilestartx
gsgit status
gagit add
gcgit commit -m
gpgit push
gplgit pull
gstgit stash
gspgit stash; git pull
gcheckgit checkout
gcredentialgit config credential.helper store
update-grubsudo grub-mkconfig -o /boot/grub/grub.cfg
res1xrandr --output DisplayPort-0 --mode 2560x1440 --rate 165
res2xrandr --output DisplayPort-0 --mode 1920x1080 --rate 165
setkbsetxkbmap de; echo "Keyboard set back to de."
cpcp -i
dfdf -h
freefree -m
gitugit add . && git commit && git push
historyhistory 0
grepgrep --color=auto
fgrepfgrep --color=auto
egrepegrep --color=auto
diffdiff --color=auto
rmrm -i
ipip --color=auto
lals -A
]]>
+ zshneovim完整配置请查看本人的GitHub仓库

Zsh Key Bindings and Aliases Overview

This document provides a simplified and accurate breakdown of the key bindings and aliases in your Zsh configuration.

Essential Key Bindings

Key CombinationAction
HomeMove to the beginning of the line
EndMove to the end of the line
InsertToggle overwrite mode
DeleteDelete the character under the cursor
Right ArrowMove forward one character
Left ArrowMove backward one character
Page UpSearch backward through command history
Page DownSearch forward through command history
Ctrl + Right ArrowMove forward one word
Ctrl + Left ArrowMove backward one word

Simplified Editing and Navigation

Key CombinationAction
Shift + TabUndo the last action (reverse undo)
Ctrl + BackspaceDelete the previous word
Ctrl + UDelete the line before the cursor
Ctrl + DeleteDelete the next word
Key CombinationAction
Up ArrowSearch up through command history
Down ArrowSearch down through command history

Terminfo Key Bindings

(These are optional key bindings using terminfo for portability.)

Key CombinationAction
${terminfo[khome]}Move to the beginning of the line (Home)
${terminfo[kend]}Move to the end of the line (End)
${terminfo[kich1]}Toggle overwrite mode (Insert)
${terminfo[kdch1]}Delete the character under the cursor
${terminfo[kcuu1]}Move up one line or navigate history (Up)
${terminfo[kcud1]}Move down one line or navigate history (Down)
${terminfo[kcub1]}Move backward one character (Left)
${terminfo[kcuf1]}Move forward one character (Right)
${terminfo[kpp]}Move to the beginning of the history (Page Up)
${terminfo[knp]}Move to the end of the history (Page Down)

Aliases

AliasCommand
cclear
nffastfetch
pffastfetch
fffastfetch
lseza -a --icons
lleza -al --icons
lteza -a --tree --level=1 --icons
shutdownsystemctl poweroff
v$EDITOR
vim$EDITOR
wifinmtui
Qtilestartx
gsgit status
gagit add
gcgit commit -m
gpgit push
gplgit pull
gstgit stash
gspgit stash; git pull
gcheckgit checkout
gcredentialgit config credential.helper store
update-grubsudo grub-mkconfig -o /boot/grub/grub.cfg
res1xrandr --output DisplayPort-0 --mode 2560x1440 --rate 165
res2xrandr --output DisplayPort-0 --mode 1920x1080 --rate 165
setkbsetxkbmap de; echo "Keyboard set back to de."
cpcp -i
dfdf -h
freefree -m
gitugit add . && git commit && git push
historyhistory 0
grepgrep --color=auto
fgrepfgrep --color=auto
egrepegrep --color=auto
diffdiff --color=auto
rmrm -i
ipip --color=auto
lals -A
]]>