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

rework for better scaling #10

Merged
merged 73 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5dc38bd
health: warnings
quantumfate Aug 16, 2023
dbe0496
rework(#5): move qvim to rtp directory
quantumfate Aug 20, 2023
ef81b62
Merge pull request #19 from QuantumVim/5-feat-move-qvim-to-the-state-…
quantumfate Aug 20, 2023
fd25aba
rework(#5): state directory now wraps rtp dir
quantumfate Aug 20, 2023
8a63e6d
Merge pull request #20 from QuantumVim/5-feat-move-qvim-to-the-state-…
quantumfate Aug 20, 2023
47ea903
feat(#7): implemented rtp init
quantumfate Aug 21, 2023
2a32303
feat(#7): implemented rtp init
quantumfate Aug 21, 2023
1c98bd1
Merge branch '7-feat-runtime-path-modifications-and-user-config-after…
quantumfate Aug 21, 2023
eb4980c
feat(#7): implemented bootstrap function for rtp modifications
quantumfate Aug 21, 2023
0267ff3
Merge pull request #21 from QuantumVim/7-feat-runtime-path-modificati…
quantumfate Aug 21, 2023
c776b6f
feat(#7): updatet test init
quantumfate Aug 21, 2023
a61f095
Merge pull request #22 from QuantumVim/7-feat-runtime-path-modificati…
quantumfate Aug 21, 2023
b6b7f39
feat(#7): updatet test init
quantumfate Aug 21, 2023
3eac59a
Merge pull request #23 from QuantumVim/7-feat-runtime-path-modificati…
quantumfate Aug 21, 2023
554cfc5
feat(#7): updatet rtp tests
quantumfate Aug 21, 2023
81cae48
Merge pull request #24 from QuantumVim/7-feat-runtime-path-modificati…
quantumfate Aug 21, 2023
925516a
feat(#6): added log directory
quantumfate Aug 21, 2023
7bb6743
Merge pull request #25 from QuantumVim/6-feat-add-a-log-diroctory
quantumfate Aug 21, 2023
abd8a1c
feat(#14): added structlag as a dependency and rtp integration
quantumfate Aug 22, 2023
878f57f
feat(#14): added lsp factory
quantumfate Aug 22, 2023
e1744bc
Merge pull request #26 from QuantumVim/14-feat-configure-structlog-pr…
quantumfate Aug 22, 2023
af105d6
fix(#14): install script
quantumfate Aug 22, 2023
bd7fa37
Merge pull request #27 from QuantumVim/14-feat-configure-structlog-pr…
quantumfate Aug 22, 2023
b92ec38
fix(#14): install script
quantumfate Aug 22, 2023
e3b4926
Merge pull request #28 from QuantumVim/14-feat-configure-structlog-pr…
quantumfate Aug 22, 2023
be9639c
fix(#14): install script
quantumfate Aug 22, 2023
9b37874
Merge pull request #29 from QuantumVim/14-feat-configure-structlog-pr…
quantumfate Aug 22, 2023
d87b3f1
fix(#14): fix snapshot
quantumfate Aug 22, 2023
36cdd1b
Merge pull request #30 from QuantumVim/14-feat-configure-structlog-pr…
quantumfate Aug 22, 2023
d87d015
fix(#14): rtp
quantumfate Aug 22, 2023
c823290
Merge pull request #31 from QuantumVim/14-feat-configure-structlog-pr…
quantumfate Aug 22, 2023
ace646b
debug pipeline
quantumfate Aug 22, 2023
29c2206
fix(#14): pack dir path
quantumfate Aug 22, 2023
87872a9
debug pipeline
quantumfate Aug 22, 2023
0cf9ea9
fix(#14): lazy reset rtp
quantumfate Aug 22, 2023
4a530d2
fix(#14): fix pipeline
quantumfate Aug 22, 2023
6be0c52
fix(#14): fix pipeline
quantumfate Aug 22, 2023
7abc849
removed debug statements
quantumfate Aug 22, 2023
19eb89f
fix: fix pipeline lint
quantumfate Aug 22, 2023
005be94
fix: fix pipeline lint
quantumfate Aug 22, 2023
c62e0b0
fix: fix pipeline lint
quantumfate Aug 22, 2023
e5f7f1d
fix: fix pipeline lint
quantumfate Aug 22, 2023
8a3563b
feat(#9):updated gen script
quantumfate Nov 14, 2023
8e5744f
feat(#9):updated gen script
quantumfate Nov 15, 2023
a99c80c
feat(#15): updated install script
quantumfate Nov 16, 2023
d506593
feat(#18): harden dependencies
quantumfate Nov 16, 2023
9e0106d
Merge pull request #32 from QuantumVim/15-feat-implement-user-configu…
quantumfate Nov 16, 2023
5ef33b0
Fix stash
quantumfate Apr 23, 2024
36ee83e
Merge branch 'integration-distro-rework' of github.com:quantumfate/Qu…
quantumfate Apr 23, 2024
61e7d46
Update installer
quantumfate Apr 23, 2024
e85bd13
Update installer workflow
quantumfate Apr 23, 2024
ac4345b
Update installer workflow
quantumfate Apr 23, 2024
20829c5
Update installer workflow
quantumfate Apr 23, 2024
430f93c
Update installer workflow
quantumfate Apr 23, 2024
5223d38
Update installer workflow
quantumfate Apr 23, 2024
bd2876c
Log update with tests
quantumfate Apr 25, 2024
7634e84
Fix MacOS release name
quantumfate Apr 25, 2024
60288b3
Fix MacOS release name
quantumfate Apr 25, 2024
aaa187f
Fix MacOS release name
quantumfate Apr 25, 2024
5ed4ae5
Fix MacOS release name
quantumfate Apr 25, 2024
faea6b5
Hope this works lol
quantumfate Apr 29, 2024
0008671
Hope this works now lol
quantumfate Apr 29, 2024
46df245
Hope this works now lol
quantumfate Apr 29, 2024
6de4ca6
Hope this works now lol
quantumfate Apr 29, 2024
0fbbf4e
Hope this works now lol
quantumfate May 6, 2024
b0191d8
Hope this works now lol
quantumfate May 6, 2024
5873933
Hope this works now lol
quantumfate May 6, 2024
beaf054
Hope this works now lol
quantumfate May 6, 2024
84570ab
Hope this works now lol
quantumfate May 6, 2024
9e3fb06
Hope this works now lol
quantumfate May 6, 2024
c147bb9
Finished rework structlog
quantumfate May 6, 2024
bc877ff
Finished rework structlog
quantumfate May 6, 2024
98a19c4
Finished rework structlog
quantumfate May 7, 2024
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
7 changes: 0 additions & 7 deletions -

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- "main"
paths:
- '.github/workflows/**'
- 'lua/**'
- 'snapshots/**'
- 'utils/**'
- ".github/workflows/**"
- "lua/**"
- "snapshots/**"
- "utils/**"

jobs:
unixish:
Expand All @@ -19,10 +19,10 @@ jobs:
include:
- runner: ubuntu-latest
os: linux
neovim: v0.9.0
neovim: latest
- runner: macos-latest
os: osx
neovim: v0.9.0
neovim: latest
- runner: ubuntu-22.04
os: linux
neovim: nightly
Expand Down Expand Up @@ -52,8 +52,8 @@ jobs:

installer_url="https://raw.githubusercontent.com/${QV_REMOTE}/${QV_BRANCH}/utils/installer/install.sh"
curl -LSsO "$installer_url"
bash ./install.sh
bash ./install.sh --no-install-dependencies

- name: Test QuantumVim startup
env:
QUANTUMVIM_DIR: "$HOME/.config/qvim"
Expand Down
8 changes: 6 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ stds.nvim = {
"path_sep",
"vim",
"join_paths",
"get_qvim_log_dir",
"get_qvim_cache_dir",
"get_qvim_state_dir",
"get_qvim_config_dir",
"get_qvim_data_dir",
"get_qvim_state_dir",
"get_qvim_rtp_dir",
"get_qvim_base_dir",
"get_qvim_pack_dir",
"get_qvim_structlog_dir",
"get_lazy_rtp_dir",
"require_clean",
},
Expand All @@ -44,6 +48,6 @@ self = false
cache = true

ignore = {
"631", -- max_line_length
"631", -- max_line_length
"212/_.*", -- unused argument, for vars with "_" prefix
}
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SHELL := /usr/bin/env bash
CURRENT_DIR := $(shell pwd)

install:
@echo starting QuantumVim installer
Expand Down Expand Up @@ -42,4 +43,7 @@ style-sh:
shfmt -f . | grep -v jdtls | xargs shfmt -i 2 -ci -bn -l -d

test:
bash ./utils/ci/run_test.sh "$(TEST)"
bash ./utils/ci/run_test.sh "$(TEST)"

test-local:
export QUANTUMVIM_RTP_DIR="$(CURRENT_DIR)"; bash ./utils/scripts/test_local.sh "$(TEST)"
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

Heavily inspired by [LunarVim](https://github.com/LunarVim/LunarVim)!

**[QuantumVim](https://github.com/quantumfate/qvim) was never meant to be a neovim distribution nor will it ever be.** This configuration is just my overkill take on how to setup a strong core by finding the righ mix of maintainability, stability and performance. Some things that I've implemented already exist as plugins, or could have been done differently with less runtime but the idea is that it would always allow me to migrate to a different plugin, with little effort, once something breaks.

## Dependencies

- [ripgrep](https://github.com/BurntSushi/ripgrep)
Expand All @@ -23,6 +21,10 @@ Heavily inspired by [LunarVim](https://github.com/LunarVim/LunarVim)!

Checkout the [Languages section](./lua/qvim/lang/README.md)

## Testing

Run `make test-local` in the root directory of the project.

## Install

### HTTPS
Expand Down
14 changes: 12 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
local base_dir = vim.env.QUANTUMVIM_RTP_DIR
or (function()
local init_path = debug.getinfo(1, "S").source
return init_path:sub(2):match("(.*[/\\])"):sub(1, -2)
end)()

if not vim.tbl_contains(vim.opt.rtp:get(), base_dir) then
vim.opt.rtp:prepend(base_dir)
end

vim.loader.enable()

require("qvim.bootstrap"):init()

require("qvim.bootstrap"):setup()

local log = require("qvim.log")
log:debug("Starting QuantumVim")
local log = require("qvim.log").qvim
log.debug("Starting QuantumVim")
127 changes: 105 additions & 22 deletions lua/qvim/bootstrap.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: param-type-mismatch, return-type-mismatch
local M = {}
M.__index = M

Expand Down Expand Up @@ -42,6 +43,16 @@ function _G.get_qvim_config_dir()
return qvim_config_dir
end

---Get the full path to `$QUANTUMVIM_LOG_DIR`
---@return string
function _G.get_qvim_log_dir()
local qvim_log_dir = os.getenv("QUANTUMVIM_LOG_DIR")
if not qvim_log_dir then
return vim.call("stdpath", "log")
end
return qvim_log_dir
end

---Get the full path to `$QUANTUMVIM_STATE_DIR`
---@return string
function _G.get_qvim_state_dir()
Expand All @@ -52,6 +63,12 @@ function _G.get_qvim_state_dir()
return qvim_state_dir
end

---Get the full path to `$QUANTUMVIM_RTP_DIR`
---@return string
function _G.get_qvim_rtp_dir()
return os.getenv("QUANTUMVIM_RTP_DIR")
end

---Get the full path to `$QUANTUMVIM_DATA_DIR`
---@return string
function _G.get_qvim_data_dir()
Expand All @@ -72,70 +89,136 @@ function _G.get_qvim_cache_dir()
return qvim_cache_dir
end

---Get the full path to `$QUANTUMVIM_PACK_DIR`
---@return string
function _G.get_qvim_pack_dir()
return os.getenv("QUANTUMVIM_PACK_DIR")
end

---Get the full path to `$QUANTUMVIM_STRUCTLAG_DIR`
---@return string
function _G.get_qvim_structlog_dir()
return os.getenv("QUANTUMVIM_STRUCTLOG_DIR")
end

M.qvim_config_dir = get_qvim_config_dir()
M.qvim_state_dir = get_qvim_state_dir()
M.qvim_rtp_dir = get_qvim_rtp_dir()
M.qvim_cache_dir = get_qvim_cache_dir()
M.opt_dir = join_paths(get_qvim_data_dir(), "after", "pack", "lazy", "opt")
M.lazy_install_dir = join_paths(M.opt_dir, "lazy.nvim")
M.qvim_data_dir = get_qvim_data_dir()
M.qvim_log_dir = get_qvim_log_dir()
M.qvim_pack_dir = get_qvim_pack_dir()
M.lazy_install_dir = join_paths(M.qvim_pack_dir, "lazy.nvim")

function _G.get_lazy_rtp_dir()
return M.opt_dir
return M.qvim_pack_dir
end

---Initialize the `&runtimepath` variables, load the globals and prepare for startup
---@return table
function M:init()
local utils = require("qvim.utils")

---@meta overridden
---@param what any
---@return string
vim.fn.stdpath = function(what)
if what == "cache" then
return get_qvim_cache_dir()
elseif what == "rtp" then
return get_qvim_rtp_dir()
elseif what == "state" then
return get_qvim_state_dir()
elseif what == "data" then
return get_qvim_data_dir()
elseif what == "config" then
return get_qvim_config_dir()
elseif what == "log" then
return get_qvim_log_dir()
elseif what == "pack" then
return get_qvim_pack_dir()
elseif what == "structlog" then
return get_qvim_structlog_dir()
else
return vim.call("stdpath", what)
end
end

local structlog_path = join_paths(self.opt_dir, "structlog")
if
not os.getenv("QV_FIRST_TIME_SETUP")
and utils.is_directory(structlog_path)
then
vim.opt.rtp:append(structlog_path)
require("qvim.log"):init_pre_setup()
end
local log_path = join_paths(self.qvim_pack_dir, "structlog")
vim.opt.rtp:prepend(log_path)

local log = require("qvim.log")
log.setup()

require("qvim.log")

require("qvim.core.manager"):init({
package_root = self.opt_dir,
package_root = self.qvim_pack_dir,
install_path = self.lazy_install_dir,
})

vim.opt.rtp = self:bootstrap()

require("qvim.config"):init()

return self
end

function M:setup()
local utils = require("qvim.utils")

local structlog_path = join_paths(self.opt_dir, "structlog")

local manager = require("qvim.core.manager")
manager:load()
if utils.is_directory(structlog_path) then
require("qvim.log"):init_post_setup()
end

require("qvim.core.plugins.mason").bootstrap()
end

--Modifies the runtimepath by removing standard paths from `vim.call("stdpath", what)` with `vim.fn.stdpath(what)`
---@param stds string[]|nil @default: { "config", "data" }
---@param expands string[][]|nil @default: { {}, { "site", "after" }, { "site" }, { "after" } }
---@return vim.opt.runtimepath
function M:bootstrap(stds, expands)
stds = stds or { "config", "data" }
expands = expands or { {}, { "site", "after" }, { "site" }, { "after" } }
---@type vim.opt.runtimepath
local rtp_paths = vim.opt.rtp:get()
local rtp = vim.opt.rtp

for _, what in ipairs(stds) do
for _, expand in ipairs(expands) do
if #expand == 0 then
if vim.tbl_contains(rtp_paths, vim.call("stdpath", what)) then
-- remove
rtp:remove(vim.call("stdpath", what))
end
if not vim.tbl_contains(rtp_paths, vim.fn.stdpath(what)) then
-- add
rtp:prepend(vim.fn.stdpath(what))
end
else
if
-- remove
vim.tbl_contains(
rtp_paths,
_G.join_paths(vim.call("stdpath", what), unpack(expand))
)
then
rtp:remove(
_G.join_paths(vim.call("stdpath", what), unpack(expand))
)
end
if
not vim.tbl_contains(
rtp_paths,
_G.join_paths(vim.fn.stdpath(what), unpack(expand))
)
then
-- add
rtp:prepend(
_G.join_paths(vim.fn.stdpath(what), unpack(expand))
)
end
end
end
end
return rtp
end

---Update qvimVim
---pulls the latest changes from github and, resets the startup cache
function M:update()
Expand Down
20 changes: 0 additions & 20 deletions lua/qvim/config/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,6 @@ return {
icons = require("qvim.icons"),
---@class autocommands
autocommands = {},
---@class log
---@field level string
---@field viewer table
log = {
---@usage can be { "trace", "debug", "info", "warn", "error", "fatal" }
level = "error",
viewer = {
---@usage this will fallback on "less +F" if not found
cmd = "qnav",
layout_config = {
---@usage direction = 'vertical' | 'horizontal' | 'window' | 'float',
direction = "horizontal",
open_mapping = "",
size = 40,
float_opts = {},
},
},
-- currently disabled due to instabilities
override_notify = false,
},

---@alias Plugins table<string, AbstractPlugin>|table<string, AbstractParent>
---@type Plugins
Expand Down
6 changes: 2 additions & 4 deletions lua/qvim/config/init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local Log = require("qvim.log")
local log = require("qvim.log").qvim

local M = {}

Expand All @@ -14,7 +14,6 @@ function M:init()
---@field icons icons
---@field lsp table
---@field autocommands autocommands
---@field log log
_G.qvim = setmetatable(
{},
{ __index = vim.deepcopy(require("qvim.config.config")) }
Expand All @@ -38,8 +37,7 @@ function M:init()
vim.cmd.colorscheme(qvim.config.colorscheme)
end

Log:set_level(qvim.log.level)
Log:info("Configs were loaded.")
log.info("Configs were loaded.")
end

--[[
Expand Down
3 changes: 3 additions & 0 deletions lua/qvim/config/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ M.load_default_options = function()
vim.fn.mkdir(undodir, "p")
end

---@type vim.opt
--- https://neovim.io/doc/user/quickref.html#option-list
local default_options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
Expand Down Expand Up @@ -53,6 +55,7 @@ M.load_default_options = function()
showcmd = false,
ruler = false,
laststatus = 3,
relativenumber = true,
}

--- SETTINGS ---
Expand Down
Loading
Loading