From 1fbda2bff2ecb7fc161134a29b91430ab695d1e7 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 23 Oct 2024 16:35:06 +0200 Subject: [PATCH] Add history search and append changes --- tongfang/.bash_aliases | 3 ++- tongfang/.bashrc | 19 +++++++++++++++++++ tongfang/.ripgreprc | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tongfang/.ripgreprc diff --git a/tongfang/.bash_aliases b/tongfang/.bash_aliases index cd59276..6ff7470 100644 --- a/tongfang/.bash_aliases +++ b/tongfang/.bash_aliases @@ -2,4 +2,5 @@ alias ll='ls -la' alias lt='ls --human-readable --size -1 -S --classify' alias nrebuild='sudo nixos-rebuild --use-remote-sudo switch' alias code='codium' -alias ssh='ensure_ssh_key; ssh' \ No newline at end of file +alias ssh='ensure_ssh_key; ssh' +alias rgf='rg --files | rg' diff --git a/tongfang/.bashrc b/tongfang/.bashrc index 53c0a35..d283691 100644 --- a/tongfang/.bashrc +++ b/tongfang/.bashrc @@ -20,5 +20,24 @@ function ensure_ssh_key { fi } +# Map up/down arrow to search for history entries matching what is currently type in the command line. +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' + +export HISTSIZE=10000 +export HISTFILESIZE=10000 + +HISTCONTROL=erasedups +HISTTIMEFORMAT='%F %T ' + +shopt -s histappend +shopt -s cmdhist #Save multi line commands as one history entry +PROMPT_COMMAND='history -a' #Append to history after each command + PROMPT_DIRTRIM=2 PS1='\[\033[0;33m\][\u@\h:\w]\$\[\033[0m\] ' + +RIPGREP_CONFIG_PATH=~/.ripgreprc + +# Disable ctrl+s +stty -ixon \ No newline at end of file diff --git a/tongfang/.ripgreprc b/tongfang/.ripgreprc new file mode 100644 index 0000000..2256b46 --- /dev/null +++ b/tongfang/.ripgreprc @@ -0,0 +1 @@ +--hidden \ No newline at end of file