简体   繁体   中英

how to get matchit to work with % with key mapping on vim?

i'm trying to get vim to select between matching html tags including the parent tags.. Following are two mappings i tried..

nnoremap <leader>h <s-v><s-5>

or

nnoremap <leader>h <s-v>%

but nothing seems to work. the problem is '%' doesn't perform the extended(with the matchit plugin) action which is selecting the matching closing html tag..

You can use :normal! and :execute to run normal commands without remapping. eg

nmap <leader>h :execute "normal! V"<cr>%

This command is really similar to using the "a tag block", at , text-object. eg vat . Of course you can do what you are doing and just execute V% as it is the same number of characters as <leader>h .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM