An open API service indexing awesome lists of open source software.

https://github.com/leafoftree/vim-blink

Blink to anywhere in INSERT or NORMAL mode
https://github.com/leafoftree/vim-blink

blink edit plugin point vim

Last synced: 7 months ago
JSON representation

Blink to anywhere in INSERT or NORMAL mode

Awesome Lists containing this project

README

          

# vim-blink


screencast

Blink to anywhere in INSERT or NORMAL mode

## Installation

How to install

- [VundleVim][1]

Plugin 'leafOfTree/vim-blink'

- [vim-pathogen][2]

cd ~/.vim/bundle
git clone https://github.com/leafOfTree/vim-blink --depth 1

- [vim-plug][3]

Plug 'leafOfTree/vim-blink'
:PlugInstall

- Or manually, clone this plugin to `path/to/this_plugin`, and add it to `rtp` in vimrc

set rtp+=path/to/this_plugin


Please stay up to date. Feel free to open an issue or a pull request

## Usage

Add config

```vim
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:

```vim
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:

```vim
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: ``
- Example:

```vim
let g:blink_mapping_prev = ''
```

#### `g:blink_mapping_next`

Mapping to blink to next point

- Default: ``
- Example:

```vim
let g:blink_mapping_next = ''
```

### Mode

#### `g:blink_disable_insert`

Disable blink in INSERT mode

- Default: `0`
- Example:

```vim
let g:blink_disable_insert = 1
```

#### `g:blink_disable_normal`

Disable blink in NORMAL mode

- Default: `0`
- Example:

```vim
let g:blink_disable_normal = 1
```

### Function

The function used by the mappings is `blink#BlinkToEditPoint(flags, normal)`

```vim
inoremap =blink#BlinkToEditPoint("wb", 0)
inoremap =blink#BlinkToEditPoint("w", 0)

nnoremap :call blink#BlinkToEditPoint("wb", 1)
nnoremap :call blink#BlinkToEditPoint("w", 1)
```

[1]: https://github.com/VundleVim/Vundle.vim
[2]: https://github.com/tpope/vim-pathogen
[3]: https://github.com/junegunn/vim-plug