Skip to content

eqref behaviour (referencing completion) on custom command #3055

Open
@Felipe-9

Description

@Felipe-9

Description

recently i created a custom command for referencing \usingref{} and i would like for it to behave just like eqref, what changes i can make to autocomplete references just like the original command?

i searched on the original code and found out this file under /vimtex/autoload/vimtex/complete.vim

function! s:completer_ref.complete(regex) dict abort " {{{2
  let l:candidates = self.get_matches(a:regex)

  if self.context =~# '\\eqref'
        \ && !empty(filter(copy(l:candidates), 'v:val.word =~# ''^eq:'''))
    call filter(l:candidates, 'v:val.word =~# ''^eq:''')
  endif

  return l:candidates
endfunction

also in /vimtex/autoload/vimtex/syntax.vim

  syntax match texCmdRefEq nextgroup=texRefEqConcealedArg
        \ conceal skipwhite skipnl "\\eqref\>"
  call vimtex#syntax#core#new_arg('texRefEqConcealedArg', {
        \ 'contains': 'texComment,@NoSpell,texRefEqConcealedDelim',
        \ 'opts': 'keepend contained',
        \ 'matchgroup': '',
        \})
  syntax match texRefEqConcealedDelim contained "{" conceal cchar=(
  syntax match texRefEqConcealedDelim contained "}" conceal cchar=)

Should i copy those substituting \eqref by \usingref? where do i paste it?

i dont want to conceal the command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions