-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- migrate bulk to bashrc - get rid of some old unused functions
- Loading branch information
PalaceChan
authored and
PalaceChan
committed
Dec 8, 2024
1 parent
42b940e
commit 69dcc9a
Showing
2 changed files
with
72 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,11 @@ | ||
function ff() | ||
{ | ||
find -type f -iname "*${1}*" | ||
} | ||
|
||
function cg() | ||
{ | ||
find . \( -iname "*.[CcHh]" -o -iname "*.cpp" -o -iname "*.hpp" \) | parallel -j150% -n 1000 "grep -nHi "$1" {}" | ||
} | ||
|
||
function mg() | ||
{ | ||
find . \( -iname "*.mk" -o -iname "*makefile*" \) -exec grep -nHi "$1" {} \; | ||
} | ||
|
||
function xmlg() | ||
{ | ||
find . \( -iname "*.xml" \) | parallel -j150% -n 1000 "grep -nHi "$1" {}" | ||
} | ||
|
||
function mgrep() | ||
{ | ||
CMD='' | ||
while (($#)); do | ||
CMD="$CMD grep '$1' | "; | ||
shift; | ||
done; | ||
eval ${CMD%| } | ||
} | ||
|
||
function ediff | ||
{ | ||
if [ -d $1 ]; then | ||
emacsclient -q -eval "(ztree-diff \"$1\" \"$2\")" | ||
else | ||
emacsclient -q -eval "(ediff-files \"$1\" \"$2\")" | ||
fi | ||
} | ||
|
||
################################################################################ | ||
|
||
alias e='/usr/bin/emacsclient -n' | ||
alias ew='/usr/bin/emacs -Q -nw' | ||
alias hist='cat ~/history/history.txt' | ||
alias ls='ls --color=auto -h' | ||
alias reset='echo -e \\033c' | ||
alias rc='source ~/.bash_profile' | ||
alias R='R --no-save --no-restore-data --quiet' | ||
|
||
if [ "eterm-color" == "$TERM" ]; then | ||
alias less='cat' | ||
alias more='cat' | ||
export PAGER=cat | ||
export EDITOR=emacsclient | ||
else | ||
export EDITOR='emacs -nw' | ||
if [ -f ~/.bashrc ]; then | ||
source ~/.bashrc | ||
fi | ||
|
||
################################################################################ | ||
|
||
export LESS='-iMFXR' #cat if fits | ||
|
||
export R_HISTFILE="~/.Rhistory" | ||
|
||
export HISTSIZE= | ||
export HISTFILESIZE= | ||
export HISTTIMEFORMAT='%Y%m%d %T ' | ||
export HISTFILE=~/.bash_eternal_history | ||
|
||
PROMPT_COMMAND='history -a; history 1 | ~/history/dump_history.sh' | ||
export PROMPT_COMMAND | ||
# Env | ||
|
||
PATH=$PATH:~/scripts | ||
PATH=$PATH:~/.local/bin | ||
export PATH | ||
|
||
export PS1='\h: ' | ||
xset r rate 200 70 | ||
|
||
################################################################################ | ||
|
||
function vterm_printf() { | ||
if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ]); then | ||
# Tell tmux to pass the escape sequences through | ||
printf "\ePtmux;\e\e]%s\007\e\\" "$1" | ||
elif [ "${TERM%%-*}" = "screen" ]; then | ||
# GNU screen (screen, screen-256color, screen-256color-bce) | ||
printf "\eP\e]%s\007\e\\" "$1" | ||
else | ||
printf "\e]%s\e\\" "$1" | ||
fi | ||
} | ||
|
||
function vterm_prompt_end() | ||
{ | ||
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)" | ||
} | ||
|
||
PS1=$PS1'\[$(vterm_prompt_end)\]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,69 @@ | ||
source /home/$USER/.bash_profile | ||
# Functions | ||
|
||
function ff() | ||
{ | ||
local dir="${2:-.}" | ||
find "$dir" -type f -iname "*${1}*" 2>/dev/null | ||
} | ||
|
||
function mgrep() | ||
{ | ||
CMD='' | ||
while (($#)); do | ||
CMD="$CMD grep '$1' | "; | ||
shift; | ||
done; | ||
eval ${CMD%| } | ||
} | ||
|
||
function vterm_printf() { | ||
if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ]); then | ||
# Tell tmux to pass the escape sequences through | ||
printf "\ePtmux;\e\e]%s\007\e\\" "$1" | ||
elif [ "${TERM%%-*}" = "screen" ]; then | ||
# GNU screen (screen, screen-256color, screen-256color-bce) | ||
printf "\eP\e]%s\007\e\\" "$1" | ||
else | ||
printf "\e]%s\e\\" "$1" | ||
fi | ||
} | ||
|
||
function vterm_prompt_end() | ||
{ | ||
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)" | ||
} | ||
|
||
# Aliases coca rata | ||
|
||
alias e='/usr/bin/emacsclient -n' | ||
alias ew='/usr/bin/emacs -Q -nw' | ||
alias hist='cat ~/history/history.txt' | ||
alias ls='ls --color=auto -h' | ||
alias reset='echo -e \\033c' | ||
alias rc='source ~/.bash_profile' | ||
alias R='R --no-save --no-restore-data --quiet' | ||
|
||
if [ "eterm-color" == "$TERM" ]; then | ||
alias less='cat' | ||
alias more='cat' | ||
export PAGER=cat | ||
export EDITOR=emacsclient | ||
else | ||
export EDITOR='emacs -nw' | ||
fi | ||
|
||
# Env | ||
|
||
export PS1='\h: ' | ||
PS1=$PS1'\[$(vterm_prompt_end)\]' | ||
|
||
export LESS='-iMFXR' #cat if fits | ||
|
||
export R_HISTFILE="~/.Rhistory" | ||
|
||
export HISTSIZE= | ||
export HISTFILESIZE= | ||
export HISTTIMEFORMAT='%Y%m%d %T ' | ||
export HISTFILE=~/.bash_eternal_history | ||
|
||
export PROMPT_COMMAND='history -a; history 1 | ~/history/dump_history.sh' |