I am trying to update the config and see the changes take place without exiting neovim.
I have structured my neovim config files like this
~/.config/nvim
├── init.lua
└── lua
└── [username]
├── core
│ └── options.lua
├── init.lua
└── plugins
These are the contents of my files
-- init.lua
require("[username]")
-- ./lua/[username]/init.lua
require("[username].core.options")
-- ./lua/[username]/core/options.lua
local opt = vim.opt -- aliasing
-- line number
opt.number = true
-- tabs & intendation
opt.tabstop = 4
opt.shiftwidth = 4
opt.expandtab = true
opt.autoindent = true
I have windows like this
+----------------------------------------------------------------------------------+
|-- ./lua/[username]/init.lua |-- ./lua/[username]/core/options.lua |
| | |
|require("[username].core.options") |local opt = vim.opt -- aliasing |
|~ | |
|~ |-- line number |
|~ |opt.number = false |
|~ | |
|~ |-- tabs & intendation |
|~ |opt.tabstop = 4 |
|~ |opt.shiftwidth = 4 |
|~ |opt.expandtab = true |
|~ |opt.autoindent = true |
|~ |~ |
|init.lua=============================options.lua==================================|
| |
+----------------------------------------------------------------------------------+
When I make change in window with options.lua
and do :so
, the changes are reflected in that window 2 and not window 1 with init.lua
. When I switch to that window and do :so
nothing happens. Then I tried to do :so $MYVIMRC
in both windows and nothing happened.
I tried :e
in window 1, even closed the window, and opened it again with :vs lua/[username]/init.lua
. The changes in the config were not applied. Then I tried :bdel lua/[username]/init.lua
and opened it again with :vs lua/[username]/init.lua
and now the window had the configs applied.
Why is this and how can I apply the changes to both window without having to even close the window?