From 520e72b31ab2a65ebb9c0d5c64a3808cda55c5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Fri, 9 Aug 2024 15:27:48 +0200 Subject: [PATCH] fish: install fish, remove blesh, starship --- .bashrc | 4 - .config/fish/config.fish | 1 + .config/fish/fish_variables | 31 +++++ .config/fish/functions/fish_prompt.fish | 60 +++++++++ .config/starship.toml | 167 ------------------------ .config/sway/keys.swayconf | 3 + goog | 3 +- 7 files changed, 96 insertions(+), 173 deletions(-) create mode 100644 .config/fish/config.fish create mode 100644 .config/fish/fish_variables create mode 100644 .config/fish/functions/fish_prompt.fish delete mode 100644 .config/starship.toml diff --git a/.bashrc b/.bashrc index 611c1ae..d968370 100644 --- a/.bashrc +++ b/.bashrc @@ -10,10 +10,6 @@ alias s="kitten ssh" PS1='[\u@\h \W]\$ ' -eval "$(starship init bash)" -source ~/.local/share/blesh/ble.sh -complete -cf doas # doas completions - # bun export BUN_INSTALL="$HOME/.bun" export PATH=$BUN_INSTALL/bin:$PATH:~/.local/bin:~/go/bin:~/.wakatime diff --git a/.config/fish/config.fish b/.config/fish/config.fish new file mode 100644 index 0000000..909a70e --- /dev/null +++ b/.config/fish/config.fish @@ -0,0 +1 @@ +set -g fish_greeting diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables new file mode 100644 index 0000000..52cd691 --- /dev/null +++ b/.config/fish/fish_variables @@ -0,0 +1,31 @@ +# This file contains fish universal variable definitions. +# VERSION: 3.0 +SETUVAR __fish_initialized:3400 +SETUVAR fish_color_autosuggestion:brblack +SETUVAR fish_color_cancel:\x2dr +SETUVAR fish_color_command:blue +SETUVAR fish_color_comment:red +SETUVAR fish_color_cwd:green +SETUVAR fish_color_cwd_root:red +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan +SETUVAR fish_color_history_current:\x2d\x2dbold +SETUVAR fish_color_host:normal +SETUVAR fish_color_host_remote:yellow +SETUVAR fish_color_normal:normal +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +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:brgreen +SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_key_bindings:fish_default_key_bindings +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow\x1e\x2di +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_pager_color_selected_background:\x2dr diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..a0a3188 --- /dev/null +++ b/.config/fish/functions/fish_prompt.fish @@ -0,0 +1,60 @@ +# Modified theme beloglazov +# https://github.com/oh-my-fish/theme-beloglazov + +function _git_branch_name + echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||') +end + +function _is_git_dirty + echo (command git status -s --ignore-submodules=dirty 2> /dev/null) +end + +function _git_ahead_count -a branch_name + echo (command git log origin/$branch_name..HEAD 2> /dev/null | \ + grep '^commit' | wc -l | tr -d ' ') +end + +function fish_prompt + set -l last_status $status + + set -l cyan (set_color -o cyan) + set -l yellow (set_color -o yellow) + set -l green (set_color green) + set -l red (set_color red) + set -l brightred (set_color -o red) + set -l blue (set_color -o blue) + set -l normal (set_color normal) + + if [ $last_status != 0 ] + set failed "$brightred✘$normal " + end + + if [ 'root' = (whoami) ] + set arrow "$brightred➜$normal " + else + set arrow '' + end + + set -l time $red(date '+%I:%M')$normal + set -l cwd $cyan(prompt_pwd)$normal + + if [ (_git_branch_name) ] + set -l git_branch_name (_git_branch_name) + set -l git_branch $brightred$git_branch_name$normal + set git_info "$blue ($git_branch$blue)$normal" + set -l git_ahead_count (_git_ahead_count $git_branch_name) + + if [ $git_ahead_count != 0 ] + set -l ahead_count "$green+$git_ahead_count$normal" + set git_info "$git_info $ahead_count" + end + + if [ (_is_git_dirty) ] + set -l dirty "$yellow ✗$normal" + set git_info "$git_info$dirty" + end + end + + echo -n -s $failed $arrow $time ' ' $cwd $git_info $normal ' ' + +end diff --git a/.config/starship.toml b/.config/starship.toml deleted file mode 100644 index aee6704..0000000 --- a/.config/starship.toml +++ /dev/null @@ -1,167 +0,0 @@ -"$schema" = 'https://starship.rs/config-schema.json' - -format = """ -[](color_orange)\ -$os\ -$username\ -[](bg:color_yellow fg:color_orange)\ -$directory\ -[](fg:color_yellow bg:color_aqua)\ -$git_branch\ -$git_status\ -[](fg:color_aqua bg:color_blue)\ -$c\ -$rust\ -$golang\ -$nodejs\ -$php\ -$java\ -$kotlin\ -$haskell\ -$python\ -[](fg:color_blue bg:color_bg3)\ -$docker_context\ -$conda\ -[](fg:color_bg3 bg:color_bg1)\ -$time\ -[ ](fg:color_bg1)\ -$line_break$character""" - -palette = 'gruvbox_dark' - -[palettes.gruvbox_dark] -color_fg0 = '#fbf1c7' -color_bg1 = '#3c3836' -color_bg3 = '#665c54' -color_blue = '#458588' -color_aqua = '#689d6a' -color_green = '#98971a' -color_orange = '#d65d0e' -color_purple = '#b16286' -color_red = '#cc241d' -color_yellow = '#d79921' - -[os] -disabled = false -style = "bg:color_orange fg:color_fg0" - -[os.symbols] -Windows = "󰍲" -Ubuntu = "󰕈" -SUSE = "" -Raspbian = "󰐿" -Mint = "󰣭" -Macos = "󰀵" -Manjaro = "" -Linux = "󰌽" -Gentoo = "󰣨" -Fedora = "󰣛" -Alpine = "" -Amazon = "" -Android = "" -Arch = "󰣇" -Artix = "󰣇" -CentOS = "" -Debian = "󰣚" -Redhat = "󱄛" -RedHatEnterprise = "󱄛" - -[username] -show_always = true -style_user = "bg:color_orange fg:color_fg0" -style_root = "bg:color_orange fg:color_fg0" -format = '[ $user ]($style)' - -[directory] -style = "fg:color_fg0 bg:color_yellow" -format = "[ $path ]($style)" -truncation_length = 3 -truncation_symbol = "…/" - -[directory.substitutions] -"Documents" = "󰈙 " -"Downloads" = " " -"Music" = "󰝚 " -"Pictures" = " " -"Developer" = "󰲋 " - -[git_branch] -symbol = "" -style = "bg:color_aqua" -format = '[[ $symbol $branch ](fg:color_fg0 bg:color_aqua)]($style)' - -[git_status] -style = "bg:color_aqua" -format = '[[($all_status$ahead_behind )](fg:color_fg0 bg:color_aqua)]($style)' - -[nodejs] -symbol = "" -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[c] -symbol = " " -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[rust] -symbol = "" -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[golang] -symbol = "" -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[php] -symbol = "" -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[java] -symbol = " " -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[kotlin] -symbol = "" -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[haskell] -symbol = "" -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[python] -symbol = "" -style = "bg:color_blue" -format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' - -[docker_context] -symbol = "" -style = "bg:color_bg3" -format = '[[ $symbol( $context) ](fg:#83a598 bg:color_bg3)]($style)' - -[conda] -style = "bg:color_bg3" -format = '[[ $symbol( $environment) ](fg:#83a598 bg:color_bg3)]($style)' - -[time] -disabled = false -time_format = "%R" -style = "bg:color_bg1" -format = '[[  $time ](fg:color_fg0 bg:color_bg1)]($style)' - -[line_break] -disabled = false - -[character] -disabled = false -success_symbol = '[](bold fg:color_green)' -error_symbol = '[](bold fg:color_red)' -vimcmd_symbol = '[](bold fg:color_green)' -vimcmd_replace_one_symbol = '[](bold fg:color_purple)' -vimcmd_replace_symbol = '[](bold fg:color_purple)' -vimcmd_visual_symbol = '[](bold fg:color_yellow)' diff --git a/.config/sway/keys.swayconf b/.config/sway/keys.swayconf index 1f82085..f58e057 100644 --- a/.config/sway/keys.swayconf +++ b/.config/sway/keys.swayconf @@ -21,6 +21,9 @@ bindsym XF86AudioMicMute exec \ bindsym XF86MonBrightnessUp exec xbacklight -inc 10 bindsym XF86MonBrightnessDown exec xbacklight -dec 10 +# capture screen +bindsym Mod4+Shift+s exec grim -g "$(slurp)" '/tmp/$(date +%F_%T)_${WIDTH}x${HEIGHT}.png' && wl-copy < '/tmp/$(date +%F_%T)_${WIDTH}x${HEIGHT}.png' + # kill, reload bindsym { $mod+Shift+c kill diff --git a/goog b/goog index a5c39ff..2cf7f09 100755 --- a/goog +++ b/goog @@ -8,8 +8,7 @@ from common.sync import sync from common.util import expand stuff: list[str] = [ - *expand("~/.config/{kitty,nvim,pipewire,sway,swaylock,zed}/**"), - "~/.config/starship.toml", + *expand("~/.config/{fish,kitty,nvim,pipewire,sway,swaylock,zed}/**"), "~/.icons/**", *expand("~/.local/bin/{yarn}"), "~/.bashrc",