targets.vim icon indicating copy to clipboard operation
targets.vim copied to clipboard

FT-specific adjustments: Dollar $ for LaTeX inline equations as quote not separator

Open kiryph opened this issue 5 years ago • 1 comments

I want to change the mapping of $ for LaTeX files .tex:

I have added to my $VIMRC following:

let g:tex_flavor='latex'
augroup mytargets
    autocmd!
    autocmd User targets#mappings#user call targets#mappings#extend({
        \ '$':{'quote': [{'d': '\$'}]},
        \ })
augroup END

However, this applies to all files. What do I have to do that this change only applies to tex files?

kiryph avatar Mar 23 '20 09:03 kiryph

You could simply prefix your autocmd command with another autocmd command. Although, I think that wouldn't work correctly with the augroup upon reloading. This should work:

autocmd Event * if &ft =~ 'tex' | <your-command> | endif

MasterMedo avatar May 02 '20 06:05 MasterMedo