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 vimdiff 'nvim -d' alias vicfg 'nvim ~/.config/nvim/init.lua' alias vipcfg 'nvim ~/.config/nvim/plugins' set -x MANPAGER 'nvim +Man!' case 'vim' alias vi vim alias nvim vim alias vicfg 'vim ~/.config/vim/init.vim' alias vipcfg 'vim ~/.config/vim/plugins' set -x MANPAGER 'vim +MANPAGER --not-a-term -' 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 'moor' 'most' 'less' 'more' set -f found_pager (find_prog $pagers) if test -n "$found_pager" switch $found_pager case 'moor' set -x MOAR '--colors=auto --no-linenumbers' alias less 'moor' alias most 'moor' alias more 'moor' alias pager 'moor' alias rawpager 'moor' 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 $PAGER is unset, set it if test -z "$PAGER" set -x PAGER $found_pager end end end