fish config

This commit is contained in:
odrling 2019-05-28 00:39:52 +02:00
parent 9cc0f9606e
commit aadb14a2b6
9 changed files with 193 additions and 0 deletions

View file

@ -0,0 +1,63 @@
#
# Completion for sudo
#
function __fish_sudo_print_remaining_args
set -l tokens (commandline -opc) (commandline -ct)
set -e tokens[1]
# These are all the options mentioned in the man page for Todd Miller's "sudo.ws" sudo (in that order).
# If any other implementation has different options, this should be harmless, since they shouldn't be used anyway.
set -l opts A/askpass b/background C/close-from= E/preserve-env=?
# Note that "-h" is both "--host" (which takes an option) and "--help" (which doesn't).
# But `-h` as `--help` only counts when it's the only argument (`sudo -h`),
# so any argument completion after that should take it as "--host".
set -a opts e/edit g/group= H/set-home h/host= '1-help'
set -a opts i/login K/remove-timestamp k/reset-timestamp l/list n/non-interactive
set -a opts P/preserve-groups p/prompt= S/stdin s/shell U/other-user=
set -a opts u/user= T/command-timeout= V/version v/validate
argparse -s $opts -- $tokens 2>/dev/null
# The remaining argv is the subcommand with all its options, which is what
# we want.
if test -n "$argv"
and not string match -qr '^-' $argv[1]
echo $argv
return 0
else
return 1
end
end
function __fish_sudo_no_subcommand
not __fish_sudo_print_remaining_args >/dev/null
end
function __fish_complete_sudo_subcommand
set -l PATH /sbin /usr/sbin $PATH
set -l args (__fish_sudo_print_remaining_args)
complete -C"$args"
end
# All these options should be valid for GNU and OSX sudo
complete -c sudo -n "__fish_no_arguments" -s h -d "Display help and exit"
complete -c sudo -n "__fish_no_arguments" -s V -d "Display version information and exit"
complete -c sudo -n "__fish_sudo_no_subcommand" -s A -d "Ask for password via the askpass or \$SSH_ASKPASS program"
complete -c sudo -n "__fish_sudo_no_subcommand" -s C -d "Close all file descriptors greater or equal to the given number" -a "(seq 0 255)"
complete -c sudo -n "__fish_sudo_no_subcommand" -s E -d "Preserve environment"
complete -c sudo -n "__fish_sudo_no_subcommand" -s H -d "Set home"
complete -c sudo -n "__fish_sudo_no_subcommand" -s K -d "Remove the credential timestamp entirely"
complete -c sudo -n "__fish_sudo_no_subcommand" -s P -d "Preserve group vector"
complete -c sudo -n "__fish_sudo_no_subcommand" -s S -d "Read password from stdin"
complete -c sudo -n "__fish_sudo_no_subcommand" -s b -d "Run command in the background"
complete -c sudo -n "__fish_sudo_no_subcommand" -s e -r -d "Edit"
complete -c sudo -n "__fish_sudo_no_subcommand" -s g -a "(__fish_complete_groups)" -x -d "Run command as group"
complete -c sudo -n "__fish_sudo_no_subcommand" -s i -d "Run a login shell"
complete -c sudo -n "__fish_sudo_no_subcommand" -s k -d "Reset or ignore the credential timestamp"
complete -c sudo -n "__fish_sudo_no_subcommand" -s l -d "List the allowed and forbidden commands for the given user, or the full path to the given command if it is allowed"
complete -c sudo -n "__fish_sudo_no_subcommand" -s n -d "Do not prompt for a password - if one is needed, fail"
complete -c sudo -n "__fish_sudo_no_subcommand" -s p -d "Specify a custom password prompt"
complete -c sudo -n "__fish_sudo_no_subcommand" -s s -d "Run the given command in a shell"
complete -c sudo -n "__fish_sudo_no_subcommand" -s u -a "(__fish_complete_users)" -x -d "Run command as user"
complete -c sudo -n "__fish_sudo_no_subcommand" -s v -n "__fish_no_arguments" -d "Validate the credentials, extending timeout"
# Complete the command we are executed under sudo
complete -c sudo -x -a "(__fish_complete_sudo_subcommand)"

9
.config/fish/config.fish Normal file
View file

@ -0,0 +1,9 @@
# .config/fish/config.fish
fish_vi_key_bindings 2> /dev/null # bind: Key with name “btab” does not have any mapping
alias dots="git --git-dir=$HOME/.dots --work-tree=$HOME"
for init in ~/.config/fish/modules/*/init.fish
source "$init"
end

View file

@ -0,0 +1,48 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR --export BEMENU_BACKEND:wayland
SETUVAR --export FZF_DEFAULT_COMMAND:fd\x1e\x2d\x2dtype\x1ef
SETUVAR --export FZF_DEFAULT_OPTS:\x2dm\x1e\x2d\x2dno\x2dmouse
SETUVAR --export NNN_BMS:h\x3a\x7e\x3ba\x3a\x3bd\x3a\x7e/Downloads\x3bp\x3a\x7e/Pictures
SETUVAR --export NNN_OPENER:/home/odrling/\x2elocal/bin/nnnopen
SETUVAR --export --path PATH:/home/odrling/\x2elocal/bin\x20/home/odrling/\x2elocal/bin\x20/home/odrling/\x2elocal/bin\x20/home/odrling/\x2elocal/bin\x20/home/odrling/\x2elocal/bin\x1e/bin\x1e/usr/bin
SETUVAR --export _JAVA_AWT_WM_NONREPARENTING:1
SETUVAR __fish_init_2_39_8:\x1d
SETUVAR __fish_init_2_3_0:\x1d
SETUVAR __fish_init_3_x:\x1d
SETUVAR _fish_abbr_cat:bat
SETUVAR _fish_abbr_pass:gopass
SETUVAR _fish_abbr_top:htop
SETUVAR _fish_abbr_venv:source\x20\x7e/\x2evenv/bin/activate\x2efish
SETUVAR _fish_abbr_vi:nvim
SETUVAR _fish_abbr_vim:nvim
SETUVAR _fish_abbr_ytdl:youtube\x2ddl
SETUVAR fish_color_at:888888
SETUVAR fish_color_autosuggestion:969896
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:b294bb
SETUVAR fish_color_comment:f0c674
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:b294bb
SETUVAR fish_color_error:cc6666
SETUVAR fish_color_escape:00a6b2
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:ff5fd7
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:00a6b2
SETUVAR fish_color_param:81a2be
SETUVAR fish_color_quote:b5bd68
SETUVAR fish_color_redirection:8abeb7
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red
SETUVAR fish_color_user:\x2do\x1e5fd7ff
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:
SETUVAR fish_key_bindings:fish_vi_key_bindings
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan

View file

@ -0,0 +1 @@
../modules/fish-ssh-agent/functions/__ssh_agent_is_started.fish

View file

@ -0,0 +1 @@
../modules/fish-ssh-agent/functions/__ssh_agent_start.fish

View file

@ -0,0 +1,63 @@
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set -l normal (set_color normal)
# Hack; fish_config only copies the fish_prompt function (see #736)
if not set -q -g __fish_classic_git_functions_defined
set -g __fish_classic_git_functions_defined
function __fish_repaint_user --on-variable fish_color_user --description "Event handler, repaint when fish_color_user changes"
if status --is-interactive
commandline -f repaint 2>/dev/null
end
end
function __fish_repaint_host --on-variable fish_color_host --description "Event handler, repaint when fish_color_host changes"
if status --is-interactive
commandline -f repaint 2>/dev/null
end
end
function __fish_repaint_status --on-variable fish_color_status --description "Event handler; repaint when fish_color_status changes"
if status --is-interactive
commandline -f repaint 2>/dev/null
end
end
function __fish_repaint_bind_mode --on-variable fish_color_at --description "Event handler; repaint when fish_color_at changes"
if status --is-interactive
commandline -f repaint 2>/dev/null
end
end
function __fish_repaint_bind_mode --on-variable fish_key_bindings --description "Event handler; repaint when fish_key_bindings changes"
if status --is-interactive
commandline -f repaint 2>/dev/null
end
end
end
set -l color_cwd
set -l prefix
set -l suffix
switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix ' #'
case '*'
set color_cwd $fish_color_cwd
set suffix ' $'
end
set -l prompt_status
if test $last_status -ne 0
set prompt_status ' ' (set_color $fish_color_status) "[$last_status]" "$normal"
end
echo -n -s (set_color $fish_color_user) "$USER" (set_color $fish_color_at) @ (set_color $fish_color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (basename (prompt_pwd)) $normal (__fish_vcs_prompt) $normal $prompt_status $suffix " "
end

@ -0,0 +1 @@
Subproject commit 1edbc9354a6e73890b63413017f85e5be3c8ce1e

4
.gitignore vendored
View file

@ -89,3 +89,7 @@ Cache
!/.newsboat
/.newsboat/*
!/.newsboat/config
# fish
!/.config/fish

3
.gitmodules vendored
View file

@ -38,3 +38,6 @@
[submodule ".vim/bundle/vim-airline-themes"]
path = .vim/bundle/vim-airline-themes
url = https://github.com/vim-airline/vim-airline-themes.git
[submodule ".config/fish/modules/fish-ssh-agent"]
path = .config/fish/modules/fish-ssh-agent
url = https://github.com/danhper/fish-ssh-agent.git