--- Personal lua config files for NeoVim. -- Last Changed: 2019-01-27 -- Author: Federico Igne -- 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(';;', '/<+:nohv%', { 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