dotfiles/tools/fish/conf.d/alias.fish
js0ny a506ee28ad feats: nvim, emacs, shell
* nvim: Add copilot completions
* nvim: grug-far buffer won't show lualine & winbar now
* nvim: remove obsidian.nvim
* nvim: luasnip now works
* emacs: more keymaps in org-mode
* emacs: start customizing leader keys
* shell: Add more ls aliases
* shell: Add apt alias in fish
2025-02-10 22:37:58 +00:00

114 lines
2.7 KiB
Fish

# $DOTFILES/tools/fish/conf.d/alias.fish
# Date: 2024-12-22
# Author: js0ny
# Location:
# ~/.config/fish/conf.d/alias.fish
# Linking: Link the whole directory for submodules
# ln -sf $DOTFILES/tools/fish ~/.config/fish
# Powershell equivalent
abbr --add ni touch
abbr --add cls clear
abbr --add ii open
# Editors #
abbr --add v nvim
abbr --add c code
alias sv="sudo vim -u ~/.dotfiles/common/vim.noxdg.vimrc"
alias sn="sudo nvim -u ~/.config/nvim/init.lua"
# Dev #
abbr --add py python3
abbr --add ipy ipython
abbr --add g lazygit
# lsd - modern ls
if command -v lsd > /dev/null
alias ls='lsd'
abbr --add l 'lsd -lah'
abbr --add ll 'lsd -l'
abbr --add la 'lsd -A'
abbr --add l. 'lsd -d .*'
abbr --add tree 'ls --tree'
else
abbr --add l 'ls -lah'
abbr --add ll 'ls -l'
end
# Functions #
function mkcd
mkdir -p $argv[1] && cd $argv[1]
end
function cdls
cd $argv[1] && ls
end
function tc
touch $argv[1] && code $argv[1]
end
function tv
touch $argv[1] && nvim $argv[1]
end
# Create a new file, if the directory does not exist, create it
# Arg: a file name
function mt
mkdir -p (dirname $argv[1]) && touch $argv[1]
end
function mtv
mkdir -p (dirname $argv[1]) && touch $argv[1] && nvim $argv[1]
end
# Use neovide as gVim
abbr --add gvi "neovide"
if command -v brew > /dev/null
abbr --add brewi "brew install"
abbr --add brewu "brew upgrade && brew update"
abbr --add brewr "brew remove"
abbr --add brewc "brew cleanup"
abbr --add brewl "brew list"
end
if command -v pacman > /dev/null
abbr --add pac "sudo pacman"
abbr --add paci "sudo pacman -S"
abbr --add pacr "sudo pacman -R"
abbr --add pacu "sudo pacman -Syu"
abbr --add pacl "pacman -Q"
if command -v paru > /dev/null
abbr --add pacs "paru -Ss"
else if command -v yay > /dev/null
abbr --add pacs "yay -Ss"
else
abbr --add pacs "pacman -Ss"
end
end
if command -v apt > /dev/null
abbr --add apt "sudo apt"
abbr --add apti "sudo apt install"
abbr --add aptr "sudo apt remove"
abbr --add aptu "sudo apt update && sudo apt upgrade"
abbr --add apts "apt search"
abbr --add aptl "apt list --installed"
end
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
abbr --add icat "kitten icat"
else if test "$TERM_PROGRAM" = "WezTerm"
if test "$WSL_DISTRO_NAME"
abbr --add icat "wezterm.exe imgcat"
else
abbr --add icat "wezterm imgcat"
end
end
# Bash Style Command Substitution
# https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$)
function __last_history_item; echo $history[1]; end
abbr -a !! --position anywhere --function __last_history_item