Closed Felipe-9 closed 1 week ago
Strange - I can't reproduce this in a minimal example. On my end, it looks like this:
Without conceal:
Concealed:
I use the following test.vim
and test.tex
files and run nvim --clean -u test.vim
.
set nocompatible
set runtimepath^=~/.local/plugged/vimtex
set runtimepath+=~/.local/plugged/vimtex/after
filetype plugin indent on
syntax enable
nnoremap q :qall!<cr>
let g:vimtex_view_method = "zathura"
let g:vimtex_cache_root = "."
let g:vimtex_cache_persistent = v:false
set conceallevel=2
silent edit test.tex
\begin{flalign*}
= \left(
\dots
+ c_1\,(
e^{-x^2}
\,(-2\,x)
)
\right) other chars that disappear
\end{flalign*}
could you try indenting everything inside flalign*
? removing the indentation also displays the correct syntax conceal
Also, i noticed that when formatting the text, everything inside c_1\,(...)
stays on the same indentation, instead of increasing one indentation, is that a bug?
could you try indenting everything inside
flalign*
? removing the indentation also displays the correct syntax conceal
It still looks "correct" to me (except that the last line is deindented, but that is another issue).
Also, i noticed that when formatting the text, everything inside
c_1\,(...)
stays on the same indentation, instead of increasing one indentation, is that a bug?
I assume that you by formatting mean the gq
operation and that you have let g:vimtex_format_enabled = 1
. On my end, it works as expected. If I start with your example but remove all indents, then do gggqG
, then things will look like the screeshot above. Although, it should be noted that I added the following to the minimal vimrc:
set shiftwidth=2
set expandtab
Again, it would really be good if you could use the minimal examples while reporting. It makes it much easier to work on these things when we know we are on the "same page".
the last line not being indented should be an error shouldnt it? also its that line that have the problem when its indented:
I also noticed that its being formatted with tabs instead of spaces, even tho my config i had made sure to indent with spaces, is this a bug?
if i do that command (gggqG
) the result is quite weird:
\begin{flalign*} & = \left( \dots + c_1\,\left( e^{-x^2} \,(-2\,x) \right)
other chars that disappear \right) other chars that disappear & \end{flalign*}
normally i also use this other command vim.lsp.buf.format
to format the whole buffer, i bound that into a shortcut <leader>mf
Ok, now there are many things at once here, which makes it very hard for me to answer. I only have a few minutes every once in a while, which is why I much prefer to have many parallell self-contained threads instead of one thread with a lot of topics at once.
It is good that you provide your relevant config, but it is not what I mean by providing a minimal example. Based on your post, it seems the following might be a relevant minimal config:
-- Make sure the folling paths are correct
vim.opt.runtimepath:prepend "~/.local/plugged/vimtex"
vim.opt.runtimepath:append "~/.local/plugged/vimtex/after"
vim.cmd [[filetype plugin indent on]]
local opt = vim.opt
opt.updatetime = 200
opt.wrap = false
opt.relativenumber = true -- Relative number
opt.number = true -- Relative number with cursor being absolute number
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
opt.softtabstop = 2 --
opt.shiftwidth = 2 -- 2 spaces for indent width
opt.expandtab = true -- expand tab to spaces
opt.autoindent = true -- copy indent from current line when starting new one
opt.ignorecase = true -- ignore case when searching
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
opt.splitbelow = true -- set new split windows below
opt.splitright = true -- set new split windows right
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position
opt.cursorline = true -- Highlight cursor line
opt.termguicolors = true
opt.background = "dark" -- colorschemes that can be light or dark theme
opt.signcolumn = "yes" -- show sign column so taht text doesnt shift
opt.clipboard:append("unnamedplus") -- use system clipboard as default register
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, { border = "rounded" }
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, { border = "rounded" }
)
vim.diagnostic.config{ float={border= 'rounded'} }
vim.keymap.set("n", "q", "<cmd>qall!<cr>")
vim.g.vimtex_cache_root = "."
vim.g.vimtex_cache_persistent = false
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_compiler_latexmk_engines = { ["_"] = "-lualatex" }
vim.g.vimtex_compiler_latexmk = {
aux_dir = ".build",
options = {
"-shell-escape",
"-verbose",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
},
}
vim.g.vimtex_quickfix_mode = 1
vim.g.vimtex_mappings_enable = 0
vim.g.vimtex_log_ignore = {
"Underfull",
"Overfull",
"specifier changed to",
"Token not allowed in PDF string",
}
vim.wo.conceallevel = 2
vim.g.vimtex_syntax_conceal = {
accents = 1,
ligatures = 1,
cites = 1,
fancy = 1,
spacing = 0,
greek = 1,
math_bounds = 1,
math_delimiters = 1,
math_fracs = 1,
math_super_sub = 0,
math_symbols = 1,
sections = 0,
styles = 1,
}
vim.cmd.edit "test.tex"
Save the above to a file test.lua
, then run nvim --clean -u test.lua
to load the config and open the test.tex
file.
I also noticed that its being formatted with tabs instead of spaces, even tho my config i had made sure to indent with spaces, is this a bug?
No, it is not a bug. This is bad config on your part, but it's hard for me to say exactly what is happening. I can help debug it, but let's take one thing at a time here.
if i do that command (
gggqG
) the result is quite weird:
For this to work, you need vim.g.vimtex_format_enabled = 1
in your config. But if you only wanted to format by indents, then gg=G
is probably enough.
Ok, now there are many things at once here, which makes it very hard for me to answer. I only have a few minutes every once in a while, which is why I much prefer to have many parallell self-contained threads instead of one thread with a lot of topics at once.
Sorry for not creating a new issue for these, i will try to be more careful in the future
For this to work, you need vim.g.vimtex_format_enabled = 1 in your config. But if you only wanted to format by indents, then gg=G is probably enough.
No, it is not a bug. This is bad config on your part, but it's hard for me to say exactly what is happening. I can help debug it, but let's take one thing at a time here.
Im still having some trouble with this, will open an issue to focus better
It is good that you provide your relevant config, but it is not what I mean by providing a minimal example. Based on your post, it seems the following might be a relevant minimal config:
i tried using this code but this is all i get:
@Felipe-9
$ nvim --clean -u test.lua
[...]
Remember to change the first two lines according to your configuration. Looks like vimtex wasn't loaded at all.
(Assume you already did, as you can see the problem is not reproducible with a minimal configuration --- so the issue is the interference with some other plugins you have, and nobody knows what they are. Try uninstalling them one by one)
I tried leaving only vimtex
plugin, this is the config
opening test.tex
we can see the concealed chars but the indentation is all broken which is an error on its own
i tried then toggling on and off my plugins one by one and found out that this plugin
{ import = "plugins.indent-blankline" }, -- Indenting help linesg
was causing the problem, probably, since the indentation is removed, those lines are overitting the characters, which means that if we fix the indentation, the problem will be resolved
Concealing the blank space before the \right
is more of a bug than a feature, so that $\left( 123 \right)$
will get concealed to (123)
without any space before the )
.
On the other hand concealing the blank space for the indentation doesn't seem that desirable. Maybe the regex can be modified a bit…? (is lookbehind allowed? I haven't taken a look)
how is the current regex configured? i could take a look
Sorry for not creating a new issue for these, i will try to be more careful in the future
Thanks, and no problem. I hope you don't mind the feedback on such things and that I don't come off too rude!
i tried using this code but this is all i get: …
I think user202729 is correct that you did not update the paths to VimTeX in the first lines.
Do you know the paths to VimTeX on your system? Do you need help finding them?
I tried leaving only
vimtex
plugin, this is the config …i tried then toggling on and off my plugins one by one and found out that this plugin
Ok; simplifying your own config to the point where your problems resolve themselves is also a good way to find the cause of the problems.
{ import = "plugins.indent-blankline" }, -- Indenting help linesg
I don't use that plugin myself.
was causing the problem, probably, since the indentation is removed, those lines are overitting the characters, which means that if we fix the indentation, the problem will be resolved
I don't quite understand this part. On my end, the indentation is good.
Concealing the blank space before the
\right
is more of a bug than a feature, so that$\left( 123 \right)$
will get concealed to(123)
without any space before the)
.
Yes; I think you are right. I've included the preceding white space for right delimiters and the whitespace after for the left delimiters in the conceals. I think that was a mistake.
So, I propose we change that now. I'll drop the concealing of the white spaces for delimiters. And that might also ultimately fix the conflict with the indent-lines plugin as well
how is the current regex configured? i could take a look
I… don't know where is it in the source code at the moment. You can find it yourself.
@lervag
I've included the preceding white space for right delimiters and the whitespace after for the left delimiters in the conceals. I think that was a mistake.
Is it? It feels so intentional for me.
For example $\left\langle a\right\rangle$
gets concealed to $⟨a⟩$
which makes perfect sense. (You can't remove the space after the langle. In this specific case you can also replace it with \left<a\right>
, but you get the point.)
Thanks, and no problem. I hope you don't mind the feedback on such things and that I don't come off too rude!
I would never, if anything im glad you express well how we can interact better and be efficient in resolving these issues!
Do you know the paths to VimTeX on your system? Do you need help finding them?
I don't quite understand this part. On my end, the indentation is good.
Yes; I think you are right. I've included the preceding white space for right delimiters and the whitespace after for the left delimiters in the conceals. I think that was a mistake.
For example $\left\langle a\right\rangle$ gets concealed to $⟨a⟩$ which makes perfect sense. (You can't remove the space after the langle. In this specific case you can also replace it with \left<a\right>, but you get the point.)
in this case a regex like this \\left[{(<]\ *
would allow for that, although i normally leave space intentionally and that wouldnt be much desirable for me
I've included the preceding white space for right delimiters and the whitespace after for the left delimiters in the conceals. I think that was a mistake.
Is it? It feels so intentional for me.
Yes, it was intentional. And more or less for the specific reason to handle the example you provide:
For example
$\left\langle a\right\rangle$
gets concealed to$⟨a⟩$
which makes perfect sense.
When I say mistake, I mean that the solution became too general.
But I think we might want to still conceal a single whitespace after the opening delimiter. But not more than one.
I've pushed an update now that I think is more in line with the current discussion. Can you please check if you agree with the updated behaviour?
Thanks, and no problem. I hope you don't mind the feedback on such things and that I don't come off too rude!
I would never, if anything im glad you express well how we can interact better and be efficient in resolving these issues!
Great, glad to hear it.
Do you know the paths to VimTeX on your system? Do you need help finding them?
ah for some reason i only understood what those lines meant later, yeah i do know the path, on my computer its
~/.local/share/nvim/lazy/vimtex
, after fixing that i get: …
Great; I believe my latest update should fix that.
I don't quite understand this part. On my end, the indentation is good.
since vimtex is acting before insert-blankspace plugin, which means that first, vimtex writes those lines: …
and then insert-blankspace overwrites based on indentation …
Ah, I see. Then I believe my latest update should fix this.
Yes perfectly, thank you!
Great, glad to hear it's working better now!
related to #3010
Description
this code:
is being concealed into
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
no
VimtexInfo