mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat(fish): Switch shell to fish
This commit is contained in:
parent
053304c4d5
commit
9ed1246583
16 changed files with 3389 additions and 17 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// Paste this into surfingkeys advanced settings
|
||||
// or use:
|
||||
// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/browser/surfingkeys.js
|
||||
// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/tools/browser/surfingkeys.js
|
||||
// TODO: Visual Mode
|
||||
|
||||
// #region Example
|
||||
|
|
|
|||
2
tools/fish/.gitignore
vendored
Normal file
2
tools/fish/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fish_variables
|
||||
completions
|
||||
137
tools/fish/conf.d/0init.fish
Normal file
137
tools/fish/conf.d/0init.fish
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
# $DOTFILES/tools/fish/conf.d/0init.fish
|
||||
# Date: 2024-12-19
|
||||
# Author: js0ny
|
||||
# By dictionary order, this file is sourced first in fish shell
|
||||
# Define user-specific environment variables for fish
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/0init.fish (default location)
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
set -gx DOTFILES $HOME/.dotfiles
|
||||
# XDG Base Directory Specification
|
||||
set -gx XDG_CONFIG_HOME (set -q XDG_CONFIG_HOME; and echo $XDG_CONFIG_HOME; or echo $HOME/.config)
|
||||
set -gx XDG_DATA_HOME (set -q XDG_DATA_HOME; and echo $XDG_DATA_HOME; or echo $HOME/.local/share)
|
||||
set -gx XDG_STATE_HOME (set -q XDG_STATE_HOME; and echo $XDG_STATE_HOME; or echo $HOME/.local/state)
|
||||
set -gx XDG_CACHE_HOME (set -q XDG_CACHE_HOME; and echo $XDG_CACHE_HOME; or echo $HOME/.cache)
|
||||
set -gx XDG_RUNTIME_DIR /run/user/(id -u)
|
||||
|
||||
set -gx PAGER "less -R"
|
||||
set -gx EDITOR nvim
|
||||
set -gx VISUAL nvim
|
||||
|
||||
# Minimal PATH for early commands
|
||||
set -gx PATH /usr/local/bin /usr/bin /bin /usr/sbin /sbin ~/.local/bin $PATH
|
||||
|
||||
if test -d /opt/homebrew/bin # macOS
|
||||
set -gx PATH /opt/homebrew/bin $PATH
|
||||
else if test -d /home/linuxbrew/.linuxbrew/bin # Linux
|
||||
set -gx PATH /home/linuxbrew/.linuxbrew/bin $PATH
|
||||
end
|
||||
|
||||
|
||||
# Azure CLI
|
||||
if command -v az > /dev/null
|
||||
set -gx AZURE_CONFIG_DIR $XDG_DATA_HOME/azure
|
||||
end
|
||||
# Bun JS
|
||||
if command -v bun > /dev/null
|
||||
set -gx BUN_INSTALL "$XDG_DATA_HOME/bun"
|
||||
set -gx PATH $BUN_INSTALL/bin $PATH
|
||||
end
|
||||
# Rust Cargo
|
||||
if command -v cargo > /dev/null
|
||||
set -gx CARGO_HOME $XDG_DATA_HOME/cargo
|
||||
set -gx PATH $CARGO_HOME/bin $PATH
|
||||
end
|
||||
# CGDB
|
||||
if command -v cgdb > /dev/null
|
||||
set -gx CGDB_DIR $XDG_CONFIG_HOME/cgdb
|
||||
end
|
||||
# .NET
|
||||
if command -v dotnet > /dev/null
|
||||
set -gx DOTNET_CLI_HOME $XDG_DATA_HOME/dotnet
|
||||
set -gx PATH $DOTNET_CLI_HOME/.dotnet/tools $PATH
|
||||
end
|
||||
# Docker
|
||||
if command -v docker > /dev/null
|
||||
set -gx DOCKER_CONFIG $XDG_CONFIG_HOME/docker
|
||||
end
|
||||
# GnuPG
|
||||
if command -v gpg > /dev/null
|
||||
set -gx GNUPGHOME $XDG_DATA_HOME/gnupg
|
||||
end
|
||||
# Go
|
||||
if command -v go > /dev/null
|
||||
set -gx GOPATH $XDG_DATA_HOME/go
|
||||
set PATH $GOPATH/bin $PATH
|
||||
end
|
||||
# Julia
|
||||
if command -v julia > /dev/null
|
||||
set -gx JULIA_DEPOT_PATH $XDG_DATA_HOME/julia
|
||||
end
|
||||
# Node.js
|
||||
if command -v node > /dev/null
|
||||
set -gx NODE_REPL_HISTORY $XDG_STATE_HOME/node/repl_history
|
||||
set -gx TS_NODE_REPL_HISTORY $XDG_STATE_HOME/node/ts_repl_history
|
||||
set -gx NPM_CONFIG_USERCONFIG $XDG_CONFIG_HOME/npm/npmrc
|
||||
set -gx NPM_CONFIG_INIT_MODULE $XDG_CONFIG_HOME/npm/config/npm-init.js
|
||||
set -gx NPM_CONFIG_CACHE $XDG_CACHE_HOME/npm
|
||||
set -gx NPM_CONFIG_TMP $XDG_RUNTIME_DIR/npm
|
||||
end
|
||||
# Parallel
|
||||
if command -v parallel > /dev/null
|
||||
set -gx PARALLEL_CONFIG $XDG_CONFIG_HOME/parallel
|
||||
end
|
||||
# Python
|
||||
# Works only with Python 3.13.0a3 and later
|
||||
if command -v python3 > /dev/null
|
||||
set -gx PYTHON_HISTORY $XDG_DATA_HOME/python/history
|
||||
end
|
||||
# GNU Screen
|
||||
if command -v screen > /dev/null
|
||||
set -gx SCREENRC $XDG_CONFIG_HOME/screen/screenrc
|
||||
set -gx SCREENDIR $XDG_RUNTIME_DIR/screen
|
||||
end
|
||||
# Ruby Gem
|
||||
if command -v gem > /dev/null
|
||||
for dir in $HOME/.local/share/gem/ruby/*/bin
|
||||
if test -d $dir
|
||||
set -gx PATH $dir $PATH
|
||||
end
|
||||
end
|
||||
end
|
||||
# Spacemacs
|
||||
if command -v emacs > /dev/null
|
||||
set -gx SPACEMACSDIR $XDG_CONFIG_HOME/spacemacs
|
||||
end
|
||||
# tldr
|
||||
if command -v tldr > /dev/null
|
||||
set -gx TLDR_CACHE_DIR $XDG_CACHE_HOME/tldr
|
||||
end
|
||||
# W3M
|
||||
if command -v w3m > /dev/null
|
||||
set -gx W3M_DIR $XDG_DATA_HOME/w3m
|
||||
end
|
||||
# Wakatime
|
||||
if command -v wakatime > /dev/null
|
||||
set -gx WAKATIME_HOME $XDG_CONFIG_HOME/wakatime
|
||||
end
|
||||
# Wget
|
||||
if command -v wget > /dev/null
|
||||
alias wget="wget --hsts-file=$XDG_CACHE_HOME/wget-hsts"
|
||||
end
|
||||
# z
|
||||
if command -v z > /dev/null
|
||||
set -gx _Z_DATA $XDG_DATA_HOME/z
|
||||
end
|
||||
if command -v tldr > /dev/null
|
||||
set -gx TLDR_CACHE_DIR $XDG_CACHE_HOME/tldr
|
||||
end
|
||||
if status is-interactive
|
||||
if command -v ipython > /dev/null
|
||||
set IPYTHONDIR $XDG_CONFIG_HOME/ipython
|
||||
end
|
||||
end
|
||||
55
tools/fish/conf.d/alias.fish
Normal file
55
tools/fish/conf.d/alias.fish
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
|
||||
# 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 ~/.config/vim/vimrc"
|
||||
alias sn="sudo nvim -u ~/.config/nvim/init.lua"
|
||||
|
||||
# Dev #
|
||||
abbr --add py python3
|
||||
abbr --add ipy ipython
|
||||
abbr --add reload "source $__fish_config_dir/config.fish"
|
||||
abbr --add pulldots "cd $DOTFILES && git pull"
|
||||
|
||||
# lsd - modern ls
|
||||
if command -v lsd > /dev/null
|
||||
alias ls='lsd -A -I .DS_Store -I .git -I .gitkeep'
|
||||
abbr --add l 'lsd -lah'
|
||||
abbr --add ll 'lsd -l'
|
||||
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
|
||||
|
||||
# Use neovide as gVim
|
||||
if command -v neovide > /dev/null
|
||||
abbr --add gvi "neovide"
|
||||
end
|
||||
|
||||
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"
|
||||
end
|
||||
16
tools/fish/conf.d/keymap.fish
Normal file
16
tools/fish/conf.d/keymap.fish
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
fish_vi_key_bindings
|
||||
|
||||
# Colemak hnei
|
||||
# ^
|
||||
# n
|
||||
# < h i >
|
||||
# e
|
||||
# v
|
||||
# bind -M default 'h' backward-char
|
||||
bind -M default 'n' down-or-search
|
||||
bind -M default 'e' up-or-search
|
||||
bind -M default 'i' forward-char
|
||||
|
||||
# Similar position to [i] in QWERTY
|
||||
bind -M default -m insert l repaint-mode
|
||||
bind -M default -m insert L beginning-of-line repaint-mode
|
||||
13
tools/fish/conf.d/navi.fish
Normal file
13
tools/fish/conf.d/navi.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias ......="cd ../../../../.."
|
||||
|
||||
abbr --add \- 'cd -'
|
||||
|
||||
if command -v zoxide > /dev/null
|
||||
zoxide init fish | source
|
||||
end
|
||||
5
tools/fish/conf.d/prompt.fish
Normal file
5
tools/fish/conf.d/prompt.fish
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
if command -v starship > /dev/null
|
||||
set -gx STARSHIP_CONFIG $DOTFILES/tools/starship/starship_fish.toml
|
||||
starship init fish | source
|
||||
end
|
||||
23
tools/fish/config.fish
Normal file
23
tools/fish/config.fish
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# $DOTFILES/tools/fish/config.fish
|
||||
# Date: 2024-12-15
|
||||
# Author: js0ny
|
||||
# Define interactive shell configurations for fish
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/config.fish (default location)
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
switch (uname)
|
||||
case "Darwin"
|
||||
# macOS Specific
|
||||
abbr --add clip pbcopy
|
||||
abbr --add paste pbpaste
|
||||
case "Linux"
|
||||
# Linux Specific
|
||||
case '*'
|
||||
# Default / Fallback case
|
||||
end
|
||||
end
|
||||
29
tools/fish/readme.md
Normal file
29
tools/fish/readme.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
## `type -q` vs `command -v`
|
||||
|
||||
```shell
|
||||
> time for i in (seq 1 10000)
|
||||
type -q vim
|
||||
end
|
||||
|
||||
time for i in (seq 1 10000)
|
||||
command -v vim >/dev/null
|
||||
end
|
||||
|
||||
|
||||
________________________________________________________
|
||||
Executed in 545.79 millis fish external
|
||||
usr time 177.62 millis 174.28 millis 3.34 millis
|
||||
sys time 367.72 millis 366.16 millis 1.56 millis
|
||||
|
||||
|
||||
________________________________________________________
|
||||
Executed in 292.97 millis fish external
|
||||
usr time 71.23 millis 69.31 millis 1.93 millis
|
||||
sys time 215.22 millis 214.78 millis 0.44 millis
|
||||
```
|
||||
|
||||
`command -v` is faster
|
||||
2705
tools/kitty/kitty.conf
Normal file
2705
tools/kitty/kitty.conf
Normal file
File diff suppressed because it is too large
Load diff
208
tools/starship/starship_fish.toml
Normal file
208
tools/starship/starship_fish.toml
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
# starship.toml
|
||||
# ~/.config/starship.toml
|
||||
format = '''$os$time $username @ $hostname $directory $all$character'''
|
||||
continuation_prompt = "[r % ](bold cyan) " # Doesn't work in fish
|
||||
|
||||
add_newline = true
|
||||
|
||||
[time]
|
||||
disabled = false
|
||||
format = '[\[$time\]](purple)'
|
||||
time_format = '%H:%M'
|
||||
|
||||
[username]
|
||||
format = '[$user](bold)'
|
||||
show_always = true
|
||||
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
ssh_symbol = ' '
|
||||
|
||||
[character]
|
||||
success_symbol = "[ >](bold green)"
|
||||
error_symbol = "[ >](bold red)"
|
||||
vimcmd_symbol = "[ <](bold green)"
|
||||
|
||||
[directory]
|
||||
truncation_length = 2
|
||||
truncate_to_repo = true
|
||||
read_only = " "
|
||||
style = "bold cyan"
|
||||
truncation_symbol = ".../"
|
||||
|
||||
[directory.substitutions]
|
||||
"~/Documents" = " "
|
||||
"~/Downloads" = " "
|
||||
"~/Music" = " "
|
||||
"~/Pictures" = " "
|
||||
"Source" = " "
|
||||
"src" = " "
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[buf]
|
||||
symbol = " "
|
||||
|
||||
[c]
|
||||
symbol = " "
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[crystal]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[fennel]
|
||||
symbol = " "
|
||||
|
||||
[fossil_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_commit]
|
||||
tag_symbol = ' '
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[guix_shell]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[haxe]
|
||||
symbol = " "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[kotlin]
|
||||
symbol = " "
|
||||
|
||||
[lua]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[meson]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[ocaml]
|
||||
symbol = " "
|
||||
|
||||
[os]
|
||||
disabled = false
|
||||
|
||||
[os.symbols]
|
||||
Alpaquita = " "
|
||||
Alpine = " "
|
||||
AlmaLinux = " "
|
||||
Amazon = " "
|
||||
Android = " "
|
||||
Arch = " "
|
||||
Artix = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
FreeBSD = " "
|
||||
Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Kali = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
Macos = " "
|
||||
Manjaro = " "
|
||||
Mariner = " "
|
||||
MidnightBSD = " "
|
||||
Mint = " "
|
||||
NetBSD = " "
|
||||
NixOS = " "
|
||||
OpenBSD = " "
|
||||
openSUSE = " "
|
||||
OracleLinux = " "
|
||||
Pop = " "
|
||||
Raspbian = " "
|
||||
Redhat = " "
|
||||
RedHatEnterprise = " "
|
||||
RockyLinux = " "
|
||||
Redox = " "
|
||||
Solus = " "
|
||||
SUSE = " "
|
||||
Ubuntu = " "
|
||||
Unknown = " "
|
||||
Void = " "
|
||||
Windows = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[perl]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[pijul_channel]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[rlang]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[scala]
|
||||
symbol = " "
|
||||
|
||||
[swift]
|
||||
symbol = " "
|
||||
|
||||
[zig]
|
||||
symbol = " "
|
||||
|
||||
[gradle]
|
||||
symbol = " "
|
||||
|
|
@ -34,7 +34,7 @@ if command -v lsd > /dev/null; then
|
|||
alias ls='lsd -A -I .DS_Store -I .git'
|
||||
alias l='lsd -lah'
|
||||
alias ll='lsd -l'
|
||||
alias tree='lsd --tree -I .DS_Store -I .git'
|
||||
alias tree='lsd --tree -I .DS_Store -I .git -A'
|
||||
fi
|
||||
|
||||
# Functions #
|
||||
|
|
@ -89,3 +89,8 @@ if command -v brew > /dev/null; then
|
|||
alias brewc="brew cleanup"
|
||||
alias brewr="brew uninstall"
|
||||
fi
|
||||
|
||||
alias -s {htm,html,css,scss,js,jsx,ts,tsx,json,jsonc}=code
|
||||
alias -s {md,markdown}=code
|
||||
alias -s {py,sh,rb,pl,php,java,c,cpp,h,hpp}=nvim
|
||||
alias -s {cs,csx,fs,fsx,razor}=code
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ done
|
|||
# Use `set -k` to mark leading `#` as a comment character
|
||||
set -k
|
||||
|
||||
# TODO: Below should be reorganized
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
# # TODO: Below should be reorganized
|
||||
# export PATH=$HOME/.local/bin:$PATH
|
||||
|
||||
export NVM_DIR="$HOME/.config/nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
# export NVM_DIR="$HOME/.config/nvm"
|
||||
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue