Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

[BUG] (next) when configs changed, keymaps brings an error #338

Closed
NextAlone opened this issue May 24, 2022 · 20 comments
Closed

[BUG] (next) when configs changed, keymaps brings an error #338

NextAlone opened this issue May 24, 2022 · 20 comments
Labels
scope: bug Something isn't working

Comments

@NextAlone
Copy link
Contributor

Current Behavior:

Expected Behavior:

Steps To Reproduce:

change files in lua dir or even module.lua, then save
and

E5108: Error executing lua [string ":lua"]:1: attempt to index field 'keymaps' (a nil value)
stack traceback:
        [string ":lua"]:1: in main chunk

with

[WARN  Tue 24 May 2022 11:06:34 PM CST] ...one/.config/nvim/lua/doom/modules/core/reloader/init.lua:124: reloader: If you made changes to the config of a plugin, run `:PackerCompile` to execute these changes.

but PackerCompile doesn't work

then keymap fails

Logs

Check Health Output
Doom Report Output

Anything else:

@NextAlone NextAlone added the scope: bug Something isn't working label May 24, 2022
@NextAlone
Copy link
Contributor Author

@connorgmeehan would you please pay attention here

@connorgmeehan
Copy link
Collaborator

I can't re-create this issue, what version of neovim are you using? It should be 0.7

@NextAlone
Copy link
Contributor Author

I can't re-create this issue, what version of neovim are you using? It should be 0.7

➜ v --version
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

@NextAlone
Copy link
Contributor Author

I can't re-create this issue, what version of neovim are you using? It should be 0.7

just edit one lua file and save, but not quit, then, keymap in config.lua fails

@connorgmeehan
Copy link
Collaborator

Can you post your modules.lua + config.lua inside a <details/> tag? Might be something to do with your config.

<details>
CONFIG
</details>

@NextAlone
Copy link
Contributor Author

NextAlone commented Jun 12, 2022

doom.use_keybind({
  mode = "i",
  "cc",
  'copilot#Accept("<CR>")',
  options = { expr = true, silent = true },
}, {
  "qq",
  function() vim.cmd("q!") end,
}, {
  "wq",
  function()
    vim.cmd("wq")
  end,
}, {
  "ww",
  function()
    vim.cmd("w")
  end,
}
)

@NextAlone
Copy link
Contributor Author

NextAlone commented Jun 12, 2022

module.lua

-- modules.lua - Doom nvim module selection
--
-- modules.lua controls what Doom nvim plugins modules are enabled and
-- what features are being used.
--
-- Uncomment a plugin to enable it and comment out to disable and uninstall it.

return {
  features = {
    -- Language features
    "annotations", -- Code annotation generator
    "auto_install", -- Auto install LSP providers
    "autopairs", -- Automatically close character pairs
    "comment", -- Adds keybinds to comment in any language
    "linter", -- Linting and formatting for languages
    "lsp", -- Code completion
    "snippets", -- Code snippets for all languages

    -- Editor
    "auto_session", -- Remember sessions between loads
    "colorizer", -- Show colors in neovim
    "editorconfig", -- Support editorconfig files
    "gitsigns", -- Show git changes in sidebar
    "illuminate", -- Highlight other copies of the word you're hovering on
    "indentlines", -- Show indent lines with special characters
    "range_highlight", -- Highlight selected range from commands
    "todo_comments", -- Highlight TODO: comments
    -- "doom_themes",     -- Extra themes for doom

    -- UI Components
    "lsp_progress", -- Check status of LSP loading
    "tabline", -- Tab bar buffer switcher
    "dashboard", -- A pretty dashboard upon opening
    "trouble", -- A pretty diagnostic viewer
    "statusline", -- A pretty status line at the bottom of the buffer
    "minimap", -- Shows current position in document
    "terminal", -- Integrated terminal in neovim
    "symbols", -- Navigate between code symbols using telescope
    -- "ranger",          -- File explorer in neovim (TODO: Test)
    -- "restclient",      -- Test HTTP requests from neovim (TODO: Test)
    "show_registers",  -- Show and navigate between registers

    -- Tools
    -- "dap",             -- Debug code through neovim
    "explorer", -- An enhanced filetree explorer
    -- "firenvim",        -- Embed neovim in your browser
    -- "lazygit",         -- Lazy git integration
    -- "neogit",          -- A git client for neovim
    "neorg", -- Organise your life
    "projects", -- Quickly switch between projects
    "superman", -- Read unix man pages in neovim
    "suda", -- Save using sudo when necessary
    "telescope", -- Fuzzy searcher to find files, grep code and more
    "whichkey"
  },
  langs = {
    -- Scripts
    "lua",
    "python",
    "bash",

    -- Web
    "javascript",
    "typescript",
    -- "css",
    -- "vue",
    -- "tailwindcss",

    -- Compiled
    "rust",
    "cc",

    -- JIT
    -- "c_sharp",
    "kotlin",
    "java",
    "groovy",

    "config", -- JSON, YAML, TOML
    "markdown",
    "fish",
    "groovy"
  },
}

config.lua

-- doom_config - Doom Nvim user configurations file
--
-- This file contains the user-defined configurations for Doom nvim.
-- Just override stuff in the `doom` global table (it's injected into scope
-- automatically).

