2020-06-21 00:07:53 +02:00
|
|
|
# {{@@ header() @@}}
|
2019-12-02 19:54:25 +01:00
|
|
|
# LEL
|
2020-06-20 18:58:49 +02:00
|
|
|
# __ _ _
|
|
|
|
# / _(_)___| |__
|
|
|
|
# | |_| / __| '_ \
|
2019-12-02 19:54:25 +01:00
|
|
|
# | _| \__ \ | | |
|
|
|
|
# |_| |_|___/_| |_|
|
|
|
|
|
|
|
|
# Environment Vairables {{{
|
|
|
|
set -x QT_QPA_PLATFORMTHEME qt5ct
|
2020-10-14 07:35:14 +02:00
|
|
|
set -x PATH ~/.local/bin ~/.cargo/bin $PATH
|
2019-12-02 19:54:25 +01:00
|
|
|
|
|
|
|
set -x EDITOR nvim
|
|
|
|
set -x VISUAL nvim
|
2020-05-22 02:34:08 +02:00
|
|
|
set -x BROWSER qutebrowser
|
2019-12-02 19:54:25 +01:00
|
|
|
set -x PAGER less
|
|
|
|
|
2020-07-20 17:23:27 +02:00
|
|
|
# if test -n "$XDG_VTRN"; and test -z "$DISPLAY"
|
2020-06-22 01:28:39 +02:00
|
|
|
# or command -qs systemctl;and systemctl -q is-enabled ly
|
2020-05-22 02:34:08 +02:00
|
|
|
|
2020-06-22 01:28:39 +02:00
|
|
|
|
2020-07-12 08:02:43 +02:00
|
|
|
# keep my dirs clean
|
2020-07-20 17:23:27 +02:00
|
|
|
set -x PYTHONPYCACHEPREFIX $HOME/.cache/python
|
2020-07-12 08:02:43 +02:00
|
|
|
|
2020-07-20 17:23:27 +02:00
|
|
|
# end
|
2019-12-02 19:54:25 +01:00
|
|
|
#}}}
|
2020-04-19 21:17:46 +02:00
|
|
|
# Aliases{{{
|
2020-07-03 21:42:37 +02:00
|
|
|
abbr v nvim
|
2020-10-14 16:18:47 +02:00
|
|
|
|
|
|
|
command -qs sudo &&
|
|
|
|
abbr rv sudo nvim
|
|
|
|
command -qs doas &&
|
|
|
|
abbr rv doas nvim
|
2020-04-19 21:17:46 +02:00
|
|
|
|
2020-07-06 23:16:29 +02:00
|
|
|
command -qs trash &&
|
|
|
|
alias rm trash
|
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
command -qs exa &&
|
2020-04-19 21:17:46 +02:00
|
|
|
alias ls exa
|
|
|
|
|
2020-06-20 18:58:49 +02:00
|
|
|
command -qs bat &&
|
2020-10-17 02:13:11 +02:00
|
|
|
# {%@@ if color.type == "light" @@%} #
|
|
|
|
alias cat 'bat --theme GitHub'
|
|
|
|
# {%@@ else @@%} #
|
|
|
|
alias cat 'bat'
|
|
|
|
# {%@@ endif @@%} #
|
2020-06-16 21:58:16 +02:00
|
|
|
|
2020-09-28 09:29:16 +02:00
|
|
|
command -qs zoxide &&
|
|
|
|
zoxide init fish | source
|
|
|
|
|
2020-07-13 03:53:35 +02:00
|
|
|
command -qs khard &&
|
2020-08-07 02:14:24 +02:00
|
|
|
function fish_greeting
|
|
|
|
set -l khalList khal list now 10d --format " {title}"
|
|
|
|
$khalList &> /dev/null
|
|
|
|
or return
|
|
|
|
$khalList | grep '^No events$' &> /dev/null
|
|
|
|
and return
|
|
|
|
$khalList
|
|
|
|
end
|
2020-07-07 07:29:29 +02:00
|
|
|
|
2020-04-19 21:17:46 +02:00
|
|
|
abbr gs git status
|
|
|
|
abbr gp 'git pull; git push'
|
|
|
|
|
2020-10-17 02:13:11 +02:00
|
|
|
alias dotdrop "dotdrop --cfg '{{@@ _dotdrop_cfgpath @@}}' "
|
2020-06-20 18:58:49 +02:00
|
|
|
|
2020-04-25 01:21:12 +02:00
|
|
|
function edit-config #{{{
|
2020-07-12 08:02:43 +02:00
|
|
|
cd "{{@@ parent_dir ( _dotdrop_dotpath ) @@}}"
|
2020-06-25 08:00:04 +02:00
|
|
|
nvim +GFiles
|
2020-04-19 21:17:46 +02:00
|
|
|
end
|
|
|
|
abbr ec edit-config
|
2020-04-25 01:21:12 +02:00
|
|
|
#}}}
|
|
|
|
# alias mutt #{{{
|
2020-04-22 00:36:45 +02:00
|
|
|
function mutt --wraps=neomutt --description 'alias mutt=neomutt'
|
|
|
|
neomutt $argv;
|
2020-04-22 19:34:34 +02:00
|
|
|
pkill -RTMIN+4 waybar
|
2020-04-22 00:36:45 +02:00
|
|
|
end
|
|
|
|
abbr neomutt mutt
|
2020-04-25 01:21:12 +02:00
|
|
|
#}}}
|
|
|
|
function rcd #{{{
|
2020-04-24 23:17:08 +02:00
|
|
|
set file (mktemp)
|
|
|
|
|
2020-09-26 15:36:53 +02:00
|
|
|
ranger --choosedir=$file
|
2020-04-24 23:17:08 +02:00
|
|
|
cd (cat $file)
|
|
|
|
|
|
|
|
rm $file
|
2020-04-25 01:21:12 +02:00
|
|
|
clear
|
|
|
|
ls
|
|
|
|
fish_prompt
|
2020-04-24 23:17:08 +02:00
|
|
|
end
|
|
|
|
|
2020-04-25 01:21:12 +02:00
|
|
|
# force-repaint to redraw prompt
|
2020-09-28 09:29:16 +02:00
|
|
|
bind -M insert \cr rcd
|
2020-04-25 01:21:12 +02:00
|
|
|
#}}}
|
|
|
|
function etc #{{{
|
|
|
|
cd /etc/
|
|
|
|
set file /etc/(fzf)
|
|
|
|
cd -
|
|
|
|
test -f "$file"
|
|
|
|
and sudo nvim $file
|
|
|
|
end
|
|
|
|
#}}}
|
2020-04-19 21:17:46 +02:00
|
|
|
# }}}
|
2020-06-25 21:35:04 +02:00
|
|
|
# Keys{{{
|
2020-07-12 08:02:43 +02:00
|
|
|
|
|
|
|
set fish_key_bindings fish_vi_key_bindings
|
|
|
|
|
|
|
|
if test $fish_key_bindings = fish_vi_key_bindings
|
|
|
|
bind {{@@ key.left @@}} backward-char
|
|
|
|
bind -M visual {{@@ key.left @@}} backward-char
|
|
|
|
bind {{@@ key.down @@}} down-or-search
|
|
|
|
bind -M visual {{@@ key.down @@}} down-line
|
|
|
|
bind {{@@ key.up @@}} up-or-search
|
|
|
|
bind -M visual {{@@ key.up @@}} up-line
|
|
|
|
bind {{@@ key.right @@}} forward-char
|
|
|
|
bind -M visual {{@@ key.right @@}} forward-char
|
2020-09-23 21:14:18 +02:00
|
|
|
|
2020-09-25 19:35:15 +02:00
|
|
|
bind -m insert {{@@ key.insertMode @@}} repaint-mode
|
|
|
|
bind -m insert {{@@ key.insertMode.upper() @@}} beginning-of-line repaint-mode
|
2020-09-23 21:14:18 +02:00
|
|
|
|
2020-09-28 23:41:04 +02:00
|
|
|
bind -M insert {{@@ key.insertQuit @@}} repaint-mode -m default
|
2020-09-28 21:27:57 +02:00
|
|
|
|
2020-07-12 08:02:43 +02:00
|
|
|
end
|
2020-06-25 21:35:04 +02:00
|
|
|
#}}}
|
2019-12-04 04:03:28 +01:00
|
|
|
# start window manager if using tty1 {{{
|
2019-12-02 19:54:25 +01:00
|
|
|
#
|
2020-07-14 23:54:01 +02:00
|
|
|
|
|
|
|
function esway
|
|
|
|
clear
|
2020-07-24 06:26:26 +02:00
|
|
|
|
|
|
|
set -x _JAVA_AWT_WM_NONREPARENTING 1
|
|
|
|
|
|
|
|
set -x GTK_CSD 0
|
2020-10-15 21:05:11 +02:00
|
|
|
test -f &&
|
|
|
|
set -x LD_PRELOAD '/usr/lib/libgtk3-nocsd.so.0'
|
2020-07-24 06:26:26 +02:00
|
|
|
|
2020-10-10 06:47:05 +02:00
|
|
|
set -x XCURSOR_THEME {{@@ cursor_theme @@}}
|
2020-10-06 01:58:06 +02:00
|
|
|
set -x XCURSOR_SIZE {{@@ cursor_size @@}}
|
2020-10-10 06:47:05 +02:00
|
|
|
set -x GTK_THEME {{@@ gtk_theme @@}}
|
2020-07-24 06:26:26 +02:00
|
|
|
|
|
|
|
# set -x XDG_CURRENT_DESKTOP Unity
|
|
|
|
set -x QT_SCALE_FACTOR 1.0001
|
|
|
|
set -x QPA_PLATFORM wayland
|
|
|
|
set -x QT_QPA_PLATFORM wayland
|
|
|
|
|
2020-09-24 06:41:07 +02:00
|
|
|
export XDG_CURRENT_DESKTOP=sway
|
|
|
|
export XDG_SESSION_TYPE=wayland
|
2020-10-06 09:08:16 +02:00
|
|
|
pidof sway || exec sway
|
2020-07-14 23:54:01 +02:00
|
|
|
end
|
|
|
|
if test "$XDG_VTNR" = 1 -a -z "$DISPLAY"
|
|
|
|
esway &> .swaylog
|
|
|
|
# ei3 &> .i3log
|
|
|
|
# ebsp &> .bsplog
|
|
|
|
end
|
2020-04-14 16:26:40 +02:00
|
|
|
|
2019-12-02 19:54:25 +01:00
|
|
|
# }}}
|
|
|
|
# use tmux{{{
|
2020-07-12 08:02:43 +02:00
|
|
|
set TMUX 1
|
2020-04-22 20:36:07 +02:00
|
|
|
if test -z "$TMUX" -a -n "$DISPLAY" &&
|
|
|
|
not string match -qr kitty "$TERM" &&
|
|
|
|
test -z "$GNOME_TERMINAL_SCREEN" &&
|
|
|
|
status is-interactive
|
2019-12-02 19:54:25 +01:00
|
|
|
set attach_session (tmux 2> /dev/null ls -F \
|
|
|
|
'#{session_attached} #{?#{==:#{session_last_attached},},1,#{session_last_attached}} #{session_id}' |
|
|
|
|
awk '/^0/ { if ($2 > t) { t = $2; s = $3 } }; END { if (s) printf "%s", s }')
|
|
|
|
if test -n "$attach_session"
|
|
|
|
exec tmux attach -t "$attach_session"
|
|
|
|
else
|
|
|
|
exec tmux
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Prompt customization{{{
|
2020-07-12 08:02:43 +02:00
|
|
|
|
2020-09-25 07:35:22 +02:00
|
|
|
# Fine, I'll do it myself
|
|
|
|
function fish_vi_cursor;end
|
|
|
|
function fish_mode_prompt;end
|
2020-07-12 08:02:43 +02:00
|
|
|
|
2020-09-28 10:52:15 +02:00
|
|
|
function _fish_prompt_color -a color
|
|
|
|
set_color --bold $color
|
|
|
|
set -e argv[1]
|
2020-09-25 07:35:22 +02:00
|
|
|
echo -en $argv
|
|
|
|
end
|
2020-07-12 08:02:43 +02:00
|
|
|
|
2020-09-28 10:52:15 +02:00
|
|
|
alias _fish_prompt_accent "_fish_prompt_color '{{@@ color.accent @@}}'"
|
|
|
|
alias _fish_prompt_warn "_fish_prompt_color 'bryellow'"
|
2020-07-12 08:02:43 +02:00
|
|
|
|
2020-10-11 08:34:36 +02:00
|
|
|
set _fish_normal_color (test -n "$DISPLAY" &&
|
|
|
|
echo '{{@@ color.txt @@}}' || echo 'white')
|
|
|
|
alias _fish_prompt_normal "_fish_prompt_color '$_fish_normal_color'"
|
|
|
|
|
|
|
|
function _fish_prompt_git_status
|
2020-09-28 21:27:57 +02:00
|
|
|
git status -s | grep "^$argv[1]" &> /dev/null &&
|
2020-09-28 10:52:15 +02:00
|
|
|
_fish_prompt_color $argv[3] $argv[2]
|
2020-09-25 08:07:59 +02:00
|
|
|
end
|
|
|
|
|
2020-09-25 07:35:22 +02:00
|
|
|
function fish_prompt
|
2020-09-25 08:07:59 +02:00
|
|
|
set _status $status
|
|
|
|
|
2020-09-25 07:35:22 +02:00
|
|
|
_fish_prompt_accent $USER
|
|
|
|
_fish_prompt_normal " in "
|
|
|
|
_fish_prompt_accent (prompt_pwd)
|
2020-09-25 08:07:59 +02:00
|
|
|
if fish_vcs_prompt > /dev/null
|
2020-09-28 10:52:15 +02:00
|
|
|
_fish_prompt_normal " on "
|
|
|
|
|
2020-10-11 08:34:36 +02:00
|
|
|
_fish_prompt_git_status '??' '?' '{{@@ color.txt @@}}'
|
|
|
|
_fish_prompt_git_status ' M' '~' '{{@@ color.normal.yellow @@}}'
|
|
|
|
_fish_prompt_git_status ' D' '-' '{{@@ color.normal.red @@}}'
|
|
|
|
_fish_prompt_git_status 'A ' '+' '{{@@ color.normal.green @@}}'
|
|
|
|
_fish_prompt_git_status 'M ' '~' '{{@@ color.normal.green @@}}'
|
2020-09-28 10:52:15 +02:00
|
|
|
|
|
|
|
_fish_prompt_accent (fish_vcs_prompt | string replace -ra ' \(|\)' '')
|
2020-09-25 08:07:59 +02:00
|
|
|
end
|
|
|
|
|
2020-09-25 07:35:22 +02:00
|
|
|
echo
|
|
|
|
|
|
|
|
if test $fish_key_bindings = fish_vi_key_bindings
|
|
|
|
|
2020-09-28 10:52:15 +02:00
|
|
|
# Set cursor shape
|
|
|
|
if test $fish_bind_mode = insert
|
|
|
|
printf '\e[5 q' # Bar
|
|
|
|
else
|
|
|
|
printf '\e[1 q' # Block
|
|
|
|
end
|
|
|
|
|
|
|
|
_fish_prompt_accent (
|
2020-09-25 07:35:22 +02:00
|
|
|
switch $fish_bind_mode
|
|
|
|
case replace_one
|
|
|
|
printf 'o'
|
|
|
|
case default
|
|
|
|
printf 'n'
|
|
|
|
case '*'
|
|
|
|
printf (string match -r '^.' $fish_bind_mode )
|
|
|
|
end | string upper
|
|
|
|
)' '
|
|
|
|
end
|
2020-07-12 08:02:43 +02:00
|
|
|
|
2020-09-25 08:07:59 +02:00
|
|
|
if test $_status -ne 0
|
|
|
|
_fish_prompt_warn $_status' '
|
|
|
|
end
|
|
|
|
|
2020-09-25 07:35:22 +02:00
|
|
|
if test $USER = root
|
2020-09-25 21:56:14 +02:00
|
|
|
_fish_prompt_normal '# '
|
2020-09-25 07:35:22 +02:00
|
|
|
else
|
2020-09-25 21:56:14 +02:00
|
|
|
_fish_prompt_normal '$ '
|
2020-09-25 07:35:22 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
set_color normal
|
|
|
|
end
|
|
|
|
|
2020-09-28 10:56:18 +02:00
|
|
|
if false
|
|
|
|
set SPACEFISH_USER_SHOW always
|
|
|
|
set SPACEFISH_USER_COLOR "{{@@ color.accent @@}}"
|
|
|
|
set SPACEFISH_DIR_COLOR "{{@@ color.accent @@}}"
|
|
|
|
|
|
|
|
set SPACEFISH_PROMPT_ADD_NEWLINE false
|
|
|
|
|
|
|
|
set SPACEFISH_CHAR_COLOR_SUCCESS white
|
|
|
|
set SPACEFISH_CHAR_PREFIX ""
|
|
|
|
set SPACEFISH_CHAR_SYMBOL '$'
|
|
|
|
set SPACEFISH_CHAR_SYMBOL_ROOT '#'
|
|
|
|
|
|
|
|
set SPACEFISH_VI_MODE_COLOR "{{@@ color.accent @@}}"
|
|
|
|
set SPACEFISH_VI_MODE_PREFIX "\e[1 q"
|
|
|
|
set SPACEFISH_VI_MODE_INSERT "I\e[5 q"
|
|
|
|
set SPACEFISH_VI_MODE_NORMAL "N"
|
|
|
|
set SPACEFISH_VI_MODE_VISUAL "V"
|
|
|
|
set SPACEFISH_VI_MODE_REPLACE "R"
|
|
|
|
set SPACEFISH_VI_MODE_REPLACE_ONE "S"
|
|
|
|
set SPACEFISH_VI_MODE_SUFIX ""
|
|
|
|
end
|
2020-03-23 02:28:09 +01:00
|
|
|
|
2020-07-12 08:02:43 +02:00
|
|
|
# set fish_cursor_default block blink
|
|
|
|
# set fish_cursor_insert line blink
|
|
|
|
# set fish_cursor_replace_one underscore blink
|
|
|
|
# set fish_cursor_visual block
|
2020-04-24 21:37:17 +02:00
|
|
|
|
2019-12-02 19:54:25 +01:00
|
|
|
#}}}
|
|
|
|
# Color man pages{{{
|
2019-12-03 04:38:10 +01:00
|
|
|
|
|
|
|
set -xU LESS_TERMCAP_md (printf "\e[01;31m")
|
|
|
|
set -xU LESS_TERMCAP_me (printf "\e[0m")
|
|
|
|
set -xU LESS_TERMCAP_se (printf "\e[0m")
|
|
|
|
set -xU LESS_TERMCAP_so (printf "\e[01;44;33m")
|
|
|
|
set -xU LESS_TERMCAP_ue (printf "\e[0m")
|
|
|
|
set -xU LESS_TERMCAP_us (printf "\e[01;32m")
|
|
|
|
|
2019-12-02 19:54:25 +01:00
|
|
|
#}}}
|
|
|
|
# vim:foldmethod=marker
|