if status is-interactive # Text editors to look for by order of preference set -f editors 'nvim' 'vim' 'vi' 'micro' 'nano' set -f found_editor (find_prog $editors) if test -n "$found_editor" switch $found_editor case 'nvim' alias vi nvim alias vim nvim alias vicfg 'nvim ~/.config/nvim/init.lua' alias vipcfg 'nvim ~/.config/nvim/plugins' case 'vim' alias vi vim alias nvim vim alias vicfg 'vim ~/.config/vim/init.vim' alias vipcfg 'vim ~/.config/vim/plugins' case 'vi' alias vim vi alias nvim vi end alias e $found_editor # If $EDITOR is unset, set it if test -z "$EDITOR" set -x EDITOR $found_editor end end alias_if nano edit alias_if micro edit alias cfg 'e ~/.config/fish/config.fish' if not test -z "$WAYLAND_DISPLAY"; and not test -z "$DISPLAY"; and not fish_is_root_user # Graphical text editors to look for by order of preference set -f xeditors 'neovide' 'gvim' set -f found_xeditor (find_prog $xeditors) if test -n "$found_xeditor" switch $found_xeditor case 'neovide' alias xvi neovide alias gvim neovide case 'gvim' alias xvi gvim end alias xe $found_xeditor end end alias_if mousepad xedit # Pagers to look for by order of preference set -f pagers 'moar' 'less' 'most' 'more' set -f found_pager (find_prog $pagers) if test -n "$found_pager" switch $found_pager case 'moar' set -x MOAR '--colors=auto --no-linenumbers' alias less 'moar' alias most 'moar' alias more 'moar' alias pager 'moar' alias rawpager 'moar' case 'less' if test -z "$LESSHISTFILE" set -x LESSHISTFILE '-' end alias most 'less' alias more 'less' alias pager 'less' alias rawpager 'less -r' case 'most' if test -z "$MOST_INITFILE" set -x MOST_INITFILE "$HOME/.config/most/config" end alias more 'most' alias less 'most' alias pager 'most' alias rawpager 'most' case 'more' alias less 'more' alias most 'more' alias pager 'more' alias rawpager 'more' end if command -sq 'bat'; and test (uname) = 'Linux' set -x MANROFFOPT '-c' set -x MANPAGER 'fish -c "col -bx | bat -l man -p"' end # If $PAGER is unset, set it if test -z "$PAGER" set -x PAGER $found_pager end end end