Skip to main content
edited tags
Link
romainl
  • 42.3k
  • 5
  • 87
  • 118
Source Link
Mafsi
  • 235
  • 1
  • 9

Deoplete + Vimtex with Lazy.nvim. Deoplete is not triggered

I tried to migrate fomr packer.nvim to lazy.nvim and I encounter problem with deoplete. With packer is triggered on every document and .tex files. With Lazy.nvim is not.

I appreciate any help!

Here is my nvim tree:

 .
├──  init.lua
├──  lazy-lock.json
└──  lua
   └──  mafsi
      ├──  lazy.lua
      └──  plugins
         ├──  colorscheme.lua
         ├──  deoplete.lua
         └──  vimtex.lua

Here are my files:

init.lua

-- Set Neovim's runtime path to include the config directory
vim.cmd("set runtimepath^=~/.config/nvim")

-- Set Neovim's pack path to include the config directory
vim.cmd("set packpath^=~/.config/nvim")

vim.g.python3_host_prog = '/usr/local/bin/python3'

vim.o.completeopt = "noinsert,menuone,noselect"

require("mafsi.lazy")

lazy.lua

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup("mafsi.plugins")

vimtex.lua

-- Assuming 'lazy.nvim' uses a table configuration similar to 'packer.nvim'
return {
  -- The plugin repository
  "lervag/vimtex",
  -- Conditions for lazy loading (this will depend on 'lazy.nvim' API)
  -- event = "BufRead *.tex",

  -- Plugin configuration function
  config = function()
    -- Automatically complete braces when typing LaTeX
    vim.g.vimtex_complete_close_braces = 1

    -- Set the compiler method for Vimtex to latexmk
    vim.g.vimtex_compiler_method = 'latexmk'

    -- there are warning messages and no error messages.
    -- Control whether or not to automatically open the |quickfix| window in case
    vim.g.vimtex_quickfix_open_on_warning = 0

    -- Choose which program to use to view PDF file
    vim.g.vimtex_view_method = 'skim'

    -- Value 1 allows forward search after every successful compilation
    vim.g.vimtex_view_skim_sync = 1

    -- Value 1 allows change focus to skim after command `:VimtexView` is given
    vim.g.vimtex_view_skim_activate = 1
  end,
}

deoplete.lua

return {
  'Shougo/deoplete.nvim',
  -- Define when to load the plugin, e.g., on certain command or event.
  -- event = "InsertEnter", -- or another appropriate event or command
  config = function()
    -- Enable Deoplete at startup
    vim.g["deoplete#enable_at_startup"] = 1

    -- Configure Deoplete for Vimtex
    vim.call("deoplete#custom#var", "omni", "input_patterns", {
      tex = vim.g["vimtex#re#deoplete"]
    })
  end,
}