## versions
vim version: NVIM v0.5.0-327-g97dcc48c9
node version: v13.6.0
coc.nvim version: 0.0.74-5445f64a56
term: rxvt-unicode-256color
platform: linux
## Messages
## Output channel: snippets
## Output channel: git
Looking for git in: git
> git rev-parse --show-toplevel
fatal: not a git repository (or any of the parent directories): .git
Error 128 on: 'git rev-parse --show-toplevel' in /home/gideon/.config/nvim/configs
fatal: not a git repository (or any of the parent directories): .git
## Output channel: prettier
## Output channel: highlight
[Info - 11:19:03 AM] Highlight server running in node v13.6.0
When I write my file coc.nvim places incorrect symbols in the file.
If I have LaTeX code in between $$ ... $$ in a markdown document, it renders as latex with markdown preview.
However when I save the file, coc.nvim appends $$, making the file look like $$ ... $$ $$, which ruins the render.
Also if I have it arranged like so
$$
...
$$
it will automatically delete the blank lines, turning it into
$$
...
$$
Please look at the issue I opened here when I thought the behavior was the fault of markdown-preview.
I have a standard coc.nvim configuration.
I know it is coc because the command :au BufWritePre returns
--- Autocommands ---
coc_nvim BufWritePre
* call s:SyncAutocmd('BufWritePre', +expand('<abuf>'))
We will close your issue when you don't provide minimal vimrc and we can't
reproduce it
Create file mini.vim with:
set nocompatible
set runtimepath^=/path/to/coc.nvim
filetype plugin indent on
syntax on
set hidden
Start (neo)vim with command: vim -u mini.vim
Operate vim.
I write Latex with coc-texlab and vimtex and never hit this issue. You also simply ignored providing a testcase of your problem. No one can reproduce it if you don't post the minimal code that causes it.
Ok, I said that I have a standard config. This is all of the code required to replicate the issue on my end.
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
Here is the markdown I was working with.
$$
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &
= \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{array}$$
$$
You can see the first $$ is directly after array (as per the example I am referencing), but when I write the file the second $$ is added and the perfectly rendered latex is broken.
I can't reproduce the issue. I've put your latex snippet (without the ending $$ duplicate) in a latex file, opened it with neovim, which loaded coc.nvim+coc-texlab for it, no issues writing it, it's unchanged.
A never mind, you're putting it on Markdown... let me check. Before that, just a note on:
and the perfectly rendered latex is broken
Not sure how it's perfect given there's a \end{array} without a \begin{array}.
Unable to reproduce in Markdown either.
Due to luck, not proper test case, I was able to reproduce this behavior by formatting (<Plug>(coc-format)) the markdown with coc-prettier installed. I suspect you should have it installed, and you're configuring coc.nvim to automatically format files on save, which isn't enabled by default.
Please uninstall coc-prettier and check if the issue is gone, if so close this issue and open a new one on coc-prettier repository, with proper minimum test case.
Scratch that. It's not even a coc-prettier issue, it's a _prettier_ issue.
Report it on prettier repository: https://github.com/prettier/prettier.