From c3b137ed96ec4b4ae2ed2c736c2cd7922e2a5ea9 Mon Sep 17 00:00:00 2001 From: John Costa Date: Sun, 2 Apr 2023 20:27:17 +0100 Subject: [PATCH] FEAT: Dotfiles --- .tmux.conf | 20 +++++ Scripts/OpenProdApps.bash | 2 +- config.fish | 177 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 .tmux.conf create mode 100644 config.fish diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 00000000..4c50f822 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,20 @@ +set -g default-terminal "screen-256color" + +set-option -sa terminal-overrides ",screen-256color:RGB" + +set-option -sg escape-time 10 + +set -s escape-time 0 + +set -g prefix C-a +unbind C-b +bind-key C-a send-prefix + +unbind % +bind | split-window -h + +unbind '"' +bind - split-window -v + +unbind r +bind r source-file ~/.tmux.conf diff --git a/Scripts/OpenProdApps.bash b/Scripts/OpenProdApps.bash index 11d9ea64..f397fac1 100755 --- a/Scripts/OpenProdApps.bash +++ b/Scripts/OpenProdApps.bash @@ -3,4 +3,4 @@ google-chrome-stable --app="https://linear.app/johntech/team/JOH/active" --class raindrop & -google-chrome-stable --app="https://calendar.google.com" --class=WebApp-Calendar9598 --user-data-dir=/home/johnc/.local/share/ice/profiles/Calendar9598 & +google-chrome-stable --app="http://calendar.cron.com" --class=WebApp-Cron2444 --user-data-dir=/home/johnc/.local/share/ice/profiles/Cron2444 & diff --git a/config.fish b/config.fish new file mode 100644 index 00000000..cfbc2399 --- /dev/null +++ b/config.fish @@ -0,0 +1,177 @@ +## Set values +# Hide welcome message +set fish_greeting +set VIRTUAL_ENV_DISABLE_PROMPT "1" +set -x MANPAGER "sh -c 'col -bx | bat -l man -p'" + +# Set settings for https://github.com/franciscolourenco/done +set -U __done_min_cmd_duration 10000 +set -U __done_notification_urgency_level low + +# Custom John Costa Commands +alias v='nvim' +alias lg='lazygit' +alias p='pnpm' +alias px='pnpx' + +## Environment setup +# Apply .profile +source ~/.profile + +# Add ~/.local/bin to PATH +if test -d ~/.local/bin + if not contains -- ~/.local/bin $PATH + set -p PATH ~/.local/bin + end +end + +# Add depot_tools to PATH +if test -d ~/Applications/depot_tools + if not contains -- ~/Applications/depot_tools $PATH + set -p PATH ~/Applications/depot_tools + end +end + + +## Starship prompt +if status --is-interactive + source ("/usr/bin/starship" init fish --print-full-init | psub) +end + + +## Functions +# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang +function __history_previous_command + switch (commandline -t) + case "!" + commandline -t $history[1]; commandline -f repaint + case "*" + commandline -i ! + end +end + +function __history_previous_command_arguments + switch (commandline -t) + case "!" + commandline -t "" + commandline -f history-token-search-backward + case "*" + commandline -i '$' + end +end + +if [ "$fish_key_bindings" = fish_vi_key_bindings ]; + bind -Minsert ! __history_previous_command + bind -Minsert '$' __history_previous_command_arguments +else + bind ! __history_previous_command + bind '$' __history_previous_command_arguments +end + +# Fish command history +function history + builtin history --show-time='%F %T ' +end + +function backup --argument filename + cp $filename $filename.bak +end + +# Copy DIR1 DIR2 +function copy + set count (count $argv | tr -d \n) + if test "$count" = 2; and test -d "$argv[1]" + set from (echo $argv[1] | trim-right /) + set to (echo $argv[2]) + command cp -r $from $to + else + command cp $argv + end +end + + +## Useful aliases +# Replace ls with exa +alias ls='exa -al --color=always --group-directories-first --icons' # preferred listing +alias la='exa -a --color=always --group-directories-first --icons' # all files and dirs +alias ll='exa -l --color=always --group-directories-first --icons' # long format +alias lt='exa -aT --color=always --group-directories-first --icons' # tree listing +alias l.="exa -a | egrep '^\.'" # show only dotfiles + +# Replace some more things with better alternatives +alias cat='bat --style header --style rules --style snip --style changes --style header' +[ ! -x /usr/bin/yay ] && [ -x /usr/bin/paru ] && alias yay='paru --bottomup' + +# Common use +alias aup="pamac upgrade --aur" +alias grubup="sudo update-grub" +alias fixpacman="sudo rm /var/lib/pacman/db.lck" +alias tarnow='tar -acf ' +alias untar='tar -zxvf ' +alias wget='wget -c ' +alias rmpkg="sudo pacman -Rdd" +alias psmem='ps auxf | sort -nr -k 4' +alias psmem10='ps auxf | sort -nr -k 4 | head -10' +alias upd='sudo reflector --latest 5 --age 2 --fastest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist && sudo pacman -Syu && fish_update_completions && sudo updatedb && sudo -H DIFFPROG=meld pacdiff' +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' +alias ......='cd ../../../../..' +alias dir='dir --color=auto' +alias vdir='vdir --color=auto' +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' +alias hw='hwinfo --short' # Hardware Info +alias big="expac -H M '%m\t%n' | sort -h | nl" # Sort installed packages according to size in MB (expac must be installed) +alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages + +# Get fastest mirrors +alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist" +alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist" +alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist" +alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist" + +# Help people new to Arch +alias apt='man pacman' +alias apt-get='man pacman' +alias pacdiff='sudo -H DIFFPROG=meld pacdiff' # Compare .pacnew & .pacsave files +alias helpme='cht.sh --shell' +alias please='sudo' +alias tb='nc termbin.com 9999' +alias paru="paru --bottomup" + +# Cleanup orphaned packages +alias cleanup='sudo pacman -Rns (pacman -Qtdq)' + +# Get the error messages from journalctl +alias jctl="journalctl -p 3 -xb" + +# Recent installed packages +alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl" + + +## Import colorscheme from 'wal' asynchronously +if type "wal" >> /dev/null 2>&1 + cat ~/.cache/wal/sequences +end + + +## Run paleofetch if session is interactive +if status --is-interactive + # paleofetch +end + +thefuck --alias | source + +# pnpm +set -gx PNPM_HOME "/home/johnc/.local/share/pnpm" +set -gx PATH "$PNPM_HOME" $PATH + +set -gx TERM screen-256color + +# pnpm end + +# opam configuration +source /home/johnc/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true