Rearrange aliases, add WSL-specific clipboard aliases, reformat

This commit is contained in:
2024-11-07 15:11:12 -06:00
parent 86544ac385
commit 2bcb58f7e6

View File

@@ -1,25 +1,41 @@
# Controlled by chezmoi # Controlled by chezmoi
alias gpt='chatgpt'
alias copilot='gh copilot' # Core aliases
alias suggest='gh copilot suggest -t shell'
alias cha='chezmoi apply --interactive'
alias nano='micro'
alias ch='chezmoi'
alias copy='xsel -ib'
alias cdp='cd $(xsel -b)'
alias spt='spotify_player'
alias lg='lazygit'
alias vim='nvim'
alias gitalias='alias | grep "git "'
alias mousefix='sudo udevadm trigger'
alias ll='ls -AlFh' alias ll='ls -AlFh'
alias la='ls -Ah' alias la='ls -Ah'
alias l='ls -CF' alias l='ls -CF'
alias nano='micro'
alias lg='lazygit'
alias vim='nvim'
alias chlg='lazygit --path ~/.local/share/chezmoi'
# Chezmoi
alias cha='chezmoi apply --interactive'
alias ch='chezmoi'
# Other aliases
alias gpt='chatgpt'
alias copilot='gh copilot'
alias suggest='gh copilot suggest -t shell'
alias spt='spotify_player'
alias gitalias='alias | grep "git "'
alias mousefix='sudo udevadm trigger' # helped with mouse issues on laptop
# Clipboard aliases
{{ if not .wsl -}}
alias copy='xsel -ib'
alias paste='xsel -b'
alias cdp='cd $(xsel -b)'
{{- else -}}
alias copy='clip.exe'
alias paste='powershell.exe -noprofile Get-Clipboard'
alias cdp='cd $(xsel -b)'
{{- end }}
# fast chmod execute alias # fast chmod execute alias
function chfix() { function chfix() {
last_command=$(history | tail -n 1 | awk '{$1=""; sub(/^ /, ""); print $0}') last_command=$(history | tail -n 1 | awk '{$1=""; sub(/^ /, ""); print $0}')
if [[ -f $last_command ]]; then if [[ -f $last_command ]]; then
chmod +x $last_command chmod +x $last_command
else else
@@ -28,25 +44,21 @@ function chfix() {
} }
# https://docs.gitignore.io/install/command-line # https://docs.gitignore.io/install/command-line
function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;} function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@; }
function chcode() { function chcode() {
EDITOR="code --wait" EDITOR="code --wait"
# If no arguments are provided, the chezmoi directory is opened # If no arguments are provided, the chezmoi directory is opened
if [[ "$@" == *"--watch"* ]]; then if [[ "$@" == *"--watch"* ]]; then
for arg in "$@"; do for arg in "$@"; do
if [[ ! $arg == -* ]]; then if [[ ! $arg == -* ]]; then
chezmoi edit $@ chezmoi edit $@
return return
fi fi
done done
echo "--watch requires a file to be provided, directories aren't supported with watch mode" echo "--watch requires a file to be provided, directories aren't supported with watch mode"
fi fi
chezmoi edit $@ chezmoi edit $@
}
function chlg() {
lazygit --path ~/.local/share/chezmoi
} }
# Add an "alert" alias for long running commands. Use like so: # Add an "alert" alias for long running commands. Use like so:
@@ -76,19 +88,19 @@ maestroAddress="AC:BF:71:66:FE:B2"
alias maestroOff="bluetoothctl block $maestroAddress" alias maestroOff="bluetoothctl block $maestroAddress"
alias maestroOn="bluetoothctl unblock $maestroAddress && bluetoothctl connect $maestroAddress" alias maestroOn="bluetoothctl unblock $maestroAddress && bluetoothctl connect $maestroAddress"
function lastRuns () { function lastRuns() {
# default to 10 runs # default to 10 runs
if [ -z "$1" ]; then if [ -z "$1" ]; then
RUNS=10 RUNS=10
else else
RUNS=$1 RUNS=$1
fi fi
gh run list -L $RUNS --json name,url | jq -c '.[] | [.name, .url] | join(" ")' -r gh run list -L $RUNS --json name,url | jq -c '.[] | [.name, .url] | join(" ")' -r
} }
# Touches a file while also creating the parent directory (and any other necessary directories) in order to do so. # Touches a file while also creating the parent directory (and any other necessary directories) in order to do so.
function mktouch() { function mktouch() {
mkdir -p $(dirname $1) && touch $1; mkdir -p $(dirname $1) && touch $1
} }
# When in the appropriate KiTTy terminal, use the SSH kitten # When in the appropriate KiTTy terminal, use the SSH kitten