11# My fish config. Not much to see here; just some pretty standard stuff.
22
3- # ## ADDING TO THE PATH
4- # First line removes the path; second line sets it. Without the first line,
5- # your path gets massive and fish becomes very slow.
6- set -e fish_user_paths
7- set -U fish_user_paths $HOME /.bin $HOME /.local/bin $HOME /local/bin $HOME /.config/emacs/bin $HOME /Applications /var/lib/flatpak/exports/bin/ $HOME /go/bin $HOME /.fzf/bin $fish_user_paths
8-
9- # Remove fish vi mode indication in the prompt
3+ fish_add_path \
4+ " $HOME /.bin" \
5+ " $HOME /.local/bin" \
6+ " $HOME /local/bin" \
7+ " $HOME /.config/emacs/bin" \
8+ " $HOME /Applications" \
9+ " /var/lib/flatpak/exports/bin" \
10+ " $HOME /go/bin" \
11+ " $HOME /.fzf/bin"
12+
13+ # Remove fish vi mode indication in the prompt
1014function fish_mode_prompt; end
1115
12- # init starship quickly
13- starship init fish | source
16+ # init starship quickly (only in interactive mode)
17+ if status is-interactive
18+ starship init fish | source
19+ end
1420
15- set fish_greeting # Suppress fish's intro message
21+ # Suppress fish's intro message
22+ set fish_greeting
1623
1724# use the default terminal color
18- set TERM xterm-256color # Sets the terminal type
25+ set TERM xterm-256color
1926
2027set -gx BAT_THEME " tokyonight_night"
2128
22- # -- layout=reverse makes the prompt at the top instead of at the bottom
23- set -gx FZF_DEFAULT_OPTS " --height=65% --layout=reverse --bind ctrl-u:preview-page-up,ctrl-d:preview-page-down"
24-
25- # Use this command to list files in the fzf window when simply run the 'fzf' command.
26- # Make sure to use the CTRL-T and ALT-C to its fullest.
27- set -gx FZF_DEFAULT_COMMAND " fd --hidden --strip-cwd-prefix --exclude .git"
28- set -gx FZF_CTRL_T_COMMAND " $FZF_DEFAULT_COMMAND "
29-
30- set -gx FZF_CTRL_T_OPTS " --preview 'bat --color=always --style=numbers --line-range=:500 {}' --preview-window=right:noborder"
31- set -gx FZF_ALT_C_OPTS " --preview 'eza --tree --icons --color=always {} | head -n 200' --preview-window=right:noborder"
32-
3329fish_config theme choose " Rosé Pine"
3430
35- # set up NEOVIM as a default editor.
31+ # set up NEOVIM as a default editor.
3632set -gx EDITOR nvim
3733set -gx GIT_EDITOR nvim
3834
@@ -42,140 +38,37 @@ set -g fish_cursor_insert block
4238set -g fish_cursor_replace block
4339set -g fish_cursor_visual block
4440
45- # Setup SSH running. (mostly for git push)
46- if not set -q SSH_AUTH_SOCK
47- # Redirecting the error or the output to the /dev/null
48- eval (ssh-agent -c ) > /dev/null 2>&1
49- end
50-
51- # If we are in this line, the ssh-agent should always be set up and running.
52- # Add our private key to the ssh-agent
53- # Redirecting the error or the output to the /dev/null
54- ssh-add ~/.ssh/gh_login_shricodev > /dev/null 2>&1
55-
56- # This is the private key for my homelab vm on azure
57- # ssh-add ~/.ssh/homelab-vm_key.pem > /dev/null 2>&1
58-
5941# Open tmux as default when the shell starts
60- # Attach to or create the base session
61- if not set -q TMUX
42+ # Only attach if we're in an interactive session to avoid breaking scripts
43+ if not set -q TMUX; and status is-interactive
6244 set -g TMUX tmux new-session -d -s mainline
6345 eval $TMUX
6446 tmux attach-session -d -t mainline
6547end
6648
67-
68- # ## ALIASES ###
69- # navigation
70- alias ..=' cd ..'
71- alias ...=' cd ../..'
72- alias .3=' cd ../../..'
73- alias .4=' cd ../../../..'
74- alias .5=' cd ../../../../..'
75-
76- alias ping=" ping -c 10"
77-
78- alias cat =' bat --style=plain --paging=never'
79-
80- alias nv=' nvim'
81- alias vi =' nvim'
82- alias vim=' nvim'
83- alias v=' nvim'
84-
85- alias cl=' reset'
86- # Make the `clear` command work as Ctrl - l as by default `clear` command clears
87- # the screen completely
88- alias clear=' reset'
89- alias clearraw=' command clear'
90-
91- # Changing "ls" to "eza"
92- alias ls =' eza -alg --color=always --icons --group-directories-first' # my preferred listing
93- # alias to use when you need to access the raw ls command
94- alias lsraw=' command ls'
95-
96- alias ll =' eza -lg --color=always --icons --group-directories-first'
97-
98- alias la =' eza -a --color=always --git-ignore --group-directories-first' # all files and dirs
99- alias lt1=' eza -aT --color=always --git-ignore --level=1 --group-directories-first'
100- alias lt2=' eza -aT --color=always --git-ignore --level=2 --group-directories-first'
101- alias lt3=' eza -aT --color=always --git-ignore --level=3 --group-directories-first'
102-
103- alias llg=" eza --tree --level=2 --long -g --icons --git"
104-
105- # Show only the dotfiles
106- alias l.=' eza -a | grep -E "^\ ."'
107-
108- # Colorize grep output (good for log files)
109- alias grep =' grep --color=auto'
110-
111- # adding flags
112- alias df =' df -h' # human-readable sizes
113- alias free=' free -m' # show sizes in MB
114-
115- # Fuzzily find history
116- alias hf=' history | fzf'
117-
118- # Continue from where the download got interrupted if it happens.
119- # Without -c flag, wget will start downloading the file from scratch if the operation fails due to some
120- # network issues.
121- alias wget=" wget -c"
122-
123- alias lg=" lazygit"
124-
125- # switch between shells
126- # The shell path is hard coded for now since adding $(which <shell>) would result in warning in the terminal
127- # if the shell is not installed.
128- alias tobash=" sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
129- alias tozsh=" sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
130- alias tofish=" sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
131-
132- # Safety nets
133- # do not delete / or prompt if deleting more than 3 files at a time
49+ # keep as alias since it's the base ls command replacement
50+ alias ls =' eza -alg --color=always --icons --group-directories-first'
13451alias rm =' rm -I --preserve-root'
135-
136- # confirmation
137- alias mv =' mv -i'
13852alias cp =' cp -i'
53+ alias mv =' mv -i'
13954alias ln =' ln -i'
140-
141- # Parenting changing perms on /
14255alias chown =' chown --preserve-root'
14356alias chmod =' chmod --preserve-root'
14457alias chgrp =' chgrp --preserve-root'
14558
146- # git aliases
147- alias gl=' git log --oneline'
148- alias glp=' git log --pretty=format:"%C(yellow)%h%Creset - %C(green)%an%Creset, %ar : %s"'
149- alias glt=' git log --graph --oneline --all --decorate'
150-
151- # Yazi file manager
152- alias yz=' yazi'
153-
154- alias :q=" exit"
155-
156- alias day=" date +'%Y-%m-%d %A'"
157-
158- # Weather in current location
159- alias wtr=" curl wttr.in"
160-
161- # Do the internet speed test
162- alias ist=" curl -s 'https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py' | python3 -"
59+ # some raw aliases
60+ alias lsraw=' command ls'
61+ alias clearraw=' command clear'
16362
164- abbr -a --position anywhere --set-cursor =' %' -- L ' % | less'
63+ # colorize grep output (good for log files) - keep as global setting
64+ alias grep =' grep --color=auto'
16565
166- # bun
167- set --export BUN_INSTALL " $HOME /.bun"
168- set --export PATH $BUN_INSTALL /bin $PATH
66+ bind \ cd delete-char # don't exit on accidental Ctrl-D
67+ bind \ cd \ cd \ cd delete-or-exit # exit on the third one
16968
170- # pnpm
171- set -gx PNPM_HOME " /home/shricodev/.local/share/pnpm"
172- if not string match -q -- $PNPM_HOME $PATH
173- set -gx PATH " $PNPM_HOME " $PATH
69+ # initialize zoxide only in interactive mode
70+ if status is-interactive
71+ zoxide init fish | source
17472end
17573
176- bind \ cd delete-char # Don't exit on accidental Ctrl-D
177- bind \ cd \ cd \ cd delete-or-exit # Exit on the third one
178-
179- zoxide init fish | source
180-
18174# toilet "shricodev" -F border -F rainbow -f pagga
0 commit comments