Neovim/設定/モードによってカーソル形状を変える

Neovim/設定/モードによってカーソル形状を変える

nvim は多分標準でノーマルモード(ブロック)とインサートモード(Iビーム)で、カーソル形状が切り替わるようになっている。

さらにコマンドモードもIビームにしたい。

set guicursor+=c:ver10

これでコマンドモードの時のカーソル形状がIビームになる。

この指定の仕方は Nvim documentation: options ここにこのように載っているのでこれに従えばよい

'guicursor' 'gcr'	string	(default "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20")
			global
	Configures the cursor style for each mode. Works in the GUI and many
	terminals.  See |tui-cursor-shape|.

	To disable cursor-styling, reset the option:
		:set guicursor=

 	To enable mode shapes, "Cursor" highlight, and blinking:
		:set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
		  \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
		  \,sm:block-blinkwait175-blinkoff150-blinkon175

 	The option is a comma separated list of parts.  Each part consists of a
	mode-list and an argument-list:
		mode-list:argument-list,mode-list:argument-list,..
	The mode-list is a dash separated list of these modes:
		n	Normal mode
		v	Visual mode
		ve	Visual mode with 'selection' "exclusive" (same as 'v',
			if not specified)
		o	Operator-pending mode
		i	Insert mode
		r	Replace mode
		c	Command-line Normal (append) mode
		ci	Command-line Insert mode
		cr	Command-line Replace mode
		sm	showmatch in Insert mode
		a	all modes
	The argument-list is a dash separated list of these arguments:
		hor{N}	horizontal bar, {N} percent of the character height
		ver{N}	vertical bar, {N} percent of the character width
		block	block cursor, fills the whole character
			[only one of the above three should be present]

		blinkwait{N}				*cursor-blinking*
		blinkon{N}
		blinkoff{N}
			blink times for cursor: blinkwait is the delay before
			the cursor starts blinking, blinkon is the time that
			the cursor is shown and blinkoff is the time that the
			cursor is not shown.  The times are in msec.  When one
			of the numbers is zero, there is no blinking. E.g.:
				:set guicursor=n:blinkon0
 		{group-name}
			Highlight group name that sets the color and font for
			the cursor. |inverse|/reverse and no group-name are
			interpreted as "the host terminal default cursor
			colors" which usually invert bg and fg colors.
		{group-name}/{group-name}
			Two highlight group names, the first is used when
			no language mappings are used, the other when they
			are. |language-mapping|

	Examples of parts:
	   n-c-v:block-nCursor	In Normal, Command-line and Visual mode, use a
				block cursor with colors from the "nCursor"
				highlight group
	   n-v-c-sm:block,i-ci-ve:ver25-Cursor,r-cr-o:hor20
				In Normal et al. modes, use a block cursor
				with the default colors defined by the host
				terminal.  In Insert-likes modes, use
				a vertical bar cursor with colors from
				"Cursor" highlight group.  In Replace-likes
				modes, use a underline cursor with
				default colors.
	   i-ci:ver30-iCursor-blinkwait300-blinkon200-blinkoff150
				In Insert and Command-line Insert mode, use a
				30% vertical bar cursor with colors from the
				"iCursor" highlight group.  Blink a bit
				faster.

	The 'a' mode is different.  It will set the given argument-list for
	all modes.  It does not reset anything to defaults.  This can be used
	to do a common setting for all modes.  For example, to switch off
	blinking: "a:blinkon0"

	Examples of cursor highlighting:
	    :highlight Cursor gui=reverse guifg=NONE guibg=NONE
	    :highlight Cursor gui=NONE guifg=bg guibg=fg
editor/vim/neovim/config/change_cursor_shape_for_each_mode.txt · 最終更新: 2020-07-07 11:22 by ore