Taken from https://gist.github.com/mislav/5189704, but accomodate my eccentricities.
Believe there's more advanced versions that will not engage when things like fzf are up (see)
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then | |
exec sway | |
fi |
fif() { | |
# find-in-file - usage: fif <searchTrem> Can `fif .` to search all files from cwd | |
if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi | |
rg --files-with-matches --no-messages "$1" | fzf --preview "highlight -O ansi -l {} 2> /dev/null | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' --preview-window='70%:wrap' || rg --ignore-case --pretty --context 10 '$1' {}" | |
} | |
rga-fzf() { | |
# open file after the fuzzy search of contents. Should also search pdfs, docs | |
RG_PREFIX="rga --files-with-matches" |
Taken from https://gist.github.com/mislav/5189704, but accomodate my eccentricities.
Believe there's more advanced versions that will not engage when things like fzf are up (see)
#!/bin/bash | |
# Wrapper adding janky orientation detection and wallpaper/bar reloading | |
# for mildmojo's rotate_desktop.sh found at the link below: | |
# https://gist.github.com/mildmojo/48e9025070a2ba40795c | |
# TODO allow to select polybar bar? What if I want portrait and landscape bars | |
internal="eDP-1" | |
orientation_infer () { | |
orientation="" | |
if xrandr | grep 'current 2736 x 1824'; then |
# `p` executes v cmd first and then substitutes it in place | |
# pwd | y %% echo `p` | |
if [ $XDG_SESSION_TYPE == 'wayland' ]; then | |
alias y='wl-copy' | |
alias p='wl-paste' | |
alias lns='ln -s "`wl-paste`"' | |
alias lnp='linktopaste' | |
alias cdp='cd "`wl-paste`"' | |
alias mvc='mv "`wl-paste`" ./' | |
alias ep='nvim `wl-paste`' |