cat .zshrc
PROMPT='%B%F{cyan}👤%n@💻%m %F{blue}📂%~ %f%b'
autoload -Uz compinit
compinit
HISTFILE=~/.zsh_history
HISTSIZE=100
SAVEHIST=100
export EDITOR="nano"
alias ll='ls -lh'
alias grep='grep --color=auto'
alias df='df -h'
alias du='du -h'
export PATH=$PATH:~/.bin
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
sudo xbps-install zsh-autosuggestions zsh-syntax-highlighting
zsh-autosuggestions
fish like completion
https://github.com/zsh-users/zsh-autosuggestions
press right arrow to accpt suggetion
move it to custom folder
cat .zshenv
export ZDOTDIR="$HOME/.zsh"
-----------------------------------------------------------------------------------------------------------------
cat ~/.zsh/.zshrc
-----------------------------------------------------------------------------------------------------------------
PROMPT='%B%F{cyan}%n@%m %F{blue}%~ %f%b'
autoload -Uz compinit
compinit
setopt MENU_COMPLETE
setopt AUTO_LIST
setopt COMPLETE_IN_WORD
setopt HIST_SAVE_NO_DUPS
# Use case-insensitive completion and fuzzy match
zstyle ':completion:*:mkdir:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' complete true
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$HOME/.zsh/cache"
zle -C alias-expension complete-word _generic
bindkey '^Xa' alias-expension
zstyle ':completion:alias-expension:*' completer _expand_alias
zstyle ':completion:*' menu select
zstyle ':completion:*' complete-options true
zstyle ':completion:*' file-sort modification
zstyle ':completion:*:functions' ignored-patterns '_*'
HISTFILE=~/.zsh_history
HISTSIZE=100
SAVEHIST=100
export EDITOR="nano"
alias ll='ls -lh'
alias grep='grep --color=auto'
alias df='df -h'
alias du='du -h'
export PATH=$PATH:~/.bin
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
MOUSE=1
setopt autocd
exp:
bindkey '^Xa' alias-expension
means ctrl+x followed by a to expand current alias without executing
- Zsh Style Configuration (
zstyle
):zstyle
is used to define and set styles that customize various aspects of Zsh's behavior.- Styles can be defined for specific contexts and associated with configuration values.
- Multiple styles can be defined for different contexts, allowing fine-tuning of Zsh's behavior.
- Common uses include customizing tab completion, prompt themes, and other customizations.
- Custom Widgets and Key Bindings (
zle
):zle
(Zsh Line Editor) is used to define custom functions, or widgets, that can be bound to keyboard keys or key sequences.- Widgets control aspects of command-line editing and user interactions in Zsh.
- Widgets can perform actions like cursor movement, text insertion, or custom functionality.
- Widgets are bound to keys or key sequences and invoked when those keys are pressed.
- Custom widgets are used to tailor the behavior of the Zsh shell, enhancing command-line interactions.
- Autoload and Compinit:
autoload -Uz compinit
loads thecompinit
function, initializing and configuring Zsh's completion system.compinit
sets up completion functions, options, and settings for advanced and context-aware tab completion.
setopt MENU_COMPLETE
:- Enables menu-based completion in Zsh, displaying a list of possible completions when the
Tab
key is pressed during tab completion. - Allows navigation and selection from the available options using arrow keys or other navigation keys.
- Enables menu-based completion in Zsh, displaying a list of possible completions when the
setopt AUTO_LIST
:- Enables automatic listing of completions as you type, without explicitly pressing
Tab
. - Provides immediate feedback on possible completions, improving efficiency.
- Enables automatic listing of completions as you type, without explicitly pressing
setopt COMPLETE_IN_WORD
:- Attempts to complete the word being typed, even if the cursor is not at the end of the word.
- Allows for more interactive word completion in the middle of a sentence.
- Completion Options:
zstyle ':completion:*' complete true
enables general completion mechanisms in various contexts.zstyle ':completion:*' complete-options true
configures specific completion options, such asauto_list
andauto_menu
.
- Function Name Completion Configuration:
zstyle ':completion:alias-expension:*' completer _expand_alias
customizes alias expansion during tab completion.zstyle ':completion:*:functions' ignored-patterns '_*'
ignores function names starting with underscores in tab completion.
- Zsh Configuration Files:
- Custom configurations, including
zstyle
,zle
, andsetopt
commands, are typically placed in~/.zshrc
to customize the Zsh shell's behavior.
- Custom configurations, including
Comments
Post a Comment