GithubHelp home page GithubHelp logo

Comments (4)

ericbn avatar ericbn commented on August 26, 2024 1

This is what I've come up with: changing the prompt indicator to standout when in vicmd.

diff --git a/asciiship.zsh-theme b/asciiship.zsh-theme
index def650b..7641305 100644
--- a/asciiship.zsh-theme
+++ b/asciiship.zsh-theme
@@ -1,5 +1,23 @@
 # vim:et sts=2 sw=2 ft=zsh

+_prompt_asciiship_vimode() {
+  case ${KEYMAP} in
+    vicmd) print -n '%S%#%s' ;;
+    *) print -n '%#' ;;
+  esac
+}
+
+_prompt_asciiship_keymap_select() {
+  zle reset-prompt
+  zle -R
+}
+if autoload -Uz is-at-least && is-at-least 5.3; then
+  autoload -Uz add-zle-hook-widget && \
+      add-zle-hook-widget -Uz keymap-select _prompt_asciiship_keymap_select
+else
+  zle -N zle-keymap-select _prompt_asciiship_keymap_select
+fi
+
 typeset -g VIRTUAL_ENV_DISABLE_PROMPT=1

 setopt nopromptbang prompt{cr,percent,sp,subst}
@@ -31,5 +49,5 @@ fi

 PS1='
 %(2L.%B%F{yellow}(%L)%f%b .)%(!.%B%F{red}%n%f%b in .${SSH_TTY:+"%B%F{yellow}%n%f%b in "})${SSH_TTY:+"%B%F{green}%m%f%b in "}%B%F{cyan}%~%f%b${(e)git_info[prompt]}${VIRTUAL_ENV:+" via %B%F{yellow}${VIRTUAL_ENV:t}%b%f"}${duration_info}
-%B%(1j.%F{blue}*%f .)%(?.%F{green}.%F{red}%? )%#%f%b '
+%B%(1j.%F{blue}*%f .)%(?.%F{green}.%F{red}%? )$(_prompt_asciiship_vimode)%f%b '
 unset RPS1

from asciiship.

antoineco avatar antoineco commented on August 26, 2024 1

Contrary to what I remembered, standout does work perfectly fine in tmux on macOS, with the default tmux config (TERM=screen-256color) and the OS' default terminfo.
It also works in various terminal emulators I've tried on macOS, with various xterm terminfo variants.

tmux 3.3, screen-256color

image

Terminal.app, xterm-256color

image

Kitty, xterm-kitty

image


Patch applied, I think it looks great:

image

image


Underline wouldn't be very clear (and is probably not as widely supported as standout):

image

image

from asciiship.

ericbn avatar ericbn commented on August 26, 2024

Hi @antoineco. So good to know you like our lightweight prompt theme! :- D

Not sure which indicator to pick for the vicmd keymap. We're already using # when root, % otherwise. I'd rather keep just the lower ASCII chars for this prompt. Also, it's already green or red depending on the exit status of the last command. I agree changing the terminal cursor shape is controversial and error prone.

If you want to experiment with it yourself, we have two themes that have vicmd keymap indicators implemented:

It's quite a good amount of additional code.

from asciiship.

antoineco avatar antoineco commented on August 26, 2024

I hadn't though about standout, that could be a good approach I think! Underline comes to mind too.

I know that the screen-* / tmux-* terminfos that ship with macOS don't include italics and standout, but

  • those are much less common than xterm-*
  • a lot of macOS users who rely on these capabilities either enable them manually or recompile their terminfo from a more recent ncurses to enable them

I'll try your patch today and report here.
Thanks for looking into this so quickly!

from asciiship.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.