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

LaTeX snippet misfires when it spans multiple lines wrapped by textwidth setting #1510

Open
TryerGit opened this issue Dec 25, 2022 · 0 comments

Comments

@TryerGit
Copy link

TryerGit commented Dec 25, 2022

Given snippet:

snippet mm "Inline Math" wA
\\( $1 \\) $0
endsnippet

which inserts inline math mode in LaTeX: \( | \) where cursor position is |

and following .vimrc:

"-------------Load Plugins------------------
if empty(glob('~/.vim/autoload/plug.vim'))
    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'lifepillar/vim-mucomplete'
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'lervag/vimtex'
call plug#end()
"---------------End Plugins added-----------------------
"----------- UltiSnips triggering-------------
let g:UltiSnipsExpandTrigger = '<C-a>'
let g:UltiSnipsJumpForwardTrigger = '<C-a>'
let g:UltiSnipsJumpBackwardTrigger = '<C-d>'
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips']
"-----------End ultisnips--------------------
"---------Begin MuComplete Setup-----------
  set completeopt+=menuone
  set completeopt+=noselect
  set belloff+=ctrlg
  let g:mucomplete#enable_auto_at_startup = 1
"---------End MuComplete Setup-------------
set textwidth=79
set colorcolumn=79

type mm close to column number 79/78 so that the snippet expansion breaks across two lines.

Expected behavior:

If broken into two lines, the snippet should expand like so:

\(<col 79>
|\)

Actual behavior:

instead it expands like so

\(<col 79>
\|)

where the cursor position after snippet expansion is between the closing \ and )

I checked with the VimTeX repo and it seems to not be an issue with that plugin. The author/maintainer there indicates that it could possibly be an issue with UltiSnips. See here

Steps to reproduce

  1. Please see above. An explanatory animated gif is below:

issue


  • Operating System: Windows 10, WSL
  • Vim Version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Apr 15 2020 06:40:31)
    Included patches: 1-2269
  • UltiSnips Version: 53e1921
  • Python inside Vim: 3.8.10 (default, Jun 2 2021, 10:49:15)
    [GCC 9.4.0]
  • Docker repo/vimrc: minimal .vimrc pasted inline above
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