From cab6652a51d53b8e198fbe810e789dd35e8a9d36 Mon Sep 17 00:00:00 2001 From: thek4n Date: Mon, 18 Nov 2024 22:11:38 +0300 Subject: [PATCH] zsh refactoring --- home/user/.config/tmux/mappings.conf | 13 +------- home/user/.config/zsh/export | 49 ---------------------------- home/user/.config/zsh/history | 6 ++++ home/user/.config/zsh/plugin | 14 ++++---- home/user/.zshenv | 48 ++++++++++++++++++++++++--- 5 files changed, 58 insertions(+), 72 deletions(-) delete mode 100644 home/user/.config/zsh/export diff --git a/home/user/.config/tmux/mappings.conf b/home/user/.config/tmux/mappings.conf index ef52ee3..59d3d39 100644 --- a/home/user/.config/tmux/mappings.conf +++ b/home/user/.config/tmux/mappings.conf @@ -190,22 +190,11 @@ bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down FZF_DEFAULT_OPTS="\ ---cycle ---color='gutter:-1,pointer:red,preview-border:grey,separator:grey' ---pointer='> ' ---marker='* ' +${FZF_DEFAULT_OPTS} --border=rounded --border-label-pos=bottom --preview-window=70% --no-multi ---bind -ctrl-/:toggle-preview,\ -ctrl-a:toggle-all,\ -ctrl-p:preview-up,\ -ctrl-n:preview-down,\ -ctrl-u:clear-query,\ -ctrl-o:toggle,\ -tab:replace-query\ " # Session managment diff --git a/home/user/.config/zsh/export b/home/user/.config/zsh/export deleted file mode 100644 index 16bf10b..0000000 --- a/home/user/.config/zsh/export +++ /dev/null @@ -1,49 +0,0 @@ -# vim: ft=zsh - -umask 022 - -export EDITOR="nvim" -export VISUAL="$EDITOR" - -export PAGER="less" -export LESS="-nMWiSRx4 --mouse -j2 -# 1 -+X -+F" - -if command -v "lesspipe.sh" &>/dev/null; then - export LESSOPEN="| lesspipe.sh %s" -fi - -export HISTSIZE=100000 -export HISTFILESIZE="$HISTSIZE" -export HISTCONTROL=ignoreboth:erasedups -export HISTTIMEFORMAT="%F %T " -export HISTIGNORE="&:l[lsa\.]:[bf]g:exit:q:clear:c:history:h" - -export BROWSERCLI=w3m -test -z "$BROWSER" && BROWSER=firefox -export BROWSER - -if [ -d "$HOME/.local/bin" ] ; then - export PATH="$HOME/.local/bin:$PATH" -fi - -for TMPDIR in "$TMPDIR" "$TMP" /tmp /var/tmp -do - test -d "$TMPDIR" && break -done - -export TMPDIR - -export FZF_DEFAULT_OPTS="\ ---cycle ---color='gutter:-1,pointer:red,preview-border:grey,separator:grey' ---pointer='> ' ---marker='* ' ---bind -ctrl-/:toggle-preview,\ -ctrl-a:toggle-all,\ -ctrl-p:preview-up,\ -ctrl-n:preview-down,\ -ctrl-u:clear-query,\ -ctrl-o:toggle,\ -tab:replace-query\ -" \ No newline at end of file diff --git a/home/user/.config/zsh/history b/home/user/.config/zsh/history index d9e6311..69d6dcc 100644 --- a/home/user/.config/zsh/history +++ b/home/user/.config/zsh/history @@ -12,6 +12,12 @@ setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space. setopt HIST_FIND_NO_DUPS # Do not display a line previously found. setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file. + +export HISTSIZE=100000 +export HISTFILESIZE="${HISTSIZE}" +export HISTCONTROL=ignoreboth:erasedups +export HISTTIMEFORMAT="%F %T " +export HISTIGNORE="&:l[lsa\.]:[bf]g:exit:q:clear:c:history:h" export HISTORY_IGNORE='(cd|c|q|exit|l[sal.]|[bf]g#( *)#|..|lsl|ll[a.]|cd ..)' # configure `time` format diff --git a/home/user/.config/zsh/plugin b/home/user/.config/zsh/plugin index 2365435..435a6fe 100644 --- a/home/user/.config/zsh/plugin +++ b/home/user/.config/zsh/plugin @@ -1,6 +1,6 @@ -so () { - [ -f "$1" ] && source "$1" -} + +# vim ft=zsh + install_if_not_exists() { local path="$HOME/.config/zsh/plugins/$1" @@ -14,7 +14,7 @@ install_if_not_exists zsh-users/zsh-syntax-highlighting install_if_not_exists hlissner/zsh-autopair install_if_not_exists unixorn/fzf-zsh-plugin -so ~/.config/zsh/plugins/zsh-users/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -so ~/.config/zsh/plugins/zsh-users/zsh-autosuggestions/zsh-autosuggestions.zsh -so ~/.config/zsh/plugins/hlissner/zsh-autopair/autopair.zsh -so ~/.config/zsh/plugins/unixorn/fzf-zsh-plugin/fzf-zsh-plugin.plugin.zsh \ No newline at end of file +_so ~/.config/zsh/plugins/zsh-users/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +_so ~/.config/zsh/plugins/zsh-users/zsh-autosuggestions/zsh-autosuggestions.zsh +_so ~/.config/zsh/plugins/hlissner/zsh-autopair/autopair.zsh +_so ~/.config/zsh/plugins/unixorn/fzf-zsh-plugin/fzf-zsh-plugin.plugin.zsh \ No newline at end of file diff --git a/home/user/.zshenv b/home/user/.zshenv index 13b6e66..751717a 100644 --- a/home/user/.zshenv +++ b/home/user/.zshenv @@ -1,7 +1,47 @@ -_so() { - [ -r "$1" ] && [ -f "$1" ] && source "$1" -} +# vim: ft=zsh export XDG_CONFIG_HOME="$HOME/.config" -export ZDOTDIR="$XDG_CONFIG_HOME/zsh" \ No newline at end of file +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" + +for TMPDIR in "$TMPDIR" "$TMP" /tmp /var/tmp +do + test -d "$TMPDIR" && break +done +export TMPDIR + + +export EDITOR="nvim" +export VISUAL="$EDITOR" + +export PAGER="less" +export LESS="-nMWiSRx4 --mouse -j2 -# 1 -+X -+F" +if command -v "lesspipe.sh" &>/dev/null; then + export LESSOPEN="| lesspipe.sh %s" +fi + + +export FZF_DEFAULT_OPTS="\ +--cycle +--color='gutter:-1,pointer:red,preview-border:grey,separator:grey' +--pointer='> ' +--marker='* ' +--bind +ctrl-/:toggle-preview,\ +ctrl-a:toggle-all,\ +ctrl-p:preview-up,\ +ctrl-n:preview-down,\ +ctrl-u:clear-query,\ +ctrl-o:toggle,\ +tab:replace-query\ +" + +export BROWSERCLI=w3m +test -z "${BROWSER}" && BROWSER=firefox +export BROWSER + +if [ -d "$HOME/.local/bin" ] ; then + export PATH="$HOME/.local/bin:$PATH" +fi + +umask 022 \ No newline at end of file