From 8efc86279fd05ccea5ef32797f031cefe4c87891 Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 13 May 2022 21:04:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B0=D0=B3=D1=84=D0=B8=D0=BA=D1=81=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BD=D0=B5=20=D0=B2=20=D1=81=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftplugin/markdown.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index d8d312b..820e485 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -1,13 +1,13 @@ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " File: ftplugin/markdown.vim " Maintainer: Andrew Nechaev -" Version: 0.0.1 -" Modified: 2022-05-13 18:30+0400 +" Version: 0.1.0 +" Modified: 2022-05-13 21:00+0400 " License: MIT """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -nnoremap t :call winrestview(toggle('^\s*[-+*]\s*[\[(]\zs.\ze[\])]', {' ': 'x', 'x': '-', '-': ' '})) -vnoremap t :call winrestview(toggle('^\s*[-+*]\s*[\[(]\zs.\ze[\])]', {' ': 'x', 'x': '-', '-': ' '})) +nnoremap t :call winrestview(toggle({' ': 'x', 'x': '-', '-': ' '})) +vnoremap t :call winrestview(toggle({' ': 'x', 'x': '-', '-': ' '})) nnoremap r :call winrestview(toggleState('(', '( ) ')) vnoremap r :call winrestview(toggleState('(', '( ) ')) @@ -16,9 +16,9 @@ vnoremap c :call winrestview(toggleState('[', '[ set tabstop=2 softtabstop=2 shiftwidth=2 expandtab -function s:toggle(pattern, dict, ...) +function s:toggle(dict) let view = winsaveview() - execute 'keeppatterns s/' . a:pattern . '/\=get(a:dict, submatch(0), a:0 ? a:1 : " ")/e' + execute 'keeppatterns s/^\s*\(-\s*\|+\s*\|*\s\)\?\s*[\[(]\zs.\ze[\])]/\=get(a:dict, submatch(0), a:0 ? a:1 : " ")/e' return view endfunction