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

refactor(structure): structurize nvim config #458

Merged
merged 41 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
90865b4
refactor(structure): structurize nvim config
Jan 31, 2023
956ae54
Merge branch 'main' of https://github.com/ayamir/nvimdots
Jan 31, 2023
6acacd5
Merge branch 'main' of https://github.com/ayamir/nvimdots
Jan 31, 2023
dc2cef5
Merge: #694610a23e229e92af9bbdbba18c7b6ecd0201cd and #7087c121d9c5d60…
Jan 31, 2023
0d4bd8b
style: remove extra empty line
Jan 31, 2023
22f6a7f
style: remove extra empty line
Jan 31, 2023
6fcc593
fix!: Reorganize assets
Jint-lzxy Jan 31, 2023
8ccc2d5
chore: Format with stylua
Jint-lzxy Jan 31, 2023
9edb344
chore: Rearrange files
Jint-lzxy Feb 1, 2023
7c4f776
feat: Save a few keystrokes
Jint-lzxy Feb 1, 2023
948c2d4
chore: rtp tweaks
Jint-lzxy Feb 1, 2023
5eecd8c
Merge branch 'main' of https://github.com/ayamir/nvimdots
Jint-lzxy Feb 1, 2023
3d159d3
chore: Sync changes with 'main'
Jint-lzxy Feb 1, 2023
f0c5f4e
chore: Reorganize / rename assets
Jint-lzxy Feb 1, 2023
6fa1ef9
chore: Minor fixes
Jint-lzxy Feb 1, 2023
923100e
chore: Sync changes with 'main'
Jint-lzxy Feb 2, 2023
4d93ad9
chore: Unify code
Jint-lzxy Feb 2, 2023
8bc9b66
fix(sqlite3): add custom path to fix sqlite3 lib issues on Windows
CharlesChiuGit Feb 2, 2023
6227cbd
Merge branch 'main' of https://github.com/ayamir/nvimdots
Jint-lzxy Feb 3, 2023
8d1acaa
chore: Sync changes
Jint-lzxy Feb 3, 2023
538c34b
chore(script-win): Add sqlite3 dll issue
Jint-lzxy Feb 3, 2023
9e7bec4
Merge branch 'main' of https://github.com/ayamir/nvimdots
Jint-lzxy Feb 3, 2023
0088b89
chore(lspsaga): Adapt options from v2.3.6
Jint-lzxy Feb 3, 2023
57591c3
refactor: reorganize plugins acording to new standard
Feb 6, 2023
b6a051a
chore: rename `tools` to `tool`
Feb 6, 2023
d53e6e8
chore: move fugitive to `tool`
Feb 6, 2023
b43da84
typo
Feb 6, 2023
efefd64
Merge branch 'main' of https://github.com/ayamir/nvimdots
Jint-lzxy Feb 6, 2023
32d93a5
chore: Sync changes with 'main'
Jint-lzxy Feb 6, 2023
31f0c77
doc(wiki): add `plugins.md`
CharlesChiuGit Feb 6, 2023
cbde080
rename: rename `install/` to `scripts`
CharlesChiuGit Feb 6, 2023
961e364
rename: rename `my-snippets` to `snips`
CharlesChiuGit Feb 6, 2023
f6bb279
chore: move `wiki` to root
CharlesChiuGit Feb 6, 2023
da8808a
fix(snips): fix path in `package.json`
CharlesChiuGit Feb 6, 2023
464642a
dic(wiki): change `plugins.lua`'s title
CharlesChiuGit Feb 6, 2023
36f331f
chore: Fixups
Jint-lzxy Feb 6, 2023
45d9f98
chore: Update release note
Jint-lzxy Feb 6, 2023
62306e2
chore: Add line break
Jint-lzxy Feb 6, 2023
2438e06
chore: add `plugins/custom.lua` and `configs/custom/example.lua`
CharlesChiuGit Feb 6, 2023
81bec0c
Merge branch 'main' of github.com:CharlesChiuGit/nvimdots-ayamir
CharlesChiuGit Feb 6, 2023
2664248
revert: remove custom.lua and `configs/custom`
CharlesChiuGit Feb 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ Just run the following interactive bootstrap command, and you're good to go 👍
- **Windows** _(Note: This script REQUIRES `pwsh` > `v7.1`)_

```pwsh
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/install/install.ps1'))
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/scripts/install.ps1'))
```

- **\*nix**

```sh
if command -v curl >/dev/null 2>&1; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/install/install.sh)"
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/scripts/install.sh)"
else
bash -c "$(wget -O- https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/install/install.sh)"
bash -c "$(wget -O- https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/scripts/install.sh)"
fi
```

