Replace ZDOTDIR with custom ZSH_CONFIG var and fix keybinds
Use ZSH_CONFIG instead of ZDOTDIR to avoid conflicts with zsh internals (e.g. tmux). Register custom word-movement widgets with zle -N, remove incorrect TERM="konsole" export, add local.zsh config loading, and add ~/.local/bin to PATH.
This commit is contained in:
parent
c7afff8048
commit
8fdb1e4d87
@ -1,12 +1,12 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
function zsh_add_config() {
|
function zsh_add_config() {
|
||||||
[ -f "$ZDOTDIR/$1" ] && ! [ -L "$ZDOTDIR/$1" ] && source "$ZDOTDIR/$1"
|
[ -f "$ZSH_CONFIG/$1" ] && ! [ -L "$ZSH_CONFIG/$1" ] && source "$ZSH_CONFIG/$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
function zsh_add_plugin() {
|
function zsh_add_plugin() {
|
||||||
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
|
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
|
||||||
if ! [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
|
if ! [ -d "$ZSH_CONFIG/plugins/$PLUGIN_NAME" ]; then
|
||||||
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
|
git clone "https://github.com/$1.git" "$ZSH_CONFIG/plugins/$PLUGIN_NAME"
|
||||||
fi
|
fi
|
||||||
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
|
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
|
||||||
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
|
zsh_add_config "plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
|
||||||
@ -16,8 +16,8 @@ function zsh_add_plugin() {
|
|||||||
|
|
||||||
function zsh_fpath_plugin() {
|
function zsh_fpath_plugin() {
|
||||||
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
|
PLUGIN_NAME=$(echo $1 | cut -d"/" -f2)
|
||||||
if ! [ -d "$ZDOTDIR/plugins/$PLUGIN_NAME" ]; then
|
if ! [ -d "$ZSH_CONFIG/plugins/$PLUGIN_NAME" ]; then
|
||||||
git clone "https://github.com/$1.git" "$ZDOTDIR/plugins/$PLUGIN_NAME"
|
git clone "https://github.com/$1.git" "$ZSH_CONFIG/plugins/$PLUGIN_NAME"
|
||||||
fi
|
fi
|
||||||
fpath+=($ZDOTDIR/plugins/$PLUGIN_NAME)
|
fpath+=($ZSH_CONFIG/plugins/$PLUGIN_NAME)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ WORDCHARS='~!#$%^&*(){}[]<>?+;'
|
|||||||
MOTION_WORDCHARS='~!#$%^&*(){}[]<>?+;'
|
MOTION_WORDCHARS='~!#$%^&*(){}[]<>?+;'
|
||||||
|
|
||||||
''{back,for}ward-word() WORDCHARS=$MOTION_WORDCHARS zle .$WIDGET
|
''{back,for}ward-word() WORDCHARS=$MOTION_WORDCHARS zle .$WIDGET
|
||||||
|
zle -N backward-word
|
||||||
|
zle -N forward-word
|
||||||
|
|
||||||
bindkey '^[[1;3C' forward-word
|
bindkey '^[[1;3C' forward-word
|
||||||
bindkey '^[[1;3D' backward-word
|
bindkey '^[[1;3D' backward-word
|
||||||
|
|||||||
13
.zshrc
13
.zshrc
@ -4,26 +4,29 @@ HISTFILE="$HOME/.zsh_history"
|
|||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
SAVEHIST=10000
|
SAVEHIST=10000
|
||||||
|
|
||||||
export PATH="/usr/local/ubin:$HOME/bin:$HOME/go/bin:$HOME/.cargo/bin:$PATH"
|
export PATH="/usr/local/ubin:$HOME/bin:$HOME/go/bin:$HOME/.cargo/bin:$home/.local/bin:$PATH"
|
||||||
export EDITOR="vim"
|
export EDITOR="vim"
|
||||||
export TERMINAL="konsole"
|
export TERMINAL="konsole"
|
||||||
export TERM="konsole"
|
|
||||||
export BROWSER="firefox"
|
export BROWSER="firefox"
|
||||||
export VIDEO="mpv"
|
export VIDEO="mpv"
|
||||||
export OPENER="xdg-open"
|
export OPENER="xdg-open"
|
||||||
export GOPATH="$HOME/go"
|
export GOPATH="$HOME/go"
|
||||||
|
|
||||||
export ZDOTDIR="$HOME/.config/zsh"
|
|
||||||
|
|
||||||
# Set emacs key binding.
|
# Set emacs key binding.
|
||||||
bindkey -e
|
bindkey -e
|
||||||
|
|
||||||
|
# Set zsh config directory.
|
||||||
|
ZSH_CONFIG="$HOME/.config/zsh"
|
||||||
|
|
||||||
# Import functions.
|
# Import functions.
|
||||||
source "$ZDOTDIR/functions"
|
source "$ZSH_CONFIG/functions"
|
||||||
|
|
||||||
# Set custom key bindings.
|
# Set custom key bindings.
|
||||||
zsh_add_config keybinds.zsh
|
zsh_add_config keybinds.zsh
|
||||||
|
|
||||||
|
# Load configs local to the system.
|
||||||
|
zsh_add_config local.zsh
|
||||||
|
|
||||||
# Configure pure-prompt.
|
# Configure pure-prompt.
|
||||||
export PURE_PROMPT_SYMBOL="$"
|
export PURE_PROMPT_SYMBOL="$"
|
||||||
if [ "$USER" = "root" ]; then
|
if [ "$USER" = "root" ]; then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user