aboutsummaryrefslogtreecommitdiff
path: root/conf.d/04editor.fish
diff options
context:
space:
mode:
Diffstat (limited to 'conf.d/04editor.fish')
-rw-r--r--conf.d/04editor.fish129
1 files changed, 97 insertions, 32 deletions
diff --git a/conf.d/04editor.fish b/conf.d/04editor.fish
index a7aaa48..3dc12a6 100644
--- a/conf.d/04editor.fish
+++ b/conf.d/04editor.fish
@@ -1,47 +1,112 @@
if status is-interactive
-# Text editors to look for by order of preference
-set -f editors 'nvim' 'vim' 'vi' 'micro' 'nano'
+ # Text editors to look for by order of preference
+ set -f editors 'nvim' 'vim' 'vi' 'micro' 'nano'
+ set -f found_editor (find_prog $editors)
-# Find a suitable text editor
-set -f found_editor (find_prog $editors)
+ if test -n "$found_editor"
-if test -n "$found_editor"
+ switch $found_editor
+ case 'nvim'
+ alias vi nvim
+ alias vim nvim
+ alias vicfg 'nvim ~/.config/nvim/init.vim'
+ 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
- switch $found_editor
- case 'nvim'
- alias vi nvim
- alias vim nvim
- alias vicfg 'nvim ~/.config/nvim/init.vim'
- 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
+ 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
- # If $EDITOR is unset, set it
- if test -z "$EDITOR"
- set -x EDITOR $found_editor
end
-end
+ alias_if mousepad xedit
-if command -sq neovide
- alias xvi neovide
- alias gvi neovide
- alias xeditor neovide
-end
+ # 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"
-alias_if nano edit
-alias_if micro edit
+ 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
-alias cfg 'editor ~/.config/fish/config.fish'
+ if command -sq 'bat'
+ 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