lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.54k stars 390 forks source link

auto-complete with cmp do not work untill i do :vimtexreload #2765

Closed Aneeqasif closed 1 year ago

Aneeqasif commented 1 year ago

Description

i have tried https://github.com/benbrastmckie latex set up using lazyman and it works really fine with same latex project but when i open my own lunarvim config it do not work (i cannot get \cite{} completions) untill i do :vimtexreload, i have added the omni source to cmp.

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

no

VimtexInfo

System info:
  OS: ArcoLinux
  Vim version: NVIM v0.9.1
  Has clientserver: true
  Servername: /run/user/1000/lvim.46263.0

VimTeX project: main
  base: main.tex
  root: /home/aneeq/Documents/FYP/latex/thesis-bs
  tex: /home/aneeq/Documents/FYP/latex/thesis-bs/main.tex
  main parser: recursive search
  document class: report
  packages: amsbsy amsfonts amsgen amsmath amsopn amssymb amstext array atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook babel bigintcalc bitset blindtext caption caption3 catchfile cite color colortbl epsfig epstopdf-base etexcmds etoolbox fancyhdr float geometry gettitlestring graphics graphicx hycolor hyperref ifluatex ifplatform iftex ifvtex infwarerr inputenc intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro lmodern ltxcmds mathdots nameref pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys refcount rerunfilecheck scrbase scrlfile scrlfile-hook scrlogo setspace shellesc siunitx subcaption svg tikz translations transparent transparent-nometadata trig trimspaces uniquecounter url wrapfig xcolor xspace
  source files:
    main.tex
    TP1.tex
    blankpage.tex
    submission approval.tex
    TP2.tex
    dedications.tex
    Abstract.tex
    Chapter 1.tex
    Chapter 2.tex
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: Zathura
    xwin id: 0
  qf method: LaTeX logfile

this might be related https://github.com/LunarVim/LunarVim/issues/3723

lervag commented 1 year ago

i have tried https://github.com/benbrastmckie latex set up using lazyman

I have no idea what that is, sorry.

when i open my own lunarvim config it do not work (i cannot get \cite{} completions) untill i do :vimtexreload, i have added the omni source to cmp.

I'm confident that your problem is related to configuration of neovim and/or LunarVim. Since I don't know LunarVim, I would urge you to open an issue at the LunarVim repo.

this might be related LunarVim/LunarVim#3723

Perhaps. I would advice that you, when you open an issue in the LunarVim repo, provide much more details on your configuration. Do you have your config on a git repo on github or elsewhere?

Aneeqasif commented 1 year ago

yes i do have lvim config git repo here it is https://github.com/Aneeqasif/lvim-config

lervag commented 1 year ago

Thanks. From this, I can't immediately see anything glaringly wrong. I notice you ask lazy to be lazy be default:

https://github.com/Aneeqasif/lvim-config/blob/main/config.lua#L46C1-L46C36

I also notice you explicitly turn of lazy for VimTeX. What happens if you do not set lazy globally default?

lervag commented 1 year ago

I believe perhaps the problem is here:

https://github.com/Aneeqasif/lvim-config/blob/main/lua/plugins.lua#L441

You ask cmp-omni to only load when you go into insert mode. In my config, I ask nvim-cmp to load at the event VeryLazy and it will load all the dependencies immediately (including cmp-omni). I personally feel I have a very fast startuptime. Even on my slow computer with 80 plugins it only takes 168 ms until UIEnter (and this is a slow laptop).

Aneeqasif commented 1 year ago

i tried this but sadly it didnt worked i have to do leader-lx to reload vimtex , can i have a dirty hack to overcome this for now something like a autocmd that do this vimtexreload when i go to my latex project, mean while i investigate what can be the problem for this as i am facing another issue with vimtex that we disscussed a bit here https://github.com/lervag/vimtex/issues/2763#issuecomment-1650005305. i am currenlty on lunarvim i will first try to tweaak some things with lazy package manager and lunarvim config, if thing did worked i might shift to a minimal config for lazy.nvim or may be try some other vim distro like astro or nvchad to investigate .

Aneeqasif commented 1 year ago

I have no idea what that is, sorry.

and about lazyman its a shell program that help u to try out different config almost 100 with just simple steps and it provides some helper functions to invoke and manage different nvim configs at a same time without interfering here is a link if u wanna give it a shot https://github.com/doctorfree/nvim-lazyman

lervag commented 1 year ago

and about lazyman its a shell program that help u to try out different config almost 100 with just simple steps and it provides some helper functions to invoke and manage different nvim configs at a same time without interfering here is a link if u wanna give it a shot https://github.com/doctorfree/nvim-lazyman

Ok, cool. I have a decent personal configuration already and don't really have time nor interest in looking into different neovim distributions, so I don't think this is for me. :)

i tried this but sadly it didnt worked

Well, sorry, then I don't have any further suggestions here. I've already proposed that you open an issue with LunarVim.

Good luck!