Add fish config

This commit is contained in:
Daniel Lundin 2024-03-25 22:57:04 +01:00
parent 57ad37b67e
commit 6a52cd262c
8 changed files with 180 additions and 5 deletions

View file

@ -0,0 +1,6 @@
abbr --add b git branch -va
abbr --add d git diff --stat -p -C --color-words
abbr --add new git checkout --detach main
abbr --add s git st
abbr --add sl git branchless smartlog
abbr --add sw git branchless switch --interactive

View file

@ -0,0 +1,10 @@
alias e='tmux-edit-helper'
alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git'
alias git='git-branchless wrap --'
alias l='bat --wrap=never --pager="less -S"'
alias ls=eza
alias tail='tail -n $LINES'
alias timestamp='TZ=Z date "+%Y%m%dT%H%M%SZ"'
alias top='btm --basic --enable_cache_memory --enable_gpu_memory --battery'
alias w="history -1 | sed -e 's/[0-9]* //' | xargs viddy -n1"
alias xc=fish_clipboard_copy

View file

@ -0,0 +1,37 @@
set GO_TASK_PROGNAME task
function __task_get_tasks --description "Prints all available tasks with their description"
# Read the list of tasks (and potential errors)
$GO_TASK_PROGNAME --list-all 2>&1 | read -lz rawOutput
# Return on non-zero exit code (for cases when there is no Taskfile found or etc.)
if test $status -ne 0
return
end
# Grab names and descriptions (if any) of the tasks
set -l output (echo $rawOutput | sed -e '1d; s/\* \(.*\):\s*\(.*\)\s*(aliases.*/\1\t\2/' -e 's/\* \(.*\):\s*\(.*\)/\1\t\2/'| string split0)
if test $output
echo $output
end
end
complete -c $GO_TASK_PROGNAME -d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was
specified.' -xa "(__task_get_tasks)"
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
complete -c $GO_TASK_PROGNAME -l dry -d 'compiles and prints tasks in the order that they would be run, without executing them'
complete -c $GO_TASK_PROGNAME -s f -l force -d 'forces execution even when the task is up-to-date'
complete -c $GO_TASK_PROGNAME -s h -l help -d 'shows Task usage'
complete -c $GO_TASK_PROGNAME -s i -l init -d 'creates a new Taskfile.yml in the current folder'
complete -c $GO_TASK_PROGNAME -s l -l list -d 'lists tasks with description of current Taskfile'
complete -c $GO_TASK_PROGNAME -s o -l output -d 'sets output style: [interleaved|group|prefixed]' -xa "interleaved group prefixed"
complete -c $GO_TASK_PROGNAME -s p -l parallel -d 'executes tasks provided on command line in parallel'
complete -c $GO_TASK_PROGNAME -s s -l silent -d 'disables echoing'
complete -c $GO_TASK_PROGNAME -l status -d 'exits with non-zero exit code if any of the given tasks is not up-to-date'
complete -c $GO_TASK_PROGNAME -l summary -d 'show summary about a task'
complete -c $GO_TASK_PROGNAME -s t -l taskfile -d 'choose which Taskfile to run. Defaults to "Taskfile.yml"'
complete -c $GO_TASK_PROGNAME -s v -l verbose -d 'enables verbose mode'
complete -c $GO_TASK_PROGNAME -l version -d 'show Task version'
complete -c $GO_TASK_PROGNAME -s w -l watch -d 'enables watch of the given task'

49
.config/fish/config.fish Normal file
View file

@ -0,0 +1,49 @@
set fish_greeting
fish_add_path $HOME/.cargo/bin
fish_add_path $HOME/bin
if status is-interactive
## Utilities
function tree
eza --tree --color=always $argv | bat --wrap=never
end
function rg --wraps rg --description 'ripgrep with bat'
/usr/bin/rg --color=always $argv | bat --wrap=never
end
## Directory jumping with frecency
function fre_after_cd --on-variable PWD
fre --add "$PWD"
end
function jump
set _dir $(fre --sorted | fzf-tmux --no-sort -p 90%,40% -y 0)
[ -n "$_dir" ] && pushd $_dir >>/dev/null
commandline -f repaint
end
bind \cg jump
## History
atuin init fish | source
## Prompt
function starship_transient_prompt_func
starship module character
end
starship init fish | source
enable_transience
end
## Direnv
direnv hook fish | source

View file

@ -0,0 +1,43 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3400
SETUVAR fish_color_autosuggestion:6c7086
SETUVAR fish_color_cancel:f38ba8
SETUVAR fish_color_command:89b4fa
SETUVAR fish_color_comment:7f849c\x1e\x2d\x2ditalics\x1e\x2d\x2ddim
SETUVAR fish_color_cwd:f9e2af
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:fab387
SETUVAR fish_color_error:f38ba8
SETUVAR fish_color_escape:eba0ac
SETUVAR fish_color_gray:6c7086
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:89b4fa
SETUVAR fish_color_host_remote:a6e3a1
SETUVAR fish_color_keyword:f38ba8
SETUVAR fish_color_normal:cdd6f4
SETUVAR fish_color_operator:f5c2e7
SETUVAR fish_color_option:a6e3a1
SETUVAR fish_color_param:f2cdcd
SETUVAR fish_color_quote:a6e3a1
SETUVAR fish_color_redirection:f5c2e7
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d313244
SETUVAR fish_color_selection:\x2d\x2dbackground\x3d313244
SETUVAR fish_color_status:f38ba8
SETUVAR fish_color_user:94e2d5
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_background:\x1d
SETUVAR fish_pager_color_completion:cdd6f4
SETUVAR fish_pager_color_description:6c7086
SETUVAR fish_pager_color_prefix:f5c2e7
SETUVAR fish_pager_color_progress:6c7086
SETUVAR fish_pager_color_secondary_background:\x1d
SETUVAR fish_pager_color_secondary_completion:\x1d
SETUVAR fish_pager_color_secondary_description:\x1d
SETUVAR fish_pager_color_secondary_prefix:\x1d
SETUVAR fish_pager_color_selected_background:\x1d
SETUVAR fish_pager_color_selected_completion:\x1d
SETUVAR fish_pager_color_selected_description:\x1d
SETUVAR fish_pager_color_selected_prefix:\x1d
SETUVAR fish_user_paths:/home/dln/bin\x1e/home/dln/\x2ecargo/bin

View file

@ -0,0 +1,30 @@
# name: 'Catppuccin mocha'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: 1e1e2e
fish_color_normal cdd6f4
fish_color_command 89b4fa
fish_color_param f2cdcd
fish_color_keyword f38ba8
fish_color_quote a6e3a1
fish_color_redirection f5c2e7
fish_color_end fab387
fish_color_comment 7f849c --italics --dim
fish_color_error f38ba8
fish_color_gray 6c7086
fish_color_selection --background=313244
fish_color_search_match --background=313244
fish_color_option a6e3a1
fish_color_operator f5c2e7
fish_color_escape eba0ac
fish_color_autosuggestion 6c7086
fish_color_cancel f38ba8
fish_color_cwd f9e2af
fish_color_user 94e2d5
fish_color_host 89b4fa
fish_color_host_remote a6e3a1
fish_color_status f38ba8
fish_pager_color_progress 6c7086
fish_pager_color_prefix f5c2e7
fish_pager_color_completion cdd6f4
fish_pager_color_description 6c7086

View file

@ -1,6 +1,6 @@
"$schema" = 'https://starship.rs/config-schema.json'
add_newline = false
add_newline = true
format = """\
$directory\
@ -13,7 +13,7 @@ $hostname"""
[hostname]
ssh_only = false
format = " [](fg:#333333)[ $hostname ](italic dimmed bg:#333333)"
format = " [](fg:#333333)[ $hostname ](italic dimmed bg:#333333)"
disabled = false
[directory]

View file

@ -18,12 +18,12 @@ set -g set-clipboard on
bind-key ] paste-buffer -p
set-environment -g "SSH_AUTH_SOCK" "$XDG_RUNTIME_DIR/gcr/ssh"
set -g update-environment "BUILDCOMMAND GOPACKAGESDRIVER SSH_AUTH_SOCK SSH_CONNECTION"
set -g default-command zsh
set -g update-environment "BUILD_COMMAND GOPACKAGESDRIVER SSH_AUTH_SOCK SSH_CONNECTION"
#set -g default-command "$SHELL"
set -g history-limit 10000
#
set -g default-terminal "wezterm"
set -ga terminal-features '*:overline:strikethrough:usstyle:RGB'
set -ga terminal-features '*:clipboard:ccolor:hyperlinks:osc7:overline:sixel:strikethrough:title:usstyle:RGB'
# Key bindings
bind -n M-Tab if-shell 'test #{window_panes} -gt 1' 'last-pane' 'last-window'