diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml index dd65020..f89b33c 100644 --- a/alacritty/alacritty.toml +++ b/alacritty/alacritty.toml @@ -161,7 +161,7 @@ live_config_reload = true working_directory = "None" [terminal.shell] -program = "/usr/bin/sh" -args = ["-c", "fastfetch && exec nu"] +program = "/usr/bin/fish" + diff --git a/fastfetch/config.jsonc b/fastfetch/config.jsonc index 2584afe..33233b7 100644 --- a/fastfetch/config.jsonc +++ b/fastfetch/config.jsonc @@ -107,7 +107,7 @@ "key": "│ ╠ Shell │", "keyColor": "blue", "outputColor": "blue", - "format": "nushell", + "format": "{1}", }, { "type": "terminal", diff --git a/fish/cachyos-config.fish b/fish/cachyos-config.fish new file mode 100644 index 0000000..90072e3 --- /dev/null +++ b/fish/cachyos-config.fish @@ -0,0 +1,137 @@ +## Source from conf.d before our fish config +source ~/.config/fish/conf.d/done.fish + +## Set values +## Run fastfetch as welcome message +function fish_greeting + fastfetch +end + +# Format man pages +set -x MANROFFOPT -c +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 + +## Environment setup +# Apply .profile: use this to put fish compatible .profile stuff in +if test -f ~/.fish_profile + source ~/.fish_profile +end + +# 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 + +## 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 eza +alias ls='eza -al --color=always --group-directories-first --icons' # preferred listing +alias la='eza -a --color=always --group-directories-first --icons' # all files and dirs +alias ll='eza -l --color=always --group-directories-first --icons' # long format +alias lt='eza -aT --color=always --group-directories-first --icons' # tree listing +alias l.="eza -a | grep -e '^\.'" # show only dotfiles + +# Common use +alias grubup="sudo grub-mkconfig -o /boot/grub/grub.cfg" +alias fixpacman="sudo rm /var/lib/pacman/db.lck" +alias tarnow='tar -acf ' +alias untar='tar -zxvf ' +alias wget='wget -c ' +alias psmem='ps auxf | sort -nr -k 4' +alias psmem10='ps auxf | sort -nr -k 4 | head -10' +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 +alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages +alias update='sudo pacman -Syu' + +# Get fastest mirrors +alias mirror="sudo cachyos-rate-mirrors" + +# Help people new to Arch +alias apt='man pacman' +alias apt-get='man pacman' +alias please='sudo' +alias tb='nc termbin.com 9999' + +# 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" diff --git a/fish/conf.d/done.fish b/fish/conf.d/done.fish new file mode 100644 index 0000000..9252660 --- /dev/null +++ b/fish/conf.d/done.fish @@ -0,0 +1,340 @@ +# MIT License + +# Copyright (c) 2016 Francisco Lourenço & Daniel Wehner + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +if not status is-interactive + exit +end + +set -g __done_version 1.19.1 + +function __done_run_powershell_script + set -l powershell_exe (command --search "powershell.exe") + + if test $status -ne 0 + and command --search wslvar + + set -l powershell_exe (wslpath (wslvar windir)/System32/WindowsPowerShell/v1.0/powershell.exe) + end + + if string length --quiet "$powershell_exe" + and test -x "$powershell_exe" + + set cmd (string escape $argv) + + eval "$powershell_exe -Command $cmd" + end +end + +function __done_windows_notification -a title -a message + if test "$__done_notify_sound" -eq 1 + set soundopt "