diff options
-rw-r--r-- | .config/fish/completions/nnn.fish | 45 | ||||
-rw-r--r-- | .config/fish/config.fish | 56 | ||||
-rw-r--r-- | .config/fish/fish_variables | 32 | ||||
-rw-r--r-- | .config/fish/functions/fish_greeting.fish | 3 | ||||
-rw-r--r-- | .config/fish/functions/fish_prompt.fish | 22 | ||||
-rw-r--r-- | .config/fish/functions/fish_right_prompt.fish | 75 | ||||
-rw-r--r-- | .config/fish/functions/fish_user_key_bindings.fish | 3 | ||||
-rw-r--r-- | .config/fish/functions/n.fish | 33 | ||||
-rw-r--r-- | .config/fish/functions/sh.fish | 3 | ||||
-rw-r--r-- | .config/fish/functions/take.fish | 12 | ||||
-rw-r--r-- | .config/fish/functions/te.fish | 7 |
11 files changed, 291 insertions, 0 deletions
diff --git a/.config/fish/completions/nnn.fish b/.config/fish/completions/nnn.fish new file mode 100644 index 0000000..213c5e4 --- /dev/null +++ b/.config/fish/completions/nnn.fish | |||
@@ -0,0 +1,45 @@ | |||
1 | # | ||
2 | # Fish completion definition for nnn. | ||
3 | # | ||
4 | # Author: | ||
5 | # Arun Prakash Jana <engineerarun@gmail.com> | ||
6 | # | ||
7 | |||
8 | if test -n "$XDG_CONFIG_HOME" | ||
9 | set sessions_dir $XDG_CONFIG_HOME/.config/nnn/sessions | ||
10 | else | ||
11 | set sessions_dir $HOME/.config/nnn/sessions | ||
12 | end | ||
13 | |||
14 | complete -c nnn -s a -d 'auto-create NNN_FIFO' | ||
15 | complete -c nnn -s A -d 'disable dir auto-select' | ||
16 | complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')' | ||
17 | complete -c nnn -s c -d 'cli-only opener' | ||
18 | complete -c nnn -s C -d 'color by context' | ||
19 | complete -c nnn -s d -d 'start in detail mode' | ||
20 | complete -c nnn -s D -d 'dirs in context color' | ||
21 | complete -c nnn -s e -d 'open text files in $VISUAL/$EDITOR/vi' | ||
22 | complete -c nnn -s E -d 'use EDITOR for undetached edits' | ||
23 | complete -c nnn -s f -d 'use readline history file' | ||
24 | complete -c nnn -s g -d 'regex filters' | ||
25 | complete -c nnn -s H -d 'show hidden files' | ||
26 | complete -c nnn -s i -d 'show current file info' | ||
27 | complete -c nnn -s J -d 'no auto-proceed on select' | ||
28 | complete -c nnn -s K -d 'detect key collision' | ||
29 | complete -c nnn -s l -r -d 'lines to move per scroll' | ||
30 | complete -c nnn -s n -d 'start in type-to-nav mode' | ||
31 | complete -c nnn -s o -d 'open files only on Enter' | ||
32 | complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout' | ||
33 | complete -c nnn -s P -r -d 'plugin key to run' -x -a '(echo $NNN_PLUG | awk -F: -v RS=\; \'{print $1"\t"$2}\')' | ||
34 | complete -c nnn -s Q -d 'disable quit confirmation' | ||
35 | complete -c nnn -s r -d 'show cp, mv progress (Linux-only)' | ||
36 | complete -c nnn -s R -d 'disable rollover at edges' | ||
37 | complete -c nnn -s s -r -d 'load session by name' -x -a '@\t"last session" (ls $sessions_dir)' | ||
38 | complete -c nnn -s S -d 'persistent session' | ||
39 | complete -c nnn -s t -r -d 'timeout in seconds to lock' | ||
40 | complete -c nnn -s T -r -d 'a d e r s t v' | ||
41 | complete -c nnn -s u -d 'use selection (no prompt)' | ||
42 | complete -c nnn -s U -d 'show user and group' | ||
43 | complete -c nnn -s V -d 'show program version and exit' | ||
44 | complete -c nnn -s x -d 'notis, sel to system clipboard, xterm title' | ||
45 | complete -c nnn -s h -d 'show program help' | ||
diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..84e2340 --- /dev/null +++ b/.config/fish/config.fish | |||
@@ -0,0 +1,56 @@ | |||
1 | fish_add_path $HOME/.local/bin | ||
2 | |||
3 | set --global --export EDITOR nvim | ||
4 | set --global --export PAGER "less -R" | ||
5 | set --global --export MANPAGER nvim +Man! | ||
6 | set --global --export GOPATH $HOME/.local/share/go | ||
7 | set --global --export GPG_TTY (tty) | ||
8 | set --global fish_prompt_pwd_dir_length 0 | ||
9 | |||
10 | # nnn | ||
11 | set --global --export NNN_OPENER $HOME/.local/bin/nuke | ||
12 | set --global --export NNN_BMS "w:~/nextcloud/personal_wiki;r:~/nextcloud/research;n:~/nextcloud;d:~/down" | ||
13 | set --global --export NNN_COLORS 2136 | ||
14 | set --global --export NNN_FCOLORS c1e2272e006033f7c6d6abc4 | ||
15 | set --global --export NNN_PLUG "d:dragdrop;f:fzcd;h:fzhist;o:fzopen;l:launch;y:x2sel" | ||
16 | set --global --export NNN_TRASH 1 | ||
17 | |||
18 | set --global --export FZF_DEFAULT_OPTS "--height=40% --layout=reverse --info=inline --border" | ||
19 | set --global --export WECHALLUSER "drocan" | ||
20 | set --global --export WECHALLTOKEN "35624-0D38B-A2F16-A98B0-5963D-6DF19" | ||
21 | set --global --export RUST_SRC_PATH (rustc --print sysroot)/lib/rustlib/src/rust/library/ | ||
22 | set --global --export NLTK_DATA "$HOME/.local/share/nltk_data" | ||
23 | |||
24 | if status is-interactive | ||
25 | abbr --add --global v 'nvim' | ||
26 | abbr --add --global nt 'neomutt' | ||
27 | abbr --add --global rm 'rm -i' | ||
28 | abbr --add --global cp 'cp -i' | ||
29 | abbr --add --global mv 'mv -i' | ||
30 | abbr --add --global free 'free -m' | ||
31 | abbr --add --global df 'df -h' | ||
32 | abbr --add --global C 'xsel -b' # Copy to clipboard | ||
33 | abbr --add --global bc 'bc -l' | ||
34 | abbr --add --global ledger "ledger -f ~/nextcloud/virtuals/ledger.ledger" | ||
35 | abbr --add --global report "report -f ~/nextcloud/virtuals/ledger.ledger" | ||
36 | abbr --add --global think 'tickle +1d' #think it over | ||
37 | abbr --add --global lim 'nvim /home/yigit/nextcloud/virtuals/ledger.ledger' | ||
38 | abbr --add --global maybe 'task due:someday list' | ||
39 | abbr --add --global music 'mpv --no-vid' | ||
40 | abbr --add --global s "du -hs * | sort -rh | head -5" | ||
41 | abbr --add --global b "buku --suggest --colors 'onlxm'" | ||
42 | abbr --add --global tp 'trash-put' | ||
43 | abbr --add --global ls 'exa' | ||
44 | abbr --add --global wim 'nvim /home/yigit/nextcloud/personal_wiki/text/index.wiki' | ||
45 | abbr --add --global torem 'cd /home/yigit/nextcloud/virtuals/remind/' | ||
46 | abbr --add --global taw 'task add +next +@work' | ||
47 | abbr --add --global tat 'task add +next +@tablet pro:res.toread' | ||
48 | abbr --add --global tre 'exa -l -T -L 2 --header --git-ignore -F -d -I node_modules' | ||
49 | abbr --add --global guno 'git status -uno' | ||
50 | abbr --add --global bo 'bukuopener' | ||
51 | abbr --add --global re 'rem -gaad -@2' | ||
52 | abbr --add --global in 'task add +in' | ||
53 | abbr --add --global inc 'task +in +PENDING count' | ||
54 | |||
55 | zoxide init fish | source | ||
56 | end | ||
diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables new file mode 100644 index 0000000..588049d --- /dev/null +++ b/.config/fish/fish_variables | |||
@@ -0,0 +1,32 @@ | |||
1 | # This file contains fish universal variable definitions. | ||
2 | # VERSION: 3.0 | ||
3 | SETUVAR __fish_initialized:3100 | ||
4 | SETUVAR fish_color_autosuggestion:969896 | ||
5 | SETUVAR fish_color_cancel:\x2dr | ||
6 | SETUVAR fish_color_command:c397d8 | ||
7 | SETUVAR fish_color_comment:e7c547 | ||
8 | SETUVAR fish_color_cwd:green | ||
9 | SETUVAR fish_color_cwd_root:red | ||
10 | SETUVAR fish_color_end:c397d8 | ||
11 | SETUVAR fish_color_error:d54e53 | ||
12 | SETUVAR fish_color_escape:00a6b2 | ||
13 | SETUVAR fish_color_history_current:\x2d\x2dbold | ||
14 | SETUVAR fish_color_host:normal | ||
15 | SETUVAR fish_color_host_remote:yellow | ||
16 | SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue | ||
17 | SETUVAR fish_color_normal:normal | ||
18 | SETUVAR fish_color_operator:00a6b2 | ||
19 | SETUVAR fish_color_param:7aa6da | ||
20 | SETUVAR fish_color_quote:b9ca4a | ||
21 | SETUVAR fish_color_redirection:70c0b1 | ||
22 | SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack | ||
23 | SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack | ||
24 | SETUVAR fish_color_status:red | ||
25 | SETUVAR fish_color_user:brgreen | ||
26 | SETUVAR fish_color_valid_path:\x2d\x2dunderline | ||
27 | SETUVAR fish_key_bindings:fish_default_key_bindings | ||
28 | SETUVAR fish_pager_color_completion:normal | ||
29 | SETUVAR fish_pager_color_description:B3A06D\x1eyellow | ||
30 | SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline | ||
31 | SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan | ||
32 | SETUVAR fish_user_paths:/home/yigit/\x2elocal/bin | ||
diff --git a/.config/fish/functions/fish_greeting.fish b/.config/fish/functions/fish_greeting.fish new file mode 100644 index 0000000..ee7303d --- /dev/null +++ b/.config/fish/functions/fish_greeting.fish | |||
@@ -0,0 +1,3 @@ | |||
1 | function fish_greeting | ||
2 | fortune -a | cowsay -f small | lolcat | ||
3 | end | ||
diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..24e6e71 --- /dev/null +++ b/.config/fish/functions/fish_prompt.fish | |||
@@ -0,0 +1,22 @@ | |||
1 | function fish_prompt | ||
2 | set -l __last_command_exit_status $status | ||
3 | |||
4 | set -l cyan (set_color -o cyan) | ||
5 | set -l red (set_color -o red) | ||
6 | set -l green (set_color -o green) | ||
7 | set -l normal (set_color normal) | ||
8 | |||
9 | set -l marker_color "$green" | ||
10 | if test $__last_command_exit_status != 0 | ||
11 | set marker_color "$red" | ||
12 | end | ||
13 | |||
14 | set -l marker "$marker_color" "δ" | ||
15 | if fish_is_root_user | ||
16 | set marker "$marker_color# " | ||
17 | end | ||
18 | |||
19 | set -l cwd $cyan (string join / (string split -rn -m3 / (prompt_pwd) | tail -n3)) | ||
20 | |||
21 | echo -n -s $marker ' '$cwd $normal ' ' | ||
22 | end | ||
diff --git a/.config/fish/functions/fish_right_prompt.fish b/.config/fish/functions/fish_right_prompt.fish new file mode 100644 index 0000000..0dbcc37 --- /dev/null +++ b/.config/fish/functions/fish_right_prompt.fish | |||
@@ -0,0 +1,75 @@ | |||
1 | function fish_right_prompt -d "Write out the right prompt" | ||
2 | |||
3 | if not set -q -g __fish_right_prompt_functions_defined | ||
4 | set -g __fish_right_prompt_functions_defined | ||
5 | function _git_branch_name | ||
6 | set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null) | ||
7 | if set -q branch[1] | ||
8 | echo (string replace -r '^refs/heads/' '' $branch) | ||
9 | else | ||
10 | echo (git rev-parse --short HEAD 2>/dev/null) | ||
11 | end | ||
12 | end | ||
13 | |||
14 | function _is_git_dirty | ||
15 | not command git diff-index --cached --quiet HEAD -- &>/dev/null | ||
16 | or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null | ||
17 | end | ||
18 | |||
19 | function _is_git_repo | ||
20 | type -q git | ||
21 | or return 1 | ||
22 | git rev-parse --git-dir >/dev/null 2>&1 | ||
23 | end | ||
24 | |||
25 | function _hg_branch_name | ||
26 | echo (hg branch 2>/dev/null) | ||
27 | end | ||
28 | |||
29 | function _is_hg_dirty | ||
30 | set -l stat (hg status -mard 2>/dev/null) | ||
31 | test -n "$stat" | ||
32 | end | ||
33 | |||
34 | function _is_hg_repo | ||
35 | fish_print_hg_root >/dev/null | ||
36 | end | ||
37 | |||
38 | function _repo_branch_name | ||
39 | _$argv[1]_branch_name | ||
40 | end | ||
41 | |||
42 | function _is_repo_dirty | ||
43 | _is_$argv[1]_dirty | ||
44 | end | ||
45 | |||
46 | function _repo_type | ||
47 | if _is_hg_repo | ||
48 | echo hg | ||
49 | return 0 | ||
50 | else if _is_git_repo | ||
51 | echo git | ||
52 | return 0 | ||
53 | end | ||
54 | return 1 | ||
55 | end | ||
56 | end | ||
57 | |||
58 | set -l yellow (set_color -o yellow) | ||
59 | set -l red (set_color -o red) | ||
60 | set -l blue (set_color -o blue) | ||
61 | |||
62 | set -l repo_info | ||
63 | if set -l repo_type (_repo_type) | ||
64 | set -l repo_branch $red(_repo_branch_name $repo_type) | ||
65 | set repo_info "$blue $repo_type:($repo_branch$blue)" | ||
66 | |||
67 | if _is_repo_dirty $repo_type | ||
68 | set -l dirty "$yellow ✗" | ||
69 | set repo_info "$repo_info$dirty" | ||
70 | end | ||
71 | end | ||
72 | |||
73 | set hour $blue(date '+%R') | ||
74 | echo -n -s $repo_info ' ' $hour | ||
75 | end | ||
diff --git a/.config/fish/functions/fish_user_key_bindings.fish b/.config/fish/functions/fish_user_key_bindings.fish new file mode 100644 index 0000000..ff0d9f3 --- /dev/null +++ b/.config/fish/functions/fish_user_key_bindings.fish | |||
@@ -0,0 +1,3 @@ | |||
1 | function fish_user_key_bindings | ||
2 | fzf_key_bindings | ||
3 | end | ||
diff --git a/.config/fish/functions/n.fish b/.config/fish/functions/n.fish new file mode 100644 index 0000000..042011c --- /dev/null +++ b/.config/fish/functions/n.fish | |||
@@ -0,0 +1,33 @@ | |||
1 | function n --wraps=nnn --description 'support nnn quit and change directory' | ||
2 | # Block nesting of nnn in subshells | ||
3 | if test -n "$NNNLVL" | ||
4 | if [ (expr $NNNLVL + 0) -ge 1 ] | ||
5 | echo "nnn is already running" | ||
6 | return | ||
7 | end | ||
8 | end | ||
9 | |||
10 | # The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set) | ||
11 | # To cd on quit only on ^G, remove the "-x" as in: | ||
12 | # set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" | ||
13 | # (or, to a custom path: set NNN_TMPFILE "/tmp/.lastd") | ||
14 | # or, export NNN_TMPFILE after nnn invocation | ||
15 | if test -n "$XDG_CONFIG_HOME" | ||
16 | set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" | ||
17 | else | ||
18 | set NNN_TMPFILE "$HOME/.config/nnn/.lastd" | ||
19 | end | ||
20 | |||
21 | # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn | ||
22 | # stty start undef | ||
23 | # stty stop undef | ||
24 | # stty lwrap undef | ||
25 | # stty lnext undef | ||
26 | |||
27 | nnn -c $argv | ||
28 | |||
29 | if test -e $NNN_TMPFILE | ||
30 | source $NNN_TMPFILE | ||
31 | rm $NNN_TMPFILE | ||
32 | end | ||
33 | end | ||
diff --git a/.config/fish/functions/sh.fish b/.config/fish/functions/sh.fish new file mode 100644 index 0000000..3b7ae9a --- /dev/null +++ b/.config/fish/functions/sh.fish | |||
@@ -0,0 +1,3 @@ | |||
1 | function sh --wraps=ssh --description 'ssh with correct TERM' | ||
2 | TERM=xterm-256color ssh $argv | ||
3 | end | ||
diff --git a/.config/fish/functions/take.fish b/.config/fish/functions/take.fish new file mode 100644 index 0000000..407cf36 --- /dev/null +++ b/.config/fish/functions/take.fish | |||
@@ -0,0 +1,12 @@ | |||
1 | function take --description 'Create a directory and cd to it' | ||
2 | command mkdir $argv | ||
3 | if test $status = 0 | ||
4 | switch $argv[(count $argv)] | ||
5 | case '-*' | ||
6 | |||
7 | case '*' | ||
8 | cd $argv[(count $argv)] | ||
9 | return | ||
10 | end | ||
11 | end | ||
12 | end | ||
diff --git a/.config/fish/functions/te.fish b/.config/fish/functions/te.fish new file mode 100644 index 0000000..b0adca6 --- /dev/null +++ b/.config/fish/functions/te.fish | |||
@@ -0,0 +1,7 @@ | |||
1 | function te --description "take a temporary directory" | ||
2 | if set -q argv[1] | ||
3 | cd (command mktemp -d /tmp/$argv[1].XXXX) | ||
4 | else | ||
5 | cd (command mktemp -d /tmp/.XXXX) | ||
6 | end | ||
7 | end | ||