From 6a92b4993cbfc435c5dc257132fa7bb4e5f91b58 Mon Sep 17 00:00:00 2001 From: mintycube <90507714+mintycube@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:05:50 +0500 Subject: [PATCH] Add starship prompt to lf --- .config/lf/lfrc | 20 ++------ .config/starship.toml | 107 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 103 insertions(+), 24 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 38d25d8..5c9fca3 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -44,23 +44,9 @@ cmd open ${{ }} cmd on-cd &{{ - # display repository status in your prompt - if [ -d .git ] || [ -f .git ]; then - branch=$(git branch --show-current 2>/dev/null) || true - remote=$(git config --get branch.$branch.remote 2>/dev/null) || true - url=$(git remote get-url $remote 2>/dev/null) || true - # "\033[32m \033[35;1m%d\033[0m\033[1m%f\033[0m" - fmt="\033[32m \033[35;1m%d\033[0m\033[1m%f\033[32m  $branch 󰄾 $url\033[0m" - elif [ -d .hg ]; then - hg=$(hg branch 2>/dev/null) || true - fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m [HG BRANCH:> $hg]\033[0m" - elif [ -d .svn ]; then - svn=$(svn info 2>/dev/null | awk '/^URL: /{print $2}') || true - fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m [SVN URL:> $svn]\033[0m" - else - fmt="\033[32m \033[35;1m%d\033[0m\033[1m%f\033[0m" - fi - lf -remote "send $id set promptfmt \"$fmt\"" + export STARSHIP_SHELL= + fmt="$(starship prompt)" + lf -remote "send $id set promptfmt \"$fmt\"" }} diff --git a/.config/starship.toml b/.config/starship.toml index c401434..255be87 100644 --- a/.config/starship.toml +++ b/.config/starship.toml @@ -1,13 +1,106 @@ -[git_branch] -symbol = ' ' +add_newline = false -[git_metrics] -disabled = false -added_style = 'bold blue' -format = '[+$added]($added_style)/[-$deleted]($deleted_style) ' +[battery] +disabled = true + +[cmd_duration] +disabled = true [gcloud] disabled = true -[battery] +[memory_usage] disabled = true + +[os] +disabled = true + +[time] +disabled = true + +[username] +disabled = true + +[character] +disabled = true + +[git_metrics] +disabled = false +added_style = 'bold blue' +format = ' \[[+$added]($added_style)/[-$deleted]($deleted_style)\] ' + +[c] +symbol = " " +format = '\[[$symbol($version(-$name))]($style)\]' + +[cmake] +format = '\[[$symbol($version)]($style)\]' + +[conda] +symbol = " " +format = '\[[$symbol$environment]($style)\]' + +[docker_context] +symbol = " " +format = '\[[$symbol$context]($style)\]' + +[git_branch] +symbol = ' ' +format = '\[[$symbol$branch]($style)\]' + +[git_status] +format = '([\[$all_status$ahead_behind\]]($style)) ' + +[golang] +symbol = '󰟓 ' +format = '\[[$symbol($version)]($style)\]' + +[gradle] +symbol = ' ' +format = '\[[$symbol($version)]($style)\]' + +[haskell] +symbol = " " +format = '\[[$symbol($version)]($style)\]' + +[kotlin] +symbol = " " +format = '\[[$symbol($version)]($style)\]' + +[kubernetes] +symbol = "󱃾 " +format = '\[[$symbol$context( \($namespace\))]($style)\]' + +[lua] +symbol = "󰢱 " +format = '\[[$symbol($version)]($style)\]' + +[meson] +format = '\[[$symbol$project]($style)\]' + +[nodejs] +symbol = "󰎙 " +format = '\[[$symbol($version)]($style)\]' + +[perl] +symbol = " " +format = '\[[$symbol($version)]($style)\]' + +[php] +symbol = "󰌟 " +format = '\[[$symbol($version)]($style)\]' + +[python] +symbol = " " +format = '\[[${symbol}${pyenv_prefix}(${version})(\($virtualenv\))]($style)\]' + +[ruby] +symbol = " " +format = '\[[$symbol($version)]($style)\]' + +[rust] +symbol = " " +format = '\[[$symbol($version)]($style)\]' + +[sudo] +format = '\[[as $symbol]($style)\]'