Expand Down
4 changes: 2 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if not vim.g.vscode then
vim.schedule(function()
vim.notify_once(
[[
We've released version v1.0.0!
It has brought about some major changes that would require a manual cleanup.
We've released version v2.0.0!
This is a backward-incompatible release. See the release notes for instructions on how to migrate your configs.

Visit https://github.com/ayamir/nvimdots/releases to see the release notes.

Expand Down
2 changes: 1 addition & 1 deletion lua/core/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ vim.api.nvim_create_autocmd("BufEnter", {
and vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(layout[2]), "filetype") == "NvimTree"
and layout[3] == nil
then
vim.cmd("confirm quit")
vim.api.nvim_command([[confirm quit]])
end
end,
})
Expand Down
2 changes: 1 addition & 1 deletion lua/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ local load_core = function()
require("core.mapping")
require("keymap")
require("core.event")
require("core.lazy")
require("core.pack")

local colorscheme = require("core.settings").colorscheme
local background = require("core.settings").background
Expand Down
4 changes: 2 additions & 2 deletions lua/core/mapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ local def_map = {
["c|<C-h>"] = map_cmd("<BS>"):with_noremap(),
["c|<C-t>"] = map_cmd([[<C-R>=expand("%:p:h") . "/" <CR>]]):with_noremap(),
-- Visual
["v|J"] = map_cmd(":m '>+1<cr>gv=gv"),
["v|K"] = map_cmd(":m '<-2<cr>gv=gv"),
["v|J"] = map_cmd(":m '>+1<CR>gv=gv"),
["v|K"] = map_cmd(":m '<-2<CR>gv=gv"),
["v|<"] = map_cmd("<gv"),
["v|>"] = map_cmd(">gv"),
}
Expand Down
6 changes: 6 additions & 0 deletions lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ local function load_options()
for name, value in pairs(global_local) do
vim.o[name] = value
end

-- Fix sqlite3 missing-lib issue on Windows
if global.is_windows then
-- Download the DLLs form https://www.sqlite.org/download.html
vim.g.sqlite_clib_path = global.home .. "/Documents/sqlite-dll-win64-x64-3400100/sqlite3.dll"
end
end

load_options()
56 changes: 27 additions & 29 deletions lua/core/lazy.lua → lua/core/pack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,46 @@ local settings = require("core.settings")
local use_ssh = settings.use_ssh

local icons = {
kind = require("modules.ui.icons").get("kind"),
documents = require("modules.ui.icons").get("documents"),
ui = require("modules.ui.icons").get("ui"),
ui_sep = require("modules.ui.icons").get("ui", true),
misc = require("modules.ui.icons").get("misc"),
kind = require("modules.utils.icons").get("kind"),
documents = require("modules.utils.icons").get("documents"),
ui = require("modules.utils.icons").get("ui"),
ui_sep = require("modules.utils.icons").get("ui", true),
misc = require("modules.utils.icons").get("misc"),
}

local Lazy = {}
Lazy.__index = Lazy

function Lazy:load_plugins()
self.repos = {}
self.modules = {}

local append_nativertp = function()
package.path = package.path
.. string.format(";%s;%s", modules_dir .. "/configs/?.lua", modules_dir .. "/configs/?/init.lua")
end

local get_plugins_list = function()
local list = {}
local tmp = vim.split(fn.globpath(modules_dir, "*/plugins.lua"), "\n")
local subtmp = vim.split(fn.globpath(modules_dir, "*/user/plugins.lua"), "\n")
if type(subtmp) == "table" then
for _, v in ipairs(subtmp) do
if v ~= "" then
table.insert(tmp, v)
end
end
end
if type(tmp) == "table" then
for _, f in ipairs(tmp) do
-- fill list with `plugins.lua`'s path used for later `require` like this:
-- list[#list + 1] = "modules/completion/plugins.lua"
local plugins_list = vim.split(fn.glob(modules_dir .. "/plugins/*.lua"), "\n")
if type(plugins_list) == "table" then
for _, f in ipairs(plugins_list) do
-- fill list with `plugins/*.lua`'s path used for later `require` like this:
-- list[#list + 1] = "plugins/completion.lua"
list[#list + 1] = f:sub(#modules_dir - 6, -1)
end
end
return list
end

append_nativertp()

local plugins_file = get_plugins_list()
for _, m in ipairs(plugins_file) do
-- require repos which returned in `plugins.lua` like this:
-- local repos = require("modules/completion/plugins")
local repos = require(m:sub(0, #m - 4))
if type(repos) == "table" then
for repo, conf in pairs(repos) do
self.repos[#self.repos + 1] = vim.tbl_extend("force", { repo }, conf)
-- require modules which returned in previous operation like this:
-- local modules = require("modules/plugins/completion.lua")
local modules = require(m:sub(0, #m - 4))
if type(modules) == "table" then
for name, conf in pairs(modules) do
self.modules[#self.modules + 1] = vim.tbl_extend("force", { name }, conf)
end
end
end
Expand Down Expand Up @@ -101,7 +99,7 @@ function Lazy:load_lazy()
icons.ui_sep.BigCircle,
icons.ui_sep.BigUnfilledCircle,
icons.ui_sep.Square,
icons.ui_sep.ArrowClosed,
icons.ui_sep.ChevronRight,
},
},
},
Expand All @@ -118,7 +116,7 @@ function Lazy:load_lazy()
rtp = {
reset = true, -- reset the runtime path to $VIMRUNTIME and the config directory
---@type string[]
paths = {}, -- add any custom paths here that you want to indluce in the rtp
paths = {}, -- add any custom paths here that you want to include in the rtp
},
},
}
Expand All @@ -127,7 +125,7 @@ function Lazy:load_lazy()
end

vim.opt.rtp:prepend(lazy_path)
require("lazy").setup(self.repos, lazy_settings)
require("lazy").setup(self.modules, lazy_settings)
end

Lazy:load_lazy()
Loading