Skip to content

Commit b4adcd6

Browse files
committed
feat: up and running with fish. this is groovy.
1 parent e5869cc commit b4adcd6

10 files changed

Lines changed: 147 additions & 4 deletions

File tree

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ vim/.netrwhist
88

99
# have to ignore this file because we symlink the whole nvim directory to ~
1010
config/nvim/lua/plugins/colorscheme.lua
11+
12+
# fish local overrides
13+
config/fish/local.fish

‎config/fish/conf.d/aliases.fish‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Easier navigation
2+
abbr --add .. cd ..
3+
abbr --add ... cd ../..
4+
abbr --add .... cd ../../..
5+
abbr --add ..... cd ../../../..
6+
7+
# Enable aliases to be sudo'ed
8+
alias sudo 'sudo '
9+
10+
# Get week number
11+
abbr --add week date +%V
12+
13+
# Clean up LaunchServices to remove duplicates in the "Open With" menu
14+
abbr --add lscleanup /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user '&&' killall Finder
15+
16+
# View HTTP traffic
17+
abbr --add sniff sudo ngrep -d en0 -t "'^(GET|POST) '" "'tcp and port 80'"
18+
abbr --add httpdump sudo tcpdump -i en1 -n -s 0 -w - '|' grep -a -o -E "\"Host\\: .*|GET \\/.*\""
19+
20+
# Canonical hex dump; some systems have this symlinked
21+
if not command --query hd
22+
abbr --add hd hexdump -C
23+
end
24+
25+
# macOS has no md5sum, so use md5 as a fallback
26+
if not command --query md5sum
27+
abbr --add md5sum md5
28+
end
29+
30+
# macOS has no sha1sum, so use shasum as a fallback
31+
if not command --query sha1sum
32+
abbr --add sha1sum shasum
33+
end
34+
35+
# bundle exec
36+
abbr --add be bundle exec
37+
38+
# kubectl
39+
abbr --add k kubectl

‎config/fish/conf.d/exports.fish‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Make nvim the default editor
2+
set --global --export EDITOR nvim
3+
4+
# Prefer US English and use UTF-8
5+
set --global --export LANG en_US.UTF-8
6+
set --global --export LC_ALL en_US.UTF-8
7+
8+
# Highlight section titles in manual pages
9+
set --global --export LESS_TERMCAP_md (set_color --bold; set_color yellow)
10+
11+
# Don't clear the screen after quitting a manual page
12+
set --global --export MANPAGER "less -X"
13+
14+
# FZF search command
15+
set --global --export FZF_DEFAULT_COMMAND 'rg --files --hidden --glob "!.git/*"'
16+
17+
# Attempt to have bat use terminal theme
18+
set --global --export BAT_THEME ansi
19+
20+
# Add ~/.bin and ~/.local/bin to PATH
21+
fish_add_path --global ~/.bin
22+
fish_add_path --global ~/.local/bin

‎config/fish/config.fish‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Only run in interactive shells
2+
status is-interactive; or return
3+
4+
set --global fish_greeting ""
5+
6+
if test -f /opt/homebrew/bin/brew
7+
/opt/homebrew/bin/brew shellenv | source
8+
end
9+
10+
if type --query mise
11+
mise activate fish | source
12+
end
13+
14+
if type --query starship
15+
starship init fish | source
16+
end
17+
18+
if command --query zoxide
19+
zoxide init --cmd j fish | source
20+
end
21+
22+
if type --query fzf
23+
fzf --fish | source
24+
end
25+
26+
# eza / ls
27+
if type --query eza
28+
alias ls eza
29+
alias l 'eza --long'
30+
alias la 'eza --long --all'
31+
alias lt 'eza --tree'
32+
alias tree 'eza --tree --level=2'
33+
else
34+
alias l 'ls -l'
35+
alias la 'ls -la'
36+
end
37+
38+
# fancy cat
39+
if type --query bat
40+
alias cat 'bat --paging=never --style=plain'
41+
end
42+
43+
# lazier git
44+
if type --query lazygit
45+
abbr --add lg lazygit
46+
end
47+
48+
# use nvim for vim if it's there
49+
if command --query nvim
50+
alias vim nvim
51+
alias vi nvim
52+
alias e nvim
53+
alias v nvim
54+
end
55+
56+
# Set terminal title to current directory
57+
function fish_title
58+
string replace $HOME '~' $PWD
59+
end
60+
61+
# Source local overrides if they exist
62+
if test -f ~/.config/fish/local.fish
63+
source ~/.config/fish/local.fish
64+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function allthecolors --description 'Print all 256 terminal colors'
2+
set --local reset (tput op)
3+
set --local width (math $COLUMNS - 6)
4+
set --local bar (string repeat --count $width '=')
5+
for i in (seq 0 256)
6+
set --local num (string pad --width 3 --char 0 $i)
7+
echo -e "$num $(tput setaf $i; tput setab $i)$bar$reset"
8+
end
9+
end

‎config/fish/functions/diff.fish‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function diff --wraps='git diff' --description 'Use git diff for colored word diffs'
2+
git diff --no-index --color-words $argv
3+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function pg_kill_db --argument-names db --description 'Kill all connections to a given PostgreSQL database'
2+
psql -d $db -c "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where pg_stat_activity.datname = '$db' and pid <> pg_backend_pid();"
3+
end

‎config/kitty/kitty.conf‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ enabled_layouts splits:split_axis=vertical,stack
2828
map ctrl+a>v launch --location=vsplit --cwd=current
2929
map ctrl+a>s launch --location=hsplit --cwd=current
3030

31-
# shell bash
3231
shell_integration disabled
3332
allow_remote_control yes
3433
listen_on unix:/tmp/mykitty

‎config/kitty/macos.conf‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
font_family family='CaskaydiaMono Nerd Font Mono' postscript_name=CaskaydiaMonoNFM-Regular
22
font_size 17.0
3+
shell /opt/homebrew/bin/fish

‎script/setup_macos.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ function setup_shell() {
1212
echo '/opt/homebrew/bin/fish' | sudo tee -a /etc/shells
1313
fi
1414

15-
if [[ "$SHELL" != '/opt/homebrew/bin/bash' ]]; then
16-
echo 'Current shell is not homebrew bash, switching...'
17-
chsh -s /opt/homebrew/bin/bash
15+
if [[ "$SHELL" != '/opt/homebrew/bin/fish' ]]; then
16+
echo 'Current shell is not homebrew fish, switching...'
17+
chsh -s /opt/homebrew/bin/fish
1818
fi
1919
}
2020

0 commit comments

Comments
 (0)