Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define [[, ]], [], ][, [", ]" also for visual modes #13

Open
kiryph opened this issue Nov 15, 2018 · 0 comments
Open

Define [[, ]], [], ][, [", ]" also for visual modes #13

kiryph opened this issue Nov 15, 2018 · 0 comments

Comments

@kiryph
Copy link

kiryph commented Nov 15, 2018

In an xml file :map [[ will tell you that [[ is remapped by this plugin to

n [[ *@m':call <SNR>148_findOpenTag('bW')<CR>

I would like to adjust my visual selection with the motions defined by this plugin.

However, a :xmap [[ will say No Mapping Found.

I tried a naive approache to add them

~/.vim/pack/minpac/start/xml.vim master*
❯ g diff
diff --git a/ftplugin/xml.vim b/ftplugin/xml.vim
index fc67f1b..0990097 100644
--- a/ftplugin/xml.vim
+++ b/ftplugin/xml.vim
@@ -1479,10 +1479,16 @@ call s:unmapKeys()
   call <SID>mapKey('n', ']]', "m':call <SID>findOpenTag('W')<CR>")
   call <SID>mapKey('n', '[]', "m':call <SID>findCloseTag('bW')<CR>")
   call <SID>mapKey('n', '][', "m':call <SID>findCloseTag('W')<CR>")
+  call <SID>mapKey('x', '[[', "m':call <SID>findOpenTag('bW')<CR>")
+  call <SID>mapKey('x', ']]', "m':call <SID>findOpenTag('W')<CR>")
+  call <SID>mapKey('x', '[]', "m':call <SID>findCloseTag('bW')<CR>")
+  call <SID>mapKey('x', '][', "m':call <SID>findCloseTag('W')<CR>")

   " Move around comments                                                  {{{2
   call <SID>mapKey('n', ']"', substitute(':call search("^\(\s*<!--.*\n\)\@<!\(\s*-->\)", "W")<CR>', '"', "'", 'g'))
   call <SID>mapKey('n', '["', substitute(':call search("\%(^\s*<!--.*\n\)\%(^\s*-->\)\@!", "bW")<CR>', '"', "'", 'g'))
+  call <SID>mapKey('x', ']"', substitute(':call search("^\(\s*<!--.*\n\)\@<!\(\s*-->\)", "W")<CR>', '"', "'", 'g'))
+  call <SID>mapKey('x', '["', substitute(':call search("\%(^\s*<!--.*\n\)\%(^\s*-->\)\@!", "bW")<CR>', '"', "'", 'g'))

   " insert mode shortcuts                                                 {{{2
   call <SID>mapKey('i', b:suffix, ' ><Esc>db:call <SID>makeElement()<Cr>')

But this does not work.

Would you be interest in adding them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant