/dps-kakkonan

Brackets completion plugin, using the denops.vim.

Primary LanguageTypeScriptMIT LicenseMIT

dps-kakkonan

Brackets completion plugin, using the denops.vim.
This plugin respect for cohama/lexima.vim and machakann/vim-sandwich.

Install

Please install deno.
After, install plugins as follows.

dein.vim

call dein#add('vim-denops/denops.vim')
call dein#add('higashi000/dps-kakkonan')

Usage

Completion Brackets

Please input some brackets in insert mode.
Image from Gyazo

Surround text to brackets

Select text in visual mode.
After, please execute keybind that you set up.
example

" dps-kakkonan surround text to backets example keymap
vmap sr( <Plug>(dps_kakkonan_surround_parenthesis)
vmap sr{ <Plug>(dps_kakkonan_surround_curly)
vmap sr[ <Plug>(dps_kakkonan_surround_square)
vmap sr" <Plug>(dps_kakkonan_surround_doublequote)
vmap sr' <Plug>(dps_kakkonan_surround_singlequote)
vmap sr` <Plug>(dps_kakkonan_surround_backquote)

demo
Image from Gyazo

Delete brackets

Please execute :KakkonanDelete on top of brackets, or settings keybind.

map <Leader>dk <Plug>(dps_kakkonan_delete_brackets)

Image from Gyazo

Replace brackets

Please set your keymap.
example

" dps-kakkonan replace brackets example keymap
map rp( <Plug>(dps_kakkonan_replace_parenthesis)
map rp{ <Plug>(dps_kakkonan_replace_curly)
map rp[ <Plug>(dps_kakkonan_replace_square)
map rp" <Plug>(dps_kakkonan_replace_doublequote)
map rp' <Plug>(dps_kakkonan_replace_singlequote)
map rp` <Plug>(dps_kakkonan_replace_backquote)

demo
Image from Gyazo

Custom Surround Brackets

If you want to surround it with something you like, you can use it.
This function is not supported delete and replace.

example settings

let g:kakkonan_custom_brackets = {
            \ "h1": {
                \ "start": "<h1>",
                \ "finish": "</h1>"
            \ },
            \ "script": {
                \ "start": "<script>",
                \ "finish": "</script>"
            \ },
            \ "<": {
                \ "start": "<",
                \ "finish": ">"
            \ },
            \ }

demo
Image from Gyazo