Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
watch_file nvim.nix npins/sources.json

use flake

export AUGMENT_WORKSPACE="$(pwd)"
15 changes: 15 additions & 0 deletions npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@
"url": "https://github.com/neovim/neovim/archive/175c09bd660d0cea62288e74cea925a9b15bee55.tar.gz",
"hash": "1pzm9fmz4fc2akgnxswwal2pgscw73286zf9c7gs2m75rzr59f9h"
},
"nvim-augment": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "augmentcode",
"repo": "augment.vim"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v0.26.0",
"revision": "201b916dad110e012a0c9743b085d36e28cff92d",
"url": "https://api.github.com/repos/augmentcode/augment.vim/tarball/v0.26.0",
"hash": "0976jk9r83n6lnp39y2gjzlqrhh82li4x1a93qvv4391yymli1jm"
},
"nvim-catppuccin": {
"type": "Git",
"repository": {
Expand Down
7 changes: 7 additions & 0 deletions nvim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
vimPlugins,
self',
lib,
nodejs,
lua-language-server,
stylua,
markdown-oxide,
Expand Down Expand Up @@ -108,9 +109,15 @@ in
old.generatedWrapperArgs
or []
++ [
# This is needed to be able to point `startuptime` at the correct
# nvim binary, it checks the unwrapped nvim otherwise
"--set"
"NOBBZ_NVIM_PATH"
"${placeholder "out"}/bin/nvim"
# This tells augment which node binary to use.
"--set"
"AUGMENT_NODE"
"${lib.getExe nodejs}"
"--prefix"
"PATH"
":"
Expand Down
10 changes: 10 additions & 0 deletions plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@
version = pin.version or pin.revision;
src = pin;
};
optionalPlugins = {
augment = true;
startuptime = true;
lz-n = false;
};
makeOptional = name: plugin: {
inherit plugin;
optional = optionalPlugins.${name} or (lib.warn "${name} has no explicit optionality, assuming mandatory status" false);
};
plugins = lib.pipe npins [
(lib.filterAttrs (name: _: lib.hasPrefix "nvim-" name))
(lib.mapAttrs' (name: pin: lib.nameValuePair (lib.removePrefix "nvim-" name) pin))
(lib.mapAttrs makePluginFromPin)
(lib.mapAttrs overrideCheck)
(lib.mapAttrs makeOptional)
];
in {
legacyPackages.vimPlugins =
Expand Down
22 changes: 22 additions & 0 deletions plugins/nobbz/lua/nobbz/augment.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
local augment_workspace = vim.env.AUGMENT_WORKSPACE
local augment_node = vim.env.AUGMENT_NODE

require("nobbz.lazy").add_specs({ {
"augment",
enabled = function()
return augment_workspace ~= nil and augment_node ~= nil
end,
before = function(plugin)
vim.g.augment_workspace_folders = { augment_workspace, }
vim.g.augment_node_command = augment_node
end,
cmd = "Augment",
}, })

WK.add({
{ "<leader>a", group = "augment", },
{ "<leader>ac", "<cmd>Augment chat<cr>", desc = "Send chat message", },
{ "<leader>an", "<cmd>Augment chat-new<cr>", desc = "Start new conversation", },
{ "<leader>at", "<cmd>Augment chat-toggle<cr>", desc = "Toggle chat panel", },
{ "<leader>as", "<cmd>Augment status<cr>", desc = "Check Augment status", },
})
9 changes: 6 additions & 3 deletions plugins/nobbz/lua/nobbz/init.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local lazy = require("nobbz.lazy")

WK = require("which-key")
-- TODO: make this available via lsp-helpers
LSP_CAPAS = require("blink.cmp").get_lsp_capabilities()

local lz_n = require("lz.n")

---A small helper function to lazily require.
---
---It is especially helpful together with
Expand All @@ -25,6 +25,7 @@ local function rs(submodule)
end

rs("blink") -- foundations for completions
rs("augment") -- Some AI thingy
rs("git") -- set up neogit (kind of magit)
rs("leap") -- some easier motions
rs("lsp") -- LSP and related setup
Expand All @@ -45,6 +46,8 @@ rs("treesitter") -- set up treesitter
rs("trouble") -- load trouble
rs("whichkey") -- set up whichkey, which provides help as you type

lz_n.load({
lazy.add_specs({
{ "startuptime", command = "StartUptime", after = rf("nobbz.startuptime"), },
})

lazy.finish()
52 changes: 52 additions & 0 deletions plugins/nobbz/lua/nobbz/lazy/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-- Huge parts of the implementation of this module has been borrowd from ViperML.
-- https://github.com/viperML/dotfiles/tree/8fd5755078e65ce905d53fb4d72f562a4487156e/modules/wrapper-manager/neovim/viper-init-plugin/lua/viper/lazy

local M = {}
local _finished = false

--- Completes the configuration by loading all specifications.
--- This *must* be called after all specs have been added.
---
--- After this has been called, there is no way to effectively add more specs.
M.finish = function()
_finished = true
require("lz.n").load(require("nobbz.lazy.specs"))
end

---@param name string
M.packadd = function(name)
vim.api.nvim_cmd({ cmd = "packadd", args = { name, }, }, {})
end

---@param name string
M.load_once = function(name)
if not name or type(name) ~= "string" then
vim.notify("Invalid plugin name provided", vim.log.levels.ERROR)
return
end

local state = require("lz.n.state").plugins
require("lz.n").trigger_load(name)

for k, v in ipairs(state) do
if v == name then
table.remove(state, k)
return
end
end

-- Only reached if `name` was not in `state`:
vim.notify("Plugin " .. name .. " not found in state", vim.log.levels.WARN)
end

---@param specs lz.n.Spec[]
M.add_specs = function(specs)
if _finished then
vim.notify("Cannot add specs after nobbz.lazy.finish() has been called", vim.log.levels.WARN)
return
end

vim.list_extend(require("nobbz.lazy.specs"), specs)
end

return M
10 changes: 10 additions & 0 deletions plugins/nobbz/lua/nobbz/lazy/specs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Huge parts of the implementation of this module has been borrowd from ViperML.
-- https://github.com/viperML/dotfiles/tree/8fd5755078e65ce905d53fb4d72f562a4487156e/modules/wrapper-manager/neovim/viper-init-plugin/lua/viper/lazy

---This table holds all the specs for plugins to be lazy loaded.
---It is populated through `nobbz.lazy.add_specs` and should not be used
---directly.
---@type lz.n.Spec
local M = {}

return M