From d5b880915ea82ebfc3e34e894a859d0c2df122f3 Mon Sep 17 00:00:00 2001 From: quak Date: Mon, 20 Jan 2025 00:11:49 +0100 Subject: [PATCH] increase bash command history size changed rofi font to jetbrains mono implemented bash completions for navigate started script to use fzf for reverse command search in bash --- bashrc/.bashrc | 13 +++++------ misc/scripts/fzf-bash-history | 2 ++ misc/scripts/navigate_bash_setup.sh | 25 ++++++++++++++++++---- rofi/.config/rofi/themes/zegonix-blue.rasi | 4 ++-- 4 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 misc/scripts/fzf-bash-history diff --git a/bashrc/.bashrc b/bashrc/.bashrc index 9c00e5d..d10ac4f 100644 --- a/bashrc/.bashrc +++ b/bashrc/.bashrc @@ -2,8 +2,13 @@ # ~/.bashrc # -# disable duplicates in command history +# configure behaviour of command history +## disable duplicates in command history export HISTCONTROL=ignoreboth:erasedups +## increase history size +history_size=2000 +export HISTSIZE=${history_size} +export HISTFILESIZE=${history_size} # If not running interactively, don't do anything # [[ $- != *i* ]] && return @@ -30,7 +35,6 @@ alias diff='diff --color=always' alias bashsource='source ~/.bashrc' # short forms for tmux commands - ## run script to setup default tmux session and then attach the session ## attaching the session needs to be done from the calling shell, otherwise ## the setup script will only terminate after detaching or killing the session @@ -55,12 +59,9 @@ if [[ "$PATH" != *"dotfiles/misc/scripts/"* ]]; then export PATH=$PATH:$HOME/dotfiles/misc/scripts/ fi -# setup starship +# setup `starship` eval "$(starship init bash)" -# source shell scripts -source_list=() - ## source alias file source ~/.bash_alias diff --git a/misc/scripts/fzf-bash-history b/misc/scripts/fzf-bash-history new file mode 100644 index 0000000..a7634eb --- /dev/null +++ b/misc/scripts/fzf-bash-history @@ -0,0 +1,2 @@ + +alias test='eval $(fc -lnr 1 | fzf --tmux )' diff --git a/misc/scripts/navigate_bash_setup.sh b/misc/scripts/navigate_bash_setup.sh index e10a957..bf50885 100644 --- a/misc/scripts/navigate_bash_setup.sh +++ b/misc/scripts/navigate_bash_setup.sh @@ -5,18 +5,35 @@ __call_navigate() { eval "$(navigate ${arg_pid} $@)" } -push() { +function push { __call_navigate "push $@" } -pop() { +function pop { __call_navigate "pop $@" } -stack() { +function stack { __call_navigate "stack $@" } -book() { +function book { __call_navigate "bookmark $@" } + +# completion for `push` +function _push { + CURRENT_WORD=${COMP_WORDS[COMP_CWORD]} + DIRS="$(find . -maxdepth 1 -type d | grep -vx "." | grep -vx ".." | sed s^"./"^^)" + COMPREPLY=($(compgen -W "${DIRS}" -- $CURRENT_WORD)) +} + +# completion for `book` +function _book { + CURRENT_WORD=${COMP_WORDS[COMP_CWORD]} + BOOKMARKS="$(__call_navigate bookmark names)" + COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD)) +} + +complete -F _push push +complete -F _book book diff --git a/rofi/.config/rofi/themes/zegonix-blue.rasi b/rofi/.config/rofi/themes/zegonix-blue.rasi index cc1036c..e88ba42 100644 --- a/rofi/.config/rofi/themes/zegonix-blue.rasi +++ b/rofi/.config/rofi/themes/zegonix-blue.rasi @@ -1,5 +1,5 @@ * { - font: "Victor Mono Nerd Font 13"; + font: "JetBrains Mono Nerd Font 14"; zx-transparent: transparent; zx-white: #C8C8C8FF; @@ -121,4 +121,4 @@ button { button.selected { text-color: @zx-background; background-color: @zx-accent; -} \ No newline at end of file +}