1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
--- Personal lua config files for NeoVim.
-- Last Changed: 2019-01-27
-- Author: Federico Igne <git@federicoigne.com>
-- License: This file is placed in the public domain.
local map = require 'dyamon.util.map'
local cp = require 'dyamon.util.checkpoint'
--- A mapping to jump to the next checkpoint (<++>)
-- Using `v%` instead of searching for `<+[^>]*+>` adds support for
-- nested markers (needs `set matchpairs+=<:>`).
-- NOTE: not possible to use inoremap because the `%` feature we are
-- using is provided by the plugin `matchit.vim` which gets overridden if
-- using `nore-`.
map.i(';;', '<esc>/<+<cr>:noh<cr>v%', { silent = true })
-- In visual mode remove the marker enclosure leaving the content
-- unaltered. Useful to add optional keywords:
-- \item<+[<++>]+>
-- Alternatively, remove the selection with `c` or `d`
map.v(';;', 'v%vlvh%Xxgvc', { silent = true })
-- Smart parens
for _, p in ipairs({{'(',')'}, {'[',']'}, {'{','}'}, {'<','>'}, {'"','"'}, {'\'','\''}, {'`','`'}}) do
cp.surround(p[1]..p[2], p[2])
end
|