Skip to content
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

bug: autocmds loaded to late if file opened directly vim README.md #34

Closed
3 tasks done
Shinzu opened this issue Jan 11, 2023 · 4 comments · Fixed by #28
Closed
3 tasks done

bug: autocmds loaded to late if file opened directly vim README.md #34

Shinzu opened this issue Jan 11, 2023 · 4 comments · Fixed by #28
Labels
bug Something isn't working

Comments

@Shinzu
Copy link

Shinzu commented Jan 11, 2023

Did you check docs and existing issues?

  • I have read all the LazyVim docs
  • I have searched the existing issues of LazyVim
  • I have searched the exsiting issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.9.0-dev

Operating system/version

Ubuntu 18.04

Describe the bug

While opening a file directly on the command line the autocmds eg. for markdown files are loaded after the file is loaded so they are not "executed". In the case of markdown file the specific settings are not applied(speell/wrap). If the file is opened over the Dashboard the autocmds are "executed" and spell/wrap is set.

Refreshing the file over:e "executes" the autocmds.

Steps To Reproduce

  1. open file directly via vim README.md

  2. check settings for wrap/spell eg echo &spell

  3. close

  4. open vim to be on the dashboard

  5. open the file over f keymap

  6. check settings for wrap/spell

Expected Behavior

autocmds are loaded before the file so that they can be "executed"

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/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", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/LazyVim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@Shinzu Shinzu added the bug Something isn't working label Jan 11, 2023
@folke
Copy link
Collaborator

folke commented Jan 11, 2023

You did not provide a minimal init.lua. Autocmds work just fine for me. I set spell for example. Closing this.

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2023
@Shinzu
Copy link
Author

Shinzu commented Jan 11, 2023

@folke sry i forgot about that, here the init.lua i used:

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/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", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

require("lazy").setup({
    spec = {
        -- import LazyVim plugins
        { "LazyVim/LazyVim", import = "lazyvim.plugins" },
        -- import/override with your plugins
        { import = "plugins" },
        -- import any extras modules here
        -- { import = "lazyvim.plugins.extras.lang.typescript" },
        -- { import = "lazyvim.plugins.extras.lang.json" },
    },
    defaults = {
        lazy = true, -- every plugin is lazy-loaded by default
        version = "*", -- try installing the latest stable version for plugins that support semver
    },
    install = { colorscheme = { "tokyonight", "habamax" } },
    checker = { enabled = true }, -- automatically check for plugin updates
    performance = {
        rtp = {
            -- disable some rtp plugins
            disabled_plugins = {
                "gzip",
                "matchit",
                "matchparen",
                "netrwPlugin",
                "tarPlugin",
                "tohtml",
                "tutor",
                "zipPlugin",
            },
        },
    },
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

@folke folke reopened this Jan 11, 2023
@folke
Copy link
Collaborator

folke commented Jan 11, 2023

I'm sorry, I thought you posted this in the lazy.nvim repo. My bad. Will look into this!

@Shinzu
Copy link
Author

Shinzu commented Jan 11, 2023

thank you for the fix, and in general for your amazing work around neovim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants