mirror of
https://github.com/mhinz/vim-galore.git
synced 2025-02-23 17:49:28 +08:00
Tips: use cursor style in insert mode
This commit is contained in:
parent
6c9ff79254
commit
28d76fae23
@ -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
|
||||
|
25
README.md
25
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 = "\<Esc>]50;CursorShape=1\x7"
|
||||
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
|
||||
else
|
||||
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
|
||||
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user