Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: indication of editing mode #115

Open
oscu0 opened this issue Dec 19, 2016 · 11 comments
Open

Feature request: indication of editing mode #115

oscu0 opened this issue Dec 19, 2016 · 11 comments
Labels
enhancement New feature or request

Comments

@oscu0
Copy link
Contributor

oscu0 commented Dec 19, 2016

As in, normal/insert. Prezto had it. This link has some info on it, although I don't know enough about ZSH to do it myself.

@Eriner Eriner added the feature label Jan 10, 2017
@Valinora
Copy link

Valinora commented Jan 17, 2017

Is there a particular prompt that you had in mind? I've customized the eriner prompt to include an indicator, but it also includes moving the prompt to a new line.

2017-01-17-155156_1440x900_scrot

I'll format my changes a little better and make a fork.

@Eriner
Copy link
Member

Eriner commented Jan 18, 2017

@Valinora looks good! Perhaps for the eriner prompt, keep it on one line, but "flip" the arrow arround (or make it hollow), see the SEGMENT_SEPARATOR. Maybe change it from this, to this?:

printf '\ue0b2'

.. and do a flip, --> becomes <--, then redraw the prompt? Seems like that would be the "inline" solution. Cheers! 👍

@Valinora
Copy link

Valinora commented Jan 18, 2017

With this theme, in longer directories the prompt is in the middle of the terminal, and get get pretty ugly in low resolution/small terminals with tiling WMs. That's why it's only a fork, and not a PR, because it has those customizations.

I'll make a branch with and try to get a few prompts working with more thematic indicators for each prompt.

@oscu0
Copy link
Contributor Author

oscu0 commented Jan 18, 2017

I use the 'Lean' prompt, but since that's external, a fork would probably required. I'd be perfectly willing to switch, but not to a two-line prompt, since in my usage vertical space is always lacking.

I'm not sure how easy it will be to tell which mode is currently active at a glance in your solution, though. Maybe just add 'Insert' text to the end of the prompt line to mimic Vim behavior? Since many prompts don't modify the end of the line, it might be easier to hack into prompts, although I know little about that.

@Valinora
Copy link

In mine, the arrow becomes red and faces the other direction when you're in 'NORMAL' mode. For the non-external themes I was planning on using a similar approach in a theme appropriate manor, however using a right hand side '[normal]' indicator should be pretty straightforward to implement.

@Valinora
Copy link

These are my initial ideas: Imgur Album
I wouldn't leave those as the final colour, however I think that I don't have to go that far as the RPROMPT method is fairly clearly the winner.

@oscu0
Copy link
Contributor Author

oscu0 commented Jan 18, 2017

The second screenshot looks perfect. The only nitpick is that it should be styled like '-- INSERT --', like in Vim, but that's of virtually no importance c:

You probably can make the style used configurable through '.zimrc'. Some people put Git info, the clock or some other data there. I always thought it looks ugly when it inevitably overflows, but it's a matter of taste, I guess.

@ericbn
Copy link
Member

ericbn commented Apr 2, 2017

It's easy to get to the following result, which I think would looker nicer than anything else (last line is in vicmd mode, with all separators inverted):

screen shot 2017-04-01 at 9 54 31 pm

Just replace \uE0B0 by %S\uE0B2%s. I've used this with my Agnoster prompt for Prezto.

As per #130, what we might need is a module for edit mode theming, as changing each prompt separately would create too much repeated code.

@oscu0
Copy link
Contributor Author

oscu0 commented Apr 6, 2018

While not related to Zim per se, it's possible to make vi mode visible with powerlevel9k and this in .zshrc, in addition to enabling vi_mode prompt segment:

function zle-line-init {
  powerlevel9k_prepare_prompts
  if (( ${+terminfo[smkx]} )); then
    printf '%s' ${terminfo[smkx]}
  fi
  zle reset-prompt
  zle -R
}

function zle-line-finish {
  powerlevel9k_prepare_prompts
  if (( ${+terminfo[rmkx]} )); then
    printf '%s' ${terminfo[rmkx]}
  fi
  zle reset-prompt
  zle -R
}

function zle-keymap-select {
  powerlevel9k_prepare_prompts
  zle reset-prompt
  zle -R
}

zle -N zle-line-init
zle -N ale-line-finish
zle -N zle-keymap-select

@ericbn ericbn added enhancement New feature or request and removed feature labels May 7, 2020
@PatTheMav
Copy link

@ericbn Does it make sense to keep this as a feature request on the main repo when it sounds like it needs to implemented per theme anyway?

@ericbn
Copy link
Member

ericbn commented Jun 26, 2021

This could be done as a separate module, like Prezto did, but on the other hand, setting the module in each theme seems to add as much code as if it the changes were done directly.

Should we add the vicmd mode indicator to all our themes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

5 participants