From f02f0e183de0092ea8c14fc59d92dd76f1e799d1 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Sat, 23 Dec 2023 20:14:14 -0700 Subject: [PATCH] New: inital vimterm config --- bash/.bash_aliases | 1 + bash/.bash_functions | 7 ++++++- bash/.bash_profile | 4 +++- bash/.bashrc | 5 +++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bash/.bash_aliases b/bash/.bash_aliases index c3aeb74..d2d4fdd 100644 --- a/bash/.bash_aliases +++ b/bash/.bash_aliases @@ -109,6 +109,7 @@ fi # nVim if command -v nvim &> /dev/null; then alias vi='nvim' vih='nvim +Rooter' + alias vit='nvim +"tnoremap " +startinsert +terminal ' elif command -v vim &> /dev/null; then alias vi='vim' vih='vim +Rooter' fi diff --git a/bash/.bash_functions b/bash/.bash_functions index ec82726..041194d 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -169,11 +169,16 @@ runk() { local calc_ver="($(echo "$@" | sed \ -e 's#log2(\([^)]\+\))#(log(\1)/log(2))#g' \ + -e 's#\([0-9]\+\)C\([0-9]\+\)#(\1! / ((\1-\2)! * (\2)!))#g' \ + -e 's#(\([^)C]\+\))C(\([^)C]\+\))#((\1)! / ((\1-(\2))! * (\2)!))#g' \ ))" local py_ver="$(echo "$@" | sed \ -e 's#\^#**#g' \ -e 's#\(log([^)]\+)\)#(\1/log(10))#g' \ -e 's#ln(\([^)]\+\))#log(\1)#g' \ + -e 's#\([0-9]\+\)C\([0-9]\+\)#(\1! / (factorial(\1-\2) * (\2)!))#g' \ + -e 's#\([0-9]\+\)!#factorial(\1)#g' \ + -e 's#(\([^)]\+\))!#factorial(\1)#g' \ )" local awk_ver="$(echo "$@" | sed \ -e 's#\*\*#^#g' \ @@ -192,7 +197,7 @@ runk() { calc "$calc_ver" if [[ $is_verbose -eq 1 ]]; then printf 'Using calc: %s\n' "$calc_ver"; fi elif command -v python3 &>/dev/null && [[ -z "$override" ]] || [[ "$override" == p ]]; then - python3 -c "from math import *; print($py_ver)" + python3 -c "from math import *; print(f\"\\t{$py_ver}\")" if [[ $is_verbose -eq 1 ]]; then printf 'Using python: %s\n' "$py_ver"; fi elif command -v gawk &>/dev/null && [[ -z "$override" ]] || [[ "$override" == a ]]; then gawk --bignum "BEGIN { print $awk_ver }" diff --git a/bash/.bash_profile b/bash/.bash_profile index 0cdbf3c..40a3b4f 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -74,7 +74,9 @@ set_starting_dir () { # ============================================================================= # Run script # ============================================================================= -source ~/.bashrc +if [[ -z $VIMRUNTIME || -n $IS_VIFM_NEST ]]; then + source ~/.bashrc +fi source ~/.bash_prompt [[ "$IS_VIFM_NEST" == 'T' ]] || print_welcome_message diff --git a/bash/.bashrc b/bash/.bashrc index 4be78d0..5fbcf12 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -10,6 +10,11 @@ source ~/.bash_functions source ~/.bash_aliases source ~/.bash_functions +if [[ -n $VIMRUNTIME && -z $IS_VIFM_NEST ]]; then + # Prevent recursive sourcing + source ~/.bash_profile +fi + # shopt -s histappend # Suppress prompt warning when switching users