-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Show current mode in ZSH Vi mode #5438
Comments
Is there any way this feature could be added to |
@stepanzak I was playing around with this and adding the following snippet already enables this. Currently thinking about how to enable that from the configuration. .zshrcbindkey -v
_omp_redraw-prompt() {
local precmd
for precmd in $precmd_functions; do
$precmd
done
zle .reset-prompt
}
function _omp_zle-keymap-select() {
if [ "${KEYMAP}" = 'vicmd' ]; then
export POSH_VI_MODE="command"
else
export POSH_VI_MODE="insert"
fi
_omp_redraw-prompt
}
_omp_create_widget zle-keymap-select _omp_zle-keymap-select
# reset to default mode at the end of line input reading
function _omp_zle-line-finish() {
export POSH_VI_MODE="insert"
}
_omp_create_widget zle-line-finish _omp_zle-line-finish
# Fix a bug when you C-c in CMD mode, you'd be prompted with CMD mode indicator
# while in fact you would be in INS mode.
# Fixed by catching SIGINT (C-c), set mode to INS and repropagate the SIGINT,
# so if anything else depends on it, we will not break it.
TRAPINT() {
export POSH_VI_MODE="insert"
return $(( 128 + $1 ))
} And use the following code block to display this: mytheme.omp.json{
"type": "text",
"style": "plain",
"template": "{{ if .Env.POSH_VI_MODE }}({{ .Env.POSH_VI_MODE }}) {{ end }}"
} |
Hey, would it be possible for you to also make it where the prompt symbol can change based on what mode we're in? Possibly integrate with the zsh-vi-mode plugin as an additional nicety! |
@NovaViper that's not something we do, but changing the icon is rather straightforward with the use of a template |
@JanDeDobbeleer Ah ok! I was wondering because I can't consistently get the variable to display in the prompt. I can get it to show This is my zshrc (I'm using NixOS with Home-Manager to setup zsh), https://gist.github.com/NovaViper/6eeb096936b0c52290632986a3a18d38 |
Code of Conduct
What would you like to see added?
In ZSH, you can enable Vi mode with
bindkey -v
.Powerlevel10k has (had) a feature that shows current mode (
normal
/insert
/replace
etc.) and immediately updates it on change.I would love to be able to do the same in omp, since it's really annoying to use the Vi mode whilst not being able to tell whether I'm in
insert
mode or not.The text was updated successfully, but these errors were encountered: