Foren: ヘルプ (Thread #46551)

Show current mode in Vi mode (2022-08-19 07:46 by awkless #91061)

Is there any way to show the current mode of operation when 'set -o vi' is enabled? I looked through the manual, especially the line-editing section, and I cannot find anything about displaying the current Vi mode that the shell is in. Is this not a feature of Yash? Or did I skip a section in the manual?

Reply to #91061×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Anmelden

Re: Show current mode in Vi mode (2022-08-20 11:09 by magicant #91078)

Unfortunately, there is no way to tell whether the current state is the insert mode or the normal mode in a visual manner.
Reply to #91061

Reply to #91078×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Anmelden

Re: Show current mode in Vi mode (2022-08-23 05:45 by awkless #91124)

Reply To Message #91078
> Unfortunately, there is no way to tell whether the current state is the insert mode or the normal mode in a visual manner.

Thank you for letting me know.
Reply to #91078

Reply to #91124×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Anmelden

Re: Show current mode in Vi mode (2022-09-08 17:39 by WolfsDream #91414)

Reply To Message #91124
> Reply To Message #91078
> > Unfortunately, there is no way to tell whether the current state is the insert mode or the normal mode in a visual manner.
>
> Thank you for letting me know.

In zsh it can be done like this:
is it possible to have something similar?
changing to beam shape cursor works in yash too

# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
Reply to #91124

Reply to #91414×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Anmelden