diff --git a/CHANGELOG.md b/CHANGELOG.md index 5291dfe..5521485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. - Tips: [Quickly edit your macros](README.md#quickly-edit-your-macros) - Tips: [Quickly jump to header or source file](README.md#quickly-jump-to-header-or-source-file) - Tips: [Quickly change font size in GUI](README.md#quickly-change-font-size-in-gui) +- Tips: [Change cursor style in insert mode](README.md#change-cursor-style-in-insert-mode) - Tips: [Don't lose selection when shifting sidewards](README.md#dont-lose-selection-when-shifting-sidewards) ## [1.0] - 2016-01-06 diff --git a/README.md b/README.md index a8b9ce9..e575c4d 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ - [Quickly edit your macros](#quickly-edit-your-macros) - [Quickly jump to header or source file](#quickly-jump-to-header-or-source-file) - [Quickly change font size in GUI](#quickly-change-font-size-in-gui) +- [Change cursor style in insert mode](#change-cursor-style-in-insert-mode) - [Don't lose selection when shifting sidewards](#dont-lose-selection-when-shifting-sidewards) #### [Debugging](#debugging-1) @@ -418,6 +419,30 @@ command! Bigger :let &guifont = substitute(&guifont, '\d\+$', '\=submatch(0)+1' command! Smaller :let &guifont = substitute(&guifont, '\d\+$', '\=submatch(0)-1', '') ``` +#### Change cursor style in insert mode + +I like to use a block cursor in normal mode and i-beam cursor in insert mode. +Also when using tmux in the middle. +```viml +if empty($TMUX) + let &t_SI = "\]50;CursorShape=1\x7" + let &t_EI = "\]50;CursorShape=0\x7" +else + let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" + let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" +endif +``` +This simply tells Vim to print a certain sequence of characters ([escape +sequence](https://en.wikipedia.org/wiki/Escape_sequence)) when entering/leaving +insert mode. The underlying terminal will process and evaluate it. + +There's one drawback though: there are many terminal emulator implementations +and not all use the same sequences for doing the same things. The sequences used +above might not work with your implementation. Your implementation might not +even support different cursor styles. Check the documentation. + +The example above works with iTerm2. + #### Don't lose selection when shifting sidewards If you select one or more lines, you can use `<` and `>` for shifting them