-
Notifications
You must be signed in to change notification settings - Fork 462
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
refactor(structure): structurize nvim config #458
Conversation
…9d9ecfc51e130e8b984c4a59c
Some files are being capitalized are due the module conflicting. Wellcome to suggest a better strategy! |
Will push some changes later 👍 |
It doesn't matter (also this would have no effect on case-insensitive systems like macOS). We can ensure that the relative path is unique, and the user config is always in the first place 👍 |
But the lsp will show warning? Or it's safe to ignore? |
Because it assumes that the current directory is also part of |
The new structure is ok 👍. In this way, users can setup configured plugins with their own config easily without modifying default config. |
IMO this structure would be cleaner and could avoid the warnings in #458 (comment).
any ideas? |
So the config files in |
Since we've required that file in the spec, then it would behave like |
If this would work, then I think it's indeed a more sensible structure than my original one. |
completion["hrsh7th/nvim-cmp"] = {
event = "InsertEnter",
config = require("modules.configs.completion.cmp"), <- This line loads the config
dependencies = {
.....
}
} As this file ( |
Agree. |
I'm still a bit confuse tho. If we still need to specify For me, "auto-loaded" means |
Actually, this is not auto-load. It behaves like auto-load. "Auto-load" here means: Some users may want to split their plugin specs in multiple files.
Instead of passing a spec table to setup(), you can use a Lua module.
The specs from the module and any top-level sub-modules will be
merged together in the final spec, so it is not needed to add require
calls in your main plugin file to the other files. As "The specs from the module and any top-level sub-modules will be merged together in the final spec", this auto-merging process (i.e., requiring all files inside Here we supply a string to the setup function, not a table: require("lazy").setup("modules.plugins") |
Auto-load here means we don't need to fetch and merge all plugin specs before |
Aha, got it. So it's more like a "auto-merge", even if each That would be great! When we were using |
Yup that's it ;) |
For user specific plugins, I think it should be like this. lua/
└── modules/
├── plugins/
│ ├── user.lua <--- user plugins
│ ├── completion.lua
│ ├── editor.lua
│ ├── lang.lua
│ ├── tools.lua
│ └── ui.lua
├── configs/
│ ├── user/ <--- user plugins' config files
│ ├── completion/
│ ├── editor/
│ ├── lang/
│ ├── tools/
│ └── ui/
└── utils/
├── icons.lua
└── init.lua |
Also, one more question. I'm always curious about why we make extra wrapper functions when setting keymaps? Why not just do sth like this? I think it's more native to neovim? |
To be short, it allows users to set [mode|keybinding] on one side, and use Long answer: ┌─ sep ┌── map_type (saving a lot of keystrokes)
["n|gb"] = map_cr("BufferLinePick"):with_noremap():with_silent(),
│ └── map_key │ └── special1 │
└──── map_mode └── map_content └── special2 (chained) This should be more intuitive one you get used to this. The std::ostream& operator<<(std::ostream& out, Obj& obj)
^^^ ^^^^^ return value can be reused / chained output If you use C++. |
Whether to remove the explanation of the effect or not is optional. The purpose I added it is explain the plugins' function briefly.
Maybe this format is clearer? It's ok. |
This change can be introduced in #459. |
@CharlesChiuGit I plan to put
We can adopt those changes using |
So maybe |
Could be helpful if there's new plugins coming in from PRs. |
I will implement it in next pr if ok. |
https://github.com/ayamir/nvimdots/wiki/Usage. I rewrote the first two parts. Hope this can be easily understood @CharlesChiuGit @ayamir |
We can set |
Updated. |
Done |
@CharlesChiuGit IMO it is unnecessary to introduce two empty files. Users can customize them according to the wiki. |
ok i'll revert. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged once the new release note done.
* refactor(structure): structurize nvim config * Merge: #7bc9ca117d2fc3304b61fb7e1d5f0ac4a6a65670 and #5b44cac0ada2d7eed6a948d71dab8a8cffbe7daf * style: remove extra empty line * style: remove extra empty line * fix!: Reorganize assets * chore: Format with stylua * chore: Rearrange files * feat: Save a few keystrokes * chore: rtp tweaks * chore: Sync changes with 'main' * chore: Reorganize / rename assets * chore: Minor fixes * chore: Sync changes with 'main' * chore: Unify code * fix(sqlite3): add custom path to fix sqlite3 lib issues on Windows * chore: Sync changes * chore(script-win): Add sqlite3 dll issue * chore(lspsaga): Adapt options from v2.3.6 * refactor: reorganize plugins acording to new standard * chore: rename `tools` to `tool` * chore: move fugitive to `tool` * typo * chore: Sync changes with 'main' * doc(wiki): add `plugins.md` * rename: rename `install/` to `scripts` * rename: rename `my-snippets` to `snips` * chore: move `wiki` to root * fix(snips): fix path in `package.json` * dic(wiki): change `plugins.lua`'s title * chore: Fixups * chore: Update release note * chore: Add line break * chore: add `plugins/custom.lua` and `configs/custom/example.lua` * revert: remove custom.lua and `configs/custom` --------- Co-authored-by: CharlesChiuGit <[email protected]> Co-authored-by: 冷酔閑吟 <[email protected]>
* refactor(structure): structurize nvim config * Merge: #c032dcc118f5680f017a742f4ff5c725781c940f and #9c899a0c204387ff3ec6c3ee1f9e86ad6648baf8 * style: remove extra empty line * style: remove extra empty line * fix!: Reorganize assets * chore: Format with stylua * chore: Rearrange files * feat: Save a few keystrokes * chore: rtp tweaks * chore: Sync changes with 'main' * chore: Reorganize / rename assets * chore: Minor fixes * chore: Sync changes with 'main' * chore: Unify code * fix(sqlite3): add custom path to fix sqlite3 lib issues on Windows * chore: Sync changes * chore(script-win): Add sqlite3 dll issue * chore(lspsaga): Adapt options from v2.3.6 * refactor: reorganize plugins acording to new standard * chore: rename `tools` to `tool` * chore: move fugitive to `tool` * typo * chore: Sync changes with 'main' * doc(wiki): add `plugins.md` * rename: rename `install/` to `scripts` * rename: rename `my-snippets` to `snips` * chore: move `wiki` to root * fix(snips): fix path in `package.json` * dic(wiki): change `plugins.lua`'s title * chore: Fixups * chore: Update release note * chore: Add line break * chore: add `plugins/custom.lua` and `configs/custom/example.lua` * revert: remove custom.lua and `configs/custom` --------- Co-authored-by: CharlesChiuGit <[email protected]> Co-authored-by: 冷酔閑吟 <[email protected]>
Firstly, sorry about forgot to create a new branch.
I structured the config in my own sense, @ayamir @Jint-lzxy please let me know if I need to change anything!