# HG changeset patch # User Zeger Van de Vannet # Date 1714149802 -7200 # Node ID 6ab26ddbf78d0d1c3d66b7718b687ce3e919811a # Parent 38b8060cdf243fcbdea1fe0041cb5206596227bd feat: add fish shell diff -r 38b8060cdf24 -r 6ab26ddbf78d .chezmoiexternal.toml --- a/.chezmoiexternal.toml Sun Jun 16 20:25:12 2024 +0200 +++ b/.chezmoiexternal.toml Fri Apr 26 18:43:22 2024 +0200 @@ -70,6 +70,14 @@ type = "file" url = "https://git.zx2c4.com/password-store/plain/src/completion/pass.zsh-completion" +[".config/fish/completions/chezmoi.fish"] + type = "file" + url = "https://raw.githubusercontent.com/twpayne/chezmoi/v2.47.4/completions/chezmoi.fish" + +[".config/fish/completions/hx.fish"] + type = "file" + url = "https://raw.githubusercontent.com/helix-editor/helix/23.03/contrib/completion/hx.fish" + [".config/helix/runtime/queries/tcl/highlights.scm"] type = "file" url = "https://github.com/lewis6991/tree-sitter-tcl/raw/ac8b94b7a89825ddbdd6f8fc0a81c67c065be851/queries/tcl/highlights.scm" diff -r 38b8060cdf24 -r 6ab26ddbf78d .chezmoiscripts/run_onchange_after_15-install-ubuntu-packages.sh.tmpl --- a/.chezmoiscripts/run_onchange_after_15-install-ubuntu-packages.sh.tmpl Sun Jun 16 20:25:12 2024 +0200 +++ b/.chezmoiscripts/run_onchange_after_15-install-ubuntu-packages.sh.tmpl Fri Apr 26 18:43:22 2024 +0200 @@ -29,11 +29,13 @@ {{ $ppa := list "ppa:maveonair/helix-editor" - "ppa:mozillateam/ppa" -}} + "ppa:mozillateam/ppa" + "ppa:fish-shell/release-3" -}} {{ $extra_packages := list "helix" - "firefox" -}} + "firefox" + "fish" -}} #!/usr/bin/env bash set -xe diff -r 38b8060cdf24 -r 6ab26ddbf78d .chezmoiscripts/run_onchange_after_22-install-devtools.sh.tmpl --- a/.chezmoiscripts/run_onchange_after_22-install-devtools.sh.tmpl Sun Jun 16 20:25:12 2024 +0200 +++ b/.chezmoiscripts/run_onchange_after_22-install-devtools.sh.tmpl Fri Apr 26 18:43:22 2024 +0200 @@ -30,4 +30,8 @@ popd rm -rf $DOWNLOAD_DIR +FISH_COMPLETIONS=$HOME/.config/fish/completions +$INSTALL_DIR/rg --generate=complete-fish > $FISH_COMPLETIONS/rg.fish +$INSTALL_DIR/fd --gen-completions fish > $FISH_COMPLETIONS/fd.fish + {{ end }} diff -r 38b8060cdf24 -r 6ab26ddbf78d dot_config/private_fish/config.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dot_config/private_fish/config.fish Fri Apr 26 18:43:22 2024 +0200 @@ -0,0 +1,26 @@ +set -x EDITOR hx +set -x HGEDITOR hx + +set -x RIPGREP_CONFIG_PATH $HOME/.config/ripgrep/ripgreprc +set -x BAT_CONFIG_PATH $HOME/.config/bat/config + +set -x PS_FORMAT 'pid,pgid,state,start_time,%cpu,command' + +set -x PATH $HOME/.local/bin $HOME/bin $PATH + +if test -e "$HOME/bin/mise" + $HOME/bin/mise activate fish | source +end + +direnv hook fish | source + +if status is-interactive + # Commands to run in interactive sessions can go here + + # Select modified paths via fzf on alt+g + bind \eg fzf_hg_status_files + # Select output lines from last command + bind \er fzf_last_command_output + + abbr hgst hg status +end diff -r 38b8060cdf24 -r 6ab26ddbf78d dot_config/private_fish/functions/fish_prompt.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dot_config/private_fish/functions/fish_prompt.fish Fri Apr 26 18:43:22 2024 +0200 @@ -0,0 +1,24 @@ +set fish_prompt_pwd_dir_length 2 +set -g fish_prompt_pwd_full_dirs 5 +function fish_prompt + set -l last_pipestatus $pipestatus + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. + set -l normal (set_color normal) + set -q fish_color_status + or set -g fish_color_status red + + set -l bold_flag --bold + set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation + if test $__fish_prompt_status_generation = $status_generation + set bold_flag + end + set __fish_prompt_status_generation $status_generation + set -l status_color (set_color $fish_color_status) + set -l statusb_color (set_color $bold_flag $fish_color_status) + set -l prompt_status (__fish_print_pipestatus " [" "]" "|" "$status_color" "$statusb_color" $last_pipestatus) + + echo (set_color cyan)(date +%H:%M:%S) (set_color red)(prompt_hostname) (set_color blue)(prompt_pwd)(set_color normal) + + set -l active_jobs (jobs | wc -l) + echo "$active_jobs$prompt_status -> " +end diff -r 38b8060cdf24 -r 6ab26ddbf78d dot_config/private_fish/functions/fish_right_prompt.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dot_config/private_fish/functions/fish_right_prompt.fish Fri Apr 26 18:43:22 2024 +0200 @@ -0,0 +1,18 @@ +function fish_right_prompt + if not command -sq hg + return 1 + end + + set -l root (fish_print_hg_root) + or return 1 + + # In stead of running this command, cat the branch and topic name from the .hg folder + # echo (set_color yellow)(HGPLAIN= HGRCPATH= hg --config extensions.topic= log -r 'wdir()' --template='{fqbn}' 2>/dev/null) (set_color normal) + set -l branch (cat $root/branch 2>/dev/null; or echo default) + if set -l topic (cat $root/topic 2>/dev/null) + set branch "$branch//$topic" + end + # TODO: add topic namespace when available + + echo (set_color green)"$branch "(set_color normal) +end diff -r 38b8060cdf24 -r 6ab26ddbf78d dot_config/private_fish/functions/fzf_hg_status_files.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dot_config/private_fish/functions/fzf_hg_status_files.fish Fri Apr 26 18:43:22 2024 +0200 @@ -0,0 +1,7 @@ +function fzf_hg_status_files + set result (HGRCPATH= rhg status -n --color=always --config commands.status.relative=yes| fzf --ansi -m --header "Select the file(s) to insert in the command line") + if test -n "$result" + commandline -i (string join " " -- $result "") # adds a space after the inserted line output + end + commandline -f repaint +end diff -r 38b8060cdf24 -r 6ab26ddbf78d dot_config/private_fish/functions/fzf_last_command_output.fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dot_config/private_fish/functions/fzf_last_command_output.fish Fri Apr 26 18:43:22 2024 +0200 @@ -0,0 +1,10 @@ +function fzf_last_command_output + set cmd (history | fzf --header "Choose the command to rerun.") + if test -n "$cmd" + set result (eval $cmd | fzf -m --header "Choose the line(s) from the repeated command\'s output to paste into the current command-line. (The order matters!)") + if test -n "$result" + commandline -i (string join " " -- $result "") # adds a space after the inserted line output + end + end + commandline -f repaint +end diff -r 38b8060cdf24 -r 6ab26ddbf78d system/ubuntu/fish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system/ubuntu/fish Fri Apr 26 18:43:22 2024 +0200 @@ -0,0 +1,3 @@ +Package: * +Pin: release o=LP-PPA-fish-shell +Pin-Priority: 1001