Skip to content

Instantly share code, notes, and snippets.

View nickchahley's full-sized avatar

Nick Chahley nickchahley

View GitHub Profile
@nickchahley
nickchahley / .zprofile
Last active February 11, 2024 22:47
Auto login with TTY
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
exec sway
fi
@nickchahley
nickchahley / fuzzy-commands.sh
Last active February 1, 2024 18:39
fuzzy finder within files
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"
@nickchahley
nickchahley / _readme.md
Last active October 29, 2023 15:19
tmux-nvim-select-pane-colemak
@nickchahley
nickchahley / rotate.sh
Created February 15, 2019 13:51
Wrapper for mildmojo's rotate_desktop.sh: https://gist.github.com/mildmojo/48e9025070a2ba40795c
#!/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
@nickchahley
nickchahley / terminal-clipboard-utilities.sh
Last active October 29, 2023 15:35
Copy and paste between different terminals and/or the rest of the system.
# `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`'