diff options
Diffstat (limited to 'lib/common.nix')
-rw-r--r-- | lib/common.nix | 106 |
1 files changed, 95 insertions, 11 deletions
diff --git a/lib/common.nix b/lib/common.nix index f482bc6..7ddff12 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -20,10 +20,6 @@ in { FD_OPTIONS = "--follow --exclude .git"; BAT_PAGER = "less -R"; - # FZF_DEFAULT_OPTS = "--bind='?:toggle-preview'"; - # FZF_DEFAULT_COMMAND = "git ls-files --cached --others --exclude-standard | fd --type f --type l $FD_OPTIONS"; - # FZF_CTRL_T_COMMAND = "fd $FD_OPTIONS"; - # FZF_ALT_C_COMMAND = "fd --type d $FD_OPTIONS"; FORGIT_FZF_DEFAULT_OPTS = '' --exact --border @@ -65,11 +61,61 @@ in { }; }; + fonts.fontconfig.enable = true; + programs = { home-manager = { enable = true; }; + starship = { + # export PS1='$(printf "%3.*s" $? $?)ϟ ' + enable = true; + settings = { + format = lib.concatStrings [ + #"$username" + "$hostname" + "$directory" + "$git_branch" + "$git_state" + "$git_status" + "$cmd_duration" + "$line_break" + "$character" + ]; + directory.style = "blue"; + character = { + success_symbol = "[ϟ](white)"; + error_symbol = "[ϟ](red)"; + }; + git_branch = { + format = "[$branch]($style)"; + style = "bright-black"; + }; + git_status = { + format = + ''[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)''; + style = "cyan"; + conflicted = ""; + untracked = ""; + modified = ""; + staged = ""; + renamed = ""; + deleted = ""; + stashed = "≡"; + }; + git_state = { + format = "\([$state( $progress_current/$progress_total)]($style)\) "; + style = "bright-black"; + }; + + cmd_duration = { + format = "[$duration]($style) "; + style = "yellow"; + }; + }; + }; + readline = { enable = true; variables = { @@ -88,6 +134,9 @@ in { # emacs-like history navigation "\\en" = "next-history"; "\\ep" = "previous-history"; + # groq-specific stuff + "\\er" = "redraw-current-line"; + "\\C-xt" = ''"$(_bake_targets)\e\C-e\er"''; }; extraConfig = '' $if Guile @@ -132,6 +181,20 @@ in { authors = "shortlog -s -n"; slog = "log --stat"; glog = ''log --decorate --all --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative''; + logbr = "log -r origin/HEAD..HEAD"; + mylog = ''!git log --author=$USER --decorate --pretty=format:"%Cred%h%Creset %s%Creset%C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative''; + mrd = "!cat <(git shortlog origin/HEAD..HEAD) <(git diff --stat origin/HEAD...HEAD)"; + extend = "!git commit --fixup $1 && git rebase --autosquash $1~"; + mr = lib.concatStringsSep " " [ + "!git push" + "-o merge_request.create" + "-o merge_request.merge_when_pipeline_succeeds" + "-o merge_request.label=ReleaseUpdate::NotRequired" + "-o merge_request.assign=$USER" + # disable these two args bc gitlab just uses the commit message anyway + # ''-o merge_request.title="$(git log -n1 --format=%s)"'' + # ''-o merge_request.description="$(git log -n --format=%b)"'' + ]; }; extraConfig = { commit.template = "${./git-commit-template}"; @@ -153,10 +216,14 @@ in { annotate = "yes"; cccmd = "git-contacts"; }; - }; }; + jujutsu = { + enable = true; + enableBashIntegration = true; + }; + tmux = { enable = true; aggressiveResize = false; @@ -241,10 +308,11 @@ in { ]; }; - urxvt = let font = size: "xft:Fira Mono:size=${toString size}:ant"; in { + urxvt = let font = name: size: "xft:${name}:size=${toString size}:ant"; in { enable = true; fonts = [ - (font (fontSize / 2)) + (font "Fira Code" fontSize) + (font "FiraCodeNerdfont" fontSize) "xft:Noto Emoji" ]; #keybindings = { @@ -318,6 +386,9 @@ in { bash = { enable = true; + #profileExtra = '' + # # put SSH_AUTH_SOCK here? + #''; initExtra = '' #DIR=~/.nix-profile/etc/profile.d #[[ -f "$DIR/nix.sh" ]] && . "$DIR/nix.sh" @@ -352,7 +423,8 @@ in { gawk 'match($0,/'$1'/, ary) {print ary['\$\{2:-'0'}']}'; } - export PS1='$(printf "%3.*s" $? $?)ϟ ' + # my old prompt, before i switched to starship + #export PS1='$(printf "%3.*s" $? $?)ϟ ' # kill a process with fzf fkill() { @@ -372,7 +444,10 @@ in { fzf_down() { fzf --height 50% --min-height 20 --border \ - --bind 'ctrl-/:change-preview-window(hidden|90%|)' "$@" + --bind 'ctrl-/:change-preview-window(hidden|90%|)' \ + --bind 'pgup:preview-page-up' \ + --bind 'pgdn:preview-page-down' \ + "$@" } _gf() { @@ -383,6 +458,13 @@ in { cut -c4- | sed 's/.* -> //' } + _gp() { + is_in_git_repo || return + stg series | + fzf_down -m --ansi --preview 'stg show -O --color=always {2}' | + cut -d' ' -f2 + } + _gb() { is_in_git_repo || return git branch -a --color=always | grep -v '/HEAD\s' | sort | @@ -401,12 +483,12 @@ in { _gh() { is_in_git_repo || return - git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always --no-merges | + git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | fzf_down --ansi --no-sort --reverse --multi --exact \ --bind 'ctrl-s:toggle-sort' \ --header 'Press CTRL-S to toggle sort' \ --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always | head -'$LINES | - grep -o "[a-f0-9]\{7,\}" + grep -o "[a-f0-9]\{7,\}" } _gr() { @@ -416,8 +498,10 @@ in { --preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1} | head -200' | cut -d$'\t' -f1 } + bind '"\er": redraw-current-line' bind '"\C-g\C-f": "$(_gf)\e\C-e\er"' + bind '"\C-g\C-p": "$(_gp)\e\C-e\er"' bind '"\C-g\C-b": "$(_gb)\e\C-e\er"' bind '"\C-g\C-t": "$(_gt)\e\C-e\er"' bind '"\C-g\C-h": "$(_gh)\e\C-e\er"' |