-- ADDING A PACKAGE
--
-- doom.use_package("EdenEast/nightfox.nvim", "sainnhe/sonokai")
-- doom.use_package({
--   "ur4ltz/surround.nvim",
--   config = function()
--     require("surround").setup({mappings_style = "sandwich"})
--   end
-- })
doom.use_package("github/copilot.vim", "jspringyc/vim-word", "rmehri01/onenord.nvim", "lervag/vimtex", "dhruvasagar/vim-table-mode", "voldikss/vim-translator")
doom.use_package("rafcamlet/nvim-luapad")
doom.use_package({
  "ellisonleao/glow.nvim",
  branch = "main",
})
-- ADDING A KEYBIND
--
-- doom.use_keybind({
--   -- The `name` field will add the keybind to whichkey
--   {"<leader>s", name = '+search', {
--     -- Bind to a vim command
--     {"g", "Telescope grep_string<CR>", name = "Grep project"},
--     -- Or to a lua function
--     {"p", function()
--       print("Not implemented yet")
--     end, name = ""}
--   }}
-- })
doom.use_keybind({
  mode = "i",
  "cc",
  'copilot#Accept("<CR>")',
  options = { expr = true, silent = true },
}, {
  "qq",
  function() vim.cmd("q!") end,
}, {
  "wq",
  function()
    vim.cmd("wq")
  end,
}, {
  "ww",
  function()
    vim.cmd("w")
  end,
}
)
-- ADDING A COMMAND
--
-- doom.use_cmd({
--   {"CustomCommand1", function() print("Trigger my custom command 1") end},
--   {"CustomCommand2", function() print("Trigger my custom command 2") end}
-- })
doom.use_cmd({
  { "W", function() vim.cmd("SudaWrite") end },
  { "Wq", function() vim.cmd("SudaWrite") vim.cmd("q!") end },
})

-- ADDING AN AUTOCOMMAND
--
-- doom.use_autocmd({
--   { "FileType", "javascript", function() print('This is a javascript file') end }
-- })

vim.g.copilot_no_tab_map = true
vim.opt.colorcolumn = "0"

vim.g.tex_flavor = "xelatex"
vim.g.vimtex_quickfix_mode = 0
vim.g.vimtex_view_general_viewer = 'zathura'
vim.g.vimtex_view_method = 'zathura'


doom.indent = 2 -- Sets vim.opt.shiftwith, vim.opt.softtabstop, vim.opt.tabstop to 2
doom.colorscheme = "onenord" -- Select a colorscheme
doom.disable_ex = true -- Disable Ex mode
doom.disable_macros = true -- Disable macros
doom.use_floating_win_packer = true -- Use floating window packer
doom.preserve_edit_pos = true -- Preserve the cursor position when switching buffers
doom.auto_comment = true -- Enable auto-commenting
doom.impatient_enabled = true -- Enable impatient mode
doom.freeze_dependencies = false -- Freeze dependencies
doom.undo_dir = "/home/nextalone/.cache/nvim/undo" -- Set the undo directory

@connorgmeehan
Copy link
Collaborator

Ok thanks, I can re-create this issue, I'm working on resolving the bug now. For the time being you can include
doom.core.reloader.settings.reload_on_save = false in your config to disable reloading on save.

@NextAlone
Copy link
Contributor Author

Ohh, thanks for your work

@connorgmeehan
Copy link
Collaborator

@NextAlone This has been fixed, there's also a new doom.leader_key option if you wish to change the default. Let me know if this works and I'll close the issue :)

Also I'm not sure how the copilot plugin works but it looks like the copilot command is malformed.

@NextAlone
Copy link
Contributor Author

@NextAlone This has been fixed, there's also a new doom.leader_key option if you wish to change the default. Let me know if this works and I'll close the issue :)

Also I'm not sure how the copilot plugin works but it looks like the copilot command is malformed.

Oh, keymaps works, but copilot truly failed, it's expr, and works with previous versions. Does new mapper not accept expr?

@connorgmeehan
Copy link
Collaborator

Oops, I was using unpack incorrectly, fixed now!

@NextAlone
Copy link
Contributor Author

Oops, I was using unpack incorrectly, fixed now!

Thanks for your work, it works fine for me now.

@NextAlone
Copy link
Contributor Author

and BTW, dashboard cant be install with a fresh doom-nvim, shows that the commit not in the tree

@NextAlone
Copy link
Contributor Author

and { "l", "<cmd>DoomConfigsReload<CR>", name = "Reload config" },
this command not exist, in lua/doom/modules/core/doom/init.lua

@connorgmeehan
Copy link
Collaborator

and BTW, dashboard cant be install with a fresh doom-nvim, shows that the commit not in the tree
I've fixed this issue, doom-nvim should auto install self now.

Also I've fixed the broken hotkey :).

@NextAlone
Copy link
Contributor Author

and BTW, dashboard cant be install with a fresh doom-nvim, shows that the commit not in the tree
I've fixed this issue, doom-nvim should auto install self now.

Also I've fixed the broken hotkey :).

when no open file. dashboard doesnt auto start, and with manual Dashboard, it shows only as follows like no config.
image

@NextAlone
Copy link
Contributor Author

NextAlone commented Jun 12, 2022

there must be some breaking changes in dashboard plugin

@cleong14
Copy link
Contributor

@NextAlone

The dashboard fixes are pending #346 .

The PR failed 2 checks. However, the line of code that fails in each check are lines of code that did not changed as a result of PR #346 .

Hoping to receive some guidance on how to handle the resolution for the 2 failed checks.

@NextAlone
Copy link
Contributor Author

already fixed

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

No branches or pull requests

3 participants