From d2cd94502391a4cec97573fc8834ad125c9f00a7 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Tue, 26 Jan 2021 21:56:42 -0500 Subject: bash: cleaned up bashrc, deleted unused things. added alias to search clipboard from shell --- .aliases | 3 +++ .bashrc | 48 ++++++++++++++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.aliases b/.aliases index 16d5ae3..6dc7ecb 100644 --- a/.aliases +++ b/.aliases @@ -47,6 +47,9 @@ alias gl="git log" alias music='ncmpcpp' alias write='countdown $((60*20))' +#clipboard search +alias clip="clipman pick --print0 --tool=CUSTOM --tool-args=\"fzf --prompt 'pick > ' --bind 'tab:up' --cycle --read0\" --histpath=/home/lxf/.local/share/clipman-primary.json " + # rsync/s3cmd aliases alias syncw="rsync -vv --recursive --delete --checksum -P --ignore-times --exclude-from=/home/lxf/.rsync-exclude-weekly $1 $2" alias s3pics="s3cmd sync --rr --exclude '*.*' pictures/ s3://lxfpictures" diff --git a/.bashrc b/.bashrc index 0941796..e08c20b 100644 --- a/.bashrc +++ b/.bashrc @@ -1,16 +1,12 @@ #basics stty -ixon #export BROWSER="firefox-developer-edition" +export BROWSER="qutebrowser" export MOZ_DBUS_REMOTE=1 -#export BROWSER="qutebrowser" -alias vivaldi-snapshot="vivaldi-snapshot --use-gl=egl" -alias chromium="GDK_BACKEND=x11 && chromium" -export BROWSER="vivaldi-snapshot" -#export BROWSER="chromium" +#export BROWSER="vivaldi-snapshot --use-gl=egl" export EDITOR="nvim" # keep dictionaries in ~/bin/ export STARDICT_DATA_DIR="$HOME/bin/dict/" -export NOTES_DIR="$HOME/notes" export TERM="screen-256color" export GREP_COLOR='00;38;5;166' # my scripts on PATH @@ -20,9 +16,9 @@ export PATH=$PATH:$HOME/bin/bash-scripts export PATH=$PATH:$HOME/.gem/ruby/2.6.0/bin export QT_QPA_PLATFORM=wayland export QT_PLATFORM_THEME=qt5ct -#export QT_QPA_PLATFORMTHEME=qt5ct -#export XDG_SESSION_TYPE=wayland -#export GDK_BACKEND=wayland +export QT_QPA_PLATFORMTHEME=qt5ct +export XDG_SESSION_TYPE=wayland +export GDK_BACKEND=wayland # Alias definitions if [ -f ~/.aliases ]; then @@ -69,10 +65,10 @@ if type rg &> /dev/null; then export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden' export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" fi + + # Don't use ~ to define your home here, it won't work. -export wir="$HOME/writing/wired" -export reg="$HOME/writing/register" -export ars="$HOME/writing/ars-technica/" +export wir="$HOME/writing/conde/wired" export l="$HOME/writing/luxagraf/" export lux="$HOME/sites/luxagraf.net" export d="$HOME/documents" @@ -126,7 +122,12 @@ function fore(){ #search any folder like you're in nvalt: function nv() { - find ${2:-~/notes} -maxdepth ${3:-1} -type f -print0 | xargs -0 grep -li $1 + ${EDITOR:-nvim} "$(find ${2:-~/notes} -maxdepth ${3:-1} -type f -print0 | xargs -0 grep -li $1 | fzf --preview="bat {}" --preview-window=right:70%:wrap)"; +} + +#search any folder like you're in nvalt but have ripgrep at your disposal +function fn() { + ${EDITOR:-nvim} "$(rg -l $1 ${2:-~/notes} | fzf --preview="bat {}" --preview-window=right:70%:wrap)"; } # same thing, but context function nvl(){ @@ -138,20 +139,20 @@ function fnt(){ find ~/notes ~/documents/bookmarks ~/documents/reading\ notes -type f -maxdepth 2 -print0 | xargs -0 grep -$2i $1 } +function fntt(){ + ${EDITOR:-nvim} "$(rg -l $1 ~/notes/ ~/documents/bookmarks/ ~/documents/reading\ notes/ | fzf --preview="bat {}" --preview-window=right:70%:wrap)"; +} #fuzzy find function f() { - rg -l $1 ${2:-.} | fzf --preview="bat {}" --preview-window=right:70%:wrap + ${EDITOR:-nvim} "$(rg -l $1 ${2:-.} | fzf --preview="bat {}" --preview-window=right:70%:wrap)"; } +fo() { ${EDITOR:-nvim} $(rg -n '.*' "$HOME/documents/org/" | fzf --layout=reverse --height 50% --ansi | sed -E 's/(.*):([0-9]+):.*/\1 +\2/g'); } #fuzzy find file names only function ff() { ag -g "$1" ${2:-.} | fzf --preview="bat {}" --preview-window=right:70%:wrap } -# Notational Velocity -function fn() { - rg -l $1 ${2:-~/notes} | fzf --preview="bat {}" --preview-window=right:70%:wrap -} function tolux() { scp $3 $1 lxf:/home/lxf/$2 @@ -275,6 +276,10 @@ fd() { cd "$dir" } +fo() { ${EDITOR:-nvim} $(rg -n '.*' "$HOME/documents/org/" | fzf --layout=reverse --height 50% --ansi | sed -E 's/(.*):([0-9]+):.*/\1 +\2/g'); } + +fr() { ${EDITOR:-nvim} $(rg -n '.*' "$HOME/.config/remind/" | fzf --layout=reverse --height 50% --ansi | sed -E 's/(.*):([0-9]+):.*/\1 +\2/g'); } + if [[ "$OSTYPE" == "darwin"* ]]; then # OSX-SPECIFIC SETTINGS @@ -410,6 +415,13 @@ fshow() { {} FZF-EOF" } +#dirsize - finds directory sizes and lists them for the current directory +ds () { + du -shx -- * .[a-zA-Z0-9_]* 2>/dev/null | grep -E '^ *[0-9.]*[MG]' | sort -n >/tmp/list + grep -E '^ *[0-9.]*M' /tmp/list + grep -E '^ *[0-9.]*G' /tmp/list + rm /tmp/list +} RIPGREP_CONFIG_PATH=~/.ripgreprc GPG_TTY=$(tty) export GPG_TTY -- cgit v1.2.3-70-g09d2