Skip to content

How to use the matchup_convenience_maps function from lua? #212

Answered by AckslD
AckslD asked this question in Q&A
Discussion options

You must be logged in to vote

Nvm, putting it in a function works :)

  vim.api.nvim_exec([[
    function! s:matchup_convenience_maps()
      xnoremap <sid>(std-I) I
      xnoremap <sid>(std-A) A
      xmap <expr> I mode()=='<c-v>'?'<sid>(std-I)':(v:count?'':'1').'i'
      xmap <expr> A mode()=='<c-v>'?'<sid>(std-A)':(v:count?'':'1').'a'
      for l:v in ['', 'v', 'V', '<c-v>']
        execute 'omap <expr>' l:v.'I%' "(v:count?'':'1').'".l:v."i%'"
        execute 'omap <expr>' l:v.'A%' "(v:count?'':'1').'".l:v."a%'"
      endfor
    endfunction
    call s:matchup_convenience_maps()
  ]], false)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by AckslD
Comment options

You must be logged in to vote
1 reply
@AckslD
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants