vim-blink
Blink to anywhere in INSERT or NORMAL mode
Installation
How to install
-
Plugin 'leafOfTree/vim-blink'
-
cd ~/.vim/bundle git clone https://github.com/leafOfTree/vim-blink --depth 1
-
Plug 'leafOfTree/vim-blink' :PlugInstall
-
Or manually, clone this plugin to
path/to/this_plugin
, and add it tortp
in vimrcset rtp+=path/to/this_plugin
Please stay up to date. Feel free to open an issue or a pull request
Usage
Add config
let g:blink_point = {
\'javascript': '(|), {|}, \[|\], {\n\s*|\n\s*}, >|<, ''|'', "|"'
\}
Open a javascript file and then in INSERT or NORMAL mode, press c-n or c-p
Configuration
Blink point
A pattern
to define where to go. It is a string separated by ,
. The cursor position is marked by |
g:blink_point
Filetype specific pattern
. The format is { key: filetype, value: pattern }
-
Default:
undefined
-
Example:
let g:blink_point = { \'vue': ':\s*|;, ^<|\(script\|style\|template\)', \'jsx': '(|), {|}, \[|\], >|<, "|", ''|'', \s|[)}]', \'text': '(|.*), [a-c]|[d-g]', \}
g:blink_point_default
Default pattern
-
Default:
'(|), {|}, \[|\], {\n\s*|\n\s*}, >|<, ''|'', "|"'
-
Example:
let g:blink_point_default = '(|), {|}, \[|\], ".*|"'
For more details about vim pattern
, see :h pattern
Mapping
g:blink_mapping_prev
Mapping to blink to previous point
-
Default:
<c-p>
-
Example:
let g:blink_mapping_prev = '<c-k>'
g:blink_mapping_next
Mapping to blink to next point
-
Default:
<c-n>
-
Example:
let g:blink_mapping_next = '<c-j>'
Mode
g:blink_disable_insert
Disable blink in INSERT mode
-
Default:
0
-
Example:
let g:blink_disable_insert = 1
g:blink_disable_normal
Disable blink in NORMAL mode
-
Default:
0
-
Example:
let g:blink_disable_normal = 1
Function
The function used by the mappings is blink#BlinkToEditPoint(flags, normal)
inoremap<silent> <c-p> <c-r>=blink#BlinkToEditPoint("wb", 0)<cr>
inoremap<silent> <c-n> <c-r>=blink#BlinkToEditPoint("w", 0)<cr>
nnoremap<silent> <c-p> :call blink#BlinkToEditPoint("wb", 1)<cr>
nnoremap<silent> <c-n> :call blink#BlinkToEditPoint("w", 1)<cr>