Post History
You can modify your existing code to use the cursor shape codes for a vertical line (or "I" cursor) and a block cursor instead of the beam cursor shape. Here is an updated version of your code that...
Answer
#1: Initial revision
You can modify your existing code to use the cursor shape codes for a vertical line (or "I" cursor) and a block cursor instead of the beam cursor shape. Here is an updated version of your code that will show a vertical line cursor in insert mode and a block cursor in normal mode: ``` # change cursor shape for different vi modes cursor_mode() { # See https://ttssh2.osdn.jp/manual/4/en/usage/tips/vim.html for cursor shapes cursor_block='\e[2 q' cursor_vertical='\e[3 q' function zle-keymap-select { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then echo -ne $cursor_block elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || [[ $1 = 'vertical' ]]; then echo -ne $cursor_vertical fi } zle-line-init() { echo -ne $cursor_vertical } zle -N zle-keymap-select zle -N zle-line-init } cursor_mode ``` This updated code sets the cursor_block variable to the code for a block cursor, and the cursor_vertical variable to the code for a vertical line cursor. In the zle-keymap-select function, it checks the current keymap and the argument passed to the function to determine whether to display the block or vertical line cursor. In the zle-line-init function, it sets the initial cursor shape to the vertical line cursor.