-
Notifications
You must be signed in to change notification settings - Fork 391
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
vimtex + nvim-cmp crash when typing *some* commands #2653
Comments
Interesting. On my end, this does not lead to a crash, but I do get the error. I use this slightly different set runtimepath^=~/.local/plugged/vimtex
set runtimepath^=~/.local/plugged/cmp-omni/
set runtimepath^=~/.local/plugged/nvim-cmp/
filetype plugin on
lua << EOF
cmp = require("cmp")
cmp.setup {
sources = cmp.config.sources {
{ name = "omni", },
},
}
EOF Steps required on my side:
I'm on neovim version v0.9.0-dev-1059+g2c9fbe34b2. The error message is unknown to me, and I believe this may be an error with cmp-omni. Perhaps @hrsh7th would be friendly enough to join the discussion and help us figure it out? By the way: please note that, IMHO, VimTeX syntax is better than Treesitter for LaTeX. Perhaps you disable VimTeX syntax because you've tried both and prefer Treesitter, but I do observe that a lot of people simply assume that Treesitter is better. Treesitter is awesome, but for some languages, like LaTeX, it is still a lot of work to make it as good as e.g. VimTeXs syntax scripts. -- Also, VimTeX has a few features that depend on the VimTeX syntax scripts. |
You should use |
Yes, you are right - that seems to fix the issue. Thanks! |
The reproducible config is very helpful. Thanks! |
No problem. I'm slightly annoyed that I didn't immediately recognize the missing "local" there... :p |
Thanks for your quick replies. Line 4321 in 640ffa4
With your minimal.vim (only changed the paths), no crashes but completion does not work at all: set runtimepath^=~/.config/nvim/plugged/vimtex
set runtimepath^=~/.config/nvim/plugged/cmp-omni/
set runtimepath^=~/.config/nvim/plugged/nvim-cmp/
filetype plugin on
lua << EOF
local cmp = require("cmp")
cmp.setup {
sources = cmp.config.sources {
{ name = "omni", },
},
}
EOF Completion works when I use plugged -- here a more minimal config -- but it still crashes as before: call plug#begin('~/.config/nvim/plugged')
Plug 'lervag/vimtex'
Plug 'hrsh7th/cmp-omni'
Plug 'hrsh7th/nvim-cmp'
call plug#end()
lua << EOF
local cmp = require("cmp")
cmp.setup {
sources = cmp.config.sources {
{ name = "omni", },
},
}
EOF My config folder is completely empty except for The vimtex config was copied from another issue, in real life I'm already using vimtex syntax highlights instead of treesitter :) |
Ah, sorry: here's an updated minimal example: set runtimepath^=~/.config/nvim/plugged/vimtex
set runtimepath^=~/.config/nvim/plugged/nvim-cmp
set runtimepath^=~/.config/nvim/plugged/cmp-omni
set runtimepath+=~/.config/nvim/plugged/cmp-omni/after
filetype plugin on
lua << EOF
local cmp = require("cmp")
cmp.setup {
sources = cmp.config.sources {
{ name = "omni", },
},
}
EOF
silent edit test.tex If you start |
And thanks for pointing out the error in the docs! |
Great, your last example works. I'll try to "rebuild" from there, without vim-plug. Thanks for the instant support and all your work here! |
Notice that the Also, glad to help! Let me know if you need more help. |
I'd like to share some intermediate results: I tried adding packer.nvim to the MWE: vim.cmd [[packadd packer.nvim]]
require('packer').startup(function(use)
use 'wbthomason/packer'
use 'hrsh7th/cmp-omni'
use 'hrsh7th/nvim-cmp'
use 'lervag/vimtex'
end)
local cmp = require("cmp")
cmp.setup {
sources = cmp.config.sources {
{ name = "omni", },
},
} Steps:
However: So far I've been using BTW, I haven't seen any crashes with anything other than latex. Any ideas how to proceed? Thank you! |
Do I understand correctly that the minimal example where we just manually set the
I assume that the second step is to add a new
When things crash, do you see any error messages? The error message from earlier, is that always gone now? Are you observing a difference between running with |
Sorry, it was too late probably, I can't replicate this anymore. Probably config confusion, just as you said. But I could narrow down the issue to a conflict with my colorscheme (https://github.com/RRethy/nvim-base16): Using uxrvt, the exact steps are:
This leads to a crash of urxvt (Seg fault) with the following vim.cmd [[packadd packer.nvim]]
require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'hrsh7th/cmp-omni'
use 'hrsh7th/nvim-cmp'
use 'lervag/vimtex'
use 'RRethy/nvim-base16'
end)
-- adapted from vimtex docs:
local cmp = require("cmp")
cmp.setup.filetype('tex', {
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
omni = (vim.inspect(vim_item.menu):gsub('%"', "")),
buffer = "[Buffer]",
-- formatting for other sources
})[entry.source.name]
return vim_item
end,
},
sources = {
{ name = 'omni' },
{ name = 'buffer' },
-- other sources
},
}) The crash after selecting a
So there seems to be some conflict between this specific formatting and https://github.com/RRethy/nvim-base16 And no, the error message does not show, it was just an unrelated error in the first MWE. |
Cool. Thanks for the update. I believe the issue has to do with either 1) colors, or 2) unicode glyphs. But it is hard to say. I believe you are on Arch Linux; if so, which |
Yes exactly, |
I tried to follow your steps, but on my end, there is no crash. Things work as expected. Not sure what the problem is. Perhaps it is the |
Yes, thank you for your help. I've tried with an empty |
My pleasure.
Yes, please do. I use the same package, so it is strange that I'm not able to properly reproduce this. We should have close to identical systems, it seems - except I'm om neovim nightly from AUR. You could try updating neovim? |
@dajuno: Hi, I'm the creator of As @lervag had written, it is most likely that you have a problem in your config files. I don't know, but could it be that there are hidden control characters in them? Another possibility that i could imagine would be your locale. What have you defined in your |
Hi @mrdotx, thanks for chiming in! strange... My $ xrdb -q
URxvt.font: xft:Liberation Mono:size=8:style=Regular nothing weird. |
There was a time when there were significant problems with I have a file with a large amount of unicode characters in my repos (unicode-symbols). Please check if you can open the file with vim and/or another editor. |
Ok I found the issue. Most of the unicode symbols were not displayed properly and I realized that I didn't have the Symbola font installed. With PS: I'm using |
Great that you found a solution for your Problem (I still can't reproduce it), but this can only be a correlation. It is not a requirement to install an emoji font like I think a more plausible explanation is that your font-cache was some kind of corrupted and after you installed a font related package the font-cache was recreated. However, I can't say that for sure... Just in case there is someone who has similar problems. Try first to recreate the font-cache: sudo fc-cache -vf Thanks to all! |
Strange. Just to check I removed |
@mrdotx Thanks to you too! I'm a very happy user of @dajuno You could inspect the core dump. E.g. with |
I posted the stack trace here which attracted @mrdotx apparently :)
When I run |
I can relate to that curiosity; but "everything seems to be working" is also generally good :) |
Description
Hi all,
the good: latex completion using nvim-cmp seems to be working generally. But when I type some commands, nvim and it's containing terminal crash.
For example, in the below MWE, typing
\be
(e.g., for\begin
or\beta
) will show completion for commands starting withbe
, then crash, making vimtex+nvim-cmp impossible to use together. Other latex commands are fine.The crash always happens when typing
\be
after\begin{document}
, but only about 50% of the time when typed in the preamble. Super weird.Not sure if related, but with the setup below entering insert mode (by hitting i, a, o, etc) gives this error message:
This does not happen with my full config, where the crashes happen, too (and for more commands! e.g.
\au
,\da
, ...)Steps to reproduce
nvim -u minimal.vim minimal.tex
\be
minimal.tex
minimal.vim
Expected behavior
Should not crash.
Actual behavior
error message whenever entering nvim's insert mode:
nvim + terminal crash
Do you use a latexmkrc file?
No
VimtexInfo
The text was updated successfully, but these errors were encountered: