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

feature: Automatically reload config when change in any files is detected #308

Closed
1 task done
Rizhiy opened this issue Feb 19, 2023 · 4 comments
Closed
1 task done
Labels
enhancement New feature or request

Comments

@Rizhiy
Copy link

Rizhiy commented Feb 19, 2023

Did you check the docs?

  • I have read all the LazyVim docs

Is your feature request related to a problem? Please describe.

Whenever I make a change to my configuration, I have to restart my whole neovim to see if it works right.

Describe the solution you'd like

If a file inside nvim directory is changed, lazyvim should reload configuration.

Describe alternatives you've considered

I tried to make a keybinding to reload config manually, but couldn't manage to get it to work.
With vimscript I could just do :source $MYVIMRC<CR>, but with lua there appears to be some caching going on, so it is not as simple. Therefore, I think it would be a good addition to put it as autocommand.

@Rizhiy Rizhiy added the enhancement New feature or request label Feb 19, 2023
@folke
Copy link
Collaborator

folke commented Feb 19, 2023

This is already tracked in the lazy.nvim repo

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2023
@Rizhiy
Copy link
Author

Rizhiy commented Feb 19, 2023

@folke Then it is not working. For example, I add the following to my keymaps.lua:

local function map(mode, lhs, rhs, opts)
  local keys = require("lazy.core.handler").handlers.keys
  ---@cast keys LazyKeysHandler
  -- do not create the keymap if a lazy keys handler exists
  if not keys.active[keys.parse({ lhs, mode = mode }).id] then
    opts = opts or {}
    opts.silent = opts.silent ~= false
    vim.keymap.set(mode, lhs, rhs, opts)
  end
end

-- Splits
map("n", "<leader>v", "<C-W>v", { desc = "Split veritcally" })

The keybinding doesn't work, until I restart.

@folke
Copy link
Collaborator

folke commented Feb 19, 2023

I didn't say it was implemented yet. It's tracked in folke/lazy.nvim#445

@Rizhiy
Copy link
Author

Rizhiy commented Feb 19, 2023

Ok, I thought you meant that changes are already tracked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants