Compare commits
2 Commits
main
...
prepend-to
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7487a5d0a8 | ||
|
|
c9d87d1e3a |
12
README.md
12
README.md
@ -24,6 +24,8 @@
|
||||
for <a href="https://neovim.io/">Neovim</a>
|
||||
</strong>
|
||||
</p>
|
||||
</div>
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
[![Neovim][neovim-shield]][neovim-url]
|
||||
[![Nix][nix-shield]][nix-url]
|
||||
@ -31,8 +33,6 @@
|
||||
|
||||
[![GPL2 License][license-shield]][license-url]
|
||||
[![Issues][issues-shield]][issues-url]
|
||||
</div>
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||

|
||||
|
||||
@ -101,7 +101,7 @@ to start a repo based on this template. **Do _not_ fork it**.
|
||||
1. Add/remove plugins to/from the [Neovim overlay](./nix/neovim-overlay.nix).
|
||||
1. Add/remove plugin configs to/from the `nvim/plugin` directory.
|
||||
1. Modify as you wish (you will probably want to add a color theme, ...).
|
||||
See: [Design](#robot-design).
|
||||
See: [Design](#design).
|
||||
1. You can create more than one package using the `mkNeovim` function by
|
||||
- Passing different plugin lists.
|
||||
- Adding `ignoreConfigRegexes` (e.g. `= [ "^ftplugin/.*.lua" ]`).
|
||||
@ -304,9 +304,9 @@ To work around this, you can put scripts in the `plugin` or `after/plugin` direc
|
||||
- [`nixCats-nvim`](https://github.com/BirdeeHub/nixCats-nvim):
|
||||
A project that organises plugins into categories.
|
||||
It also separates lua and nix configuration.
|
||||
- [`lz.n`](https://github.com/nvim-neorocks/lz.n):
|
||||
A plugin-manager agnostic Lua library for lazy-loading plugins.
|
||||
Can be used with Nix.
|
||||
- [`lazy-nix-helper.nvim`](https://github.com/b-src/lazy-nix-helper.nvim):
|
||||
For lazy.nvim users who would like to manage plugins with Nix,
|
||||
but load them with lazy.nvim.
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
|
||||
132
flake.lock
generated
132
flake.lock
generated
@ -1,31 +1,15 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717285511,
|
||||
"narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
|
||||
"lastModified": 1706830856,
|
||||
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
|
||||
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -39,11 +23,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -55,16 +39,14 @@
|
||||
"gen-luarc": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"git-hooks": "git-hooks",
|
||||
"luvit-meta": "luvit-meta",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1724097937,
|
||||
"narHash": "sha256-Q4tgm8ZHAQUdvsNft86MqIbHQAm7OF7RT/wwYWXqSdY=",
|
||||
"lastModified": 1710933866,
|
||||
"narHash": "sha256-GtYTuxY6AdFxl3uwFkTkqpvOP4lQLzu2YwqnejhDs1Q=",
|
||||
"owner": "mrcjkb",
|
||||
"repo": "nix-gen-luarc-json",
|
||||
"rev": "b36b69c4ded9f31b079523bc452e23458734cf00",
|
||||
"rev": "6e8912ea4fbfaa10797caafb1f5628fb4178b6e8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -73,75 +55,13 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"gen-luarc",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1723803910,
|
||||
"narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"gen-luarc",
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"luvit-meta": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1705776742,
|
||||
"narHash": "sha256-zAAptV/oLuLAAsa2zSB/6fxlElk4+jNZd/cPr9oxFig=",
|
||||
"owner": "Bilal2453",
|
||||
"repo": "luvit-meta",
|
||||
"rev": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Bilal2453",
|
||||
"repo": "luvit-meta",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1718714799,
|
||||
"narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=",
|
||||
"lastModified": 1708475490,
|
||||
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e",
|
||||
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -153,39 +73,29 @@
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1717284937,
|
||||
"narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1720386169,
|
||||
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||
"dir": "lib",
|
||||
"lastModified": 1706550542,
|
||||
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1733212471,
|
||||
"narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=",
|
||||
"lastModified": 1713714899,
|
||||
"narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "55d15ad12a74eb7d4646254e13638ad0c4128776",
|
||||
"rev": "6143fc5eeb9c4f00163267708e26191d1e918932",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@ -11,8 +11,6 @@ with lib;
|
||||
# NVIM_APPNAME - Defaults to 'nvim' if not set.
|
||||
# If set to something else, this will also rename the binary.
|
||||
appName ? null,
|
||||
# The Neovim package to wrap
|
||||
neovim-unwrapped ? pkgs-wrapNeovim.neovim-unwrapped,
|
||||
plugins ? [], # List of plugins
|
||||
# List of dev plugins (will be bootstrapped) - useful for plugin developers
|
||||
# { name = <plugin-name>; url = <git-url>; }
|
||||
@ -32,10 +30,8 @@ with lib;
|
||||
withSqlite ? true, # Add sqlite? This is a dependency for some plugins
|
||||
# You probably don't want to create vi or vim aliases
|
||||
# if the appName is something different than "nvim"
|
||||
# Add a "vi" binary to the build output as an alias?
|
||||
viAlias ? appName == null || appName == "nvim",
|
||||
# Add a "vim" binary to the build output as an alias?
|
||||
vimAlias ? appName == null || appName == "nvim",
|
||||
viAlias ? appName == "nvim", # Add a "vi" binary to the build output as an alias?
|
||||
vimAlias ? appName == "nvim", # Add a "vim" binary to the build output as an alias?
|
||||
}: let
|
||||
# This is the structure of a plugin definition.
|
||||
# Each plugin in the `plugins` argument list can also be defined as this attrset
|
||||
@ -99,17 +95,11 @@ with lib;
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r lua $out/lua
|
||||
rm -r lua
|
||||
# Copy nvim/after only if it exists
|
||||
if [ -d "after" ]; then
|
||||
cp -r after $out/after
|
||||
rm -r after
|
||||
fi
|
||||
# Copy rest of nvim/ subdirectories only if they exist
|
||||
if [ ! -z "$(ls -A)" ]; then
|
||||
cp -r -- * $out/nvim
|
||||
fi
|
||||
cp -r lua $out/lua
|
||||
rm -r lua
|
||||
cp -r * $out/nvim
|
||||
'';
|
||||
};
|
||||
|
||||
@ -170,7 +160,7 @@ with lib;
|
||||
''--set LIBSQLITE "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
|
||||
);
|
||||
|
||||
luaPackages = neovim-unwrapped.lua.pkgs;
|
||||
luaPackages = pkgs.neovim-unwrapped.lua.pkgs;
|
||||
resolvedExtraLuaPackages = extraLuaPackages luaPackages;
|
||||
|
||||
# Native Lua libraries
|
||||
@ -184,7 +174,7 @@ with lib;
|
||||
''--suffix LUA_PATH ";" "${concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages}"'';
|
||||
|
||||
# wrapNeovimUnstable is the nixpkgs utility function for building a Neovim derivation.
|
||||
neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable neovim-unwrapped (neovimConfig
|
||||
neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable pkgs.neovim-unwrapped (neovimConfig
|
||||
// {
|
||||
luaRcContent = initLua;
|
||||
wrapperArgs =
|
||||
@ -207,8 +197,4 @@ with lib;
|
||||
+ lib.optionalString isCustomAppName ''
|
||||
mv $out/bin/nvim $out/bin/${lib.escapeShellArg appName}
|
||||
'';
|
||||
meta.mainProgram
|
||||
= if isCustomAppName
|
||||
then appName
|
||||
else oa.meta.mainProgram;
|
||||
})
|
||||
|
||||
@ -5,7 +5,7 @@ with final.pkgs.lib; let
|
||||
|
||||
# Use this to create a plugin from a flake input
|
||||
mkNvimPlugin = src: pname:
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
pkgs.vimUtils.buildNeovimPlugin {
|
||||
inherit pname src;
|
||||
version = src.lastModifiedDate;
|
||||
};
|
||||
|
||||
@ -50,6 +50,19 @@ local function prefix_diagnostic(prefix, diagnostic)
|
||||
return string.format(prefix .. ' %s', diagnostic.message)
|
||||
end
|
||||
|
||||
local sign = function(opts)
|
||||
fn.sign_define(opts.name, {
|
||||
texthl = opts.name,
|
||||
text = opts.text,
|
||||
numhl = '',
|
||||
})
|
||||
end
|
||||
-- Requires Nerd fonts
|
||||
sign { name = 'DiagnosticSignError', text = '' }
|
||||
sign { name = 'DiagnosticSignWarn', text = '⚠' }
|
||||
sign { name = 'DiagnosticSignInfo', text = 'ⓘ' }
|
||||
sign { name = 'DiagnosticSignHint', text = '' }
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_text = {
|
||||
prefix = '',
|
||||
@ -70,15 +83,7 @@ vim.diagnostic.config {
|
||||
return prefix_diagnostic('■', diagnostic)
|
||||
end,
|
||||
},
|
||||
signs = {
|
||||
text = {
|
||||
-- Requires Nerd fonts
|
||||
[vim.diagnostic.severity.ERROR] = '',
|
||||
[vim.diagnostic.severity.WARN] = '⚠',
|
||||
[vim.diagnostic.severity.INFO] = 'ⓘ',
|
||||
[vim.diagnostic.severity.HINT] = '',
|
||||
},
|
||||
},
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
@ -102,3 +107,9 @@ cmd.packadd('cfilter') -- Allows filtering the quickfix list with :cfdo
|
||||
|
||||
-- let sqlite.lua (which some plugins depend on) know where to find sqlite
|
||||
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE')
|
||||
|
||||
-- this should be at the end, because
|
||||
-- it causes neovim to source ftplugins
|
||||
-- on the packpath when passing a file to the nvim command
|
||||
cmd.syntax('on')
|
||||
cmd.syntax('enable')
|
||||
|
||||
@ -96,10 +96,10 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, desc('[lsp] [f]ormat buffer'))
|
||||
if client and client.server_capabilities.inlayHintProvider then
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
keymap.set('n', '<space>h', function()
|
||||
local current_setting = vim.lsp.inlay_hint.is_enabled { bufnr = bufnr }
|
||||
vim.lsp.inlay_hint.enable(not current_setting, { bufnr = bufnr })
|
||||
local current_setting = vim.lsp.inlay_hint.is_enabled(bufnr)
|
||||
vim.lsp.inlay_hint.enable(bufnr, not current_setting)
|
||||
end, desc('[lsp] toggle inlay hints'))
|
||||
end
|
||||
|
||||
@ -107,16 +107,22 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
local function buf_refresh_codeLens()
|
||||
vim.schedule(function()
|
||||
if client.server_capabilities.codeLensProvider then
|
||||
vim.lsp.codelens.refresh()
|
||||
return
|
||||
end
|
||||
end)
|
||||
end
|
||||
local group = api.nvim_create_augroup(string.format('lsp-%s-%s', bufnr, client.id), {})
|
||||
if client.server_capabilities.codeLensProvider then
|
||||
vim.api.nvim_create_autocmd({ 'InsertLeave', 'BufWritePost', 'TextChanged' }, {
|
||||
group = group,
|
||||
callback = function()
|
||||
vim.lsp.codelens.refresh { bufnr = bufnr }
|
||||
end,
|
||||
callback = buf_refresh_codeLens,
|
||||
buffer = bufnr,
|
||||
})
|
||||
vim.lsp.codelens.refresh { bufnr = bufnr }
|
||||
buf_refresh_codeLens()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@ -174,13 +174,6 @@ keymap.set('n', ']h', function()
|
||||
}
|
||||
end, { noremap = true, silent = true, desc = 'next [h]int diagnostic' })
|
||||
|
||||
local function buf_toggle_diagnostics()
|
||||
local filter = { bufnr = api.nvim_get_current_buf() }
|
||||
diagnostic.enable(not diagnostic.is_enabled(filter), filter)
|
||||
end
|
||||
|
||||
keymap.set('n', '<space>dt', buf_toggle_diagnostics)
|
||||
|
||||
local function toggle_spell_check()
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
vim.opt.spell = not (vim.opt.spell:get())
|
||||
|
||||
@ -7,3 +7,4 @@ vim.g.did_load_plugins_plugin = true
|
||||
-- even with default configs
|
||||
|
||||
require('nvim-surround').setup()
|
||||
require('which-key').setup()
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
require('which-key').setup {
|
||||
preset = 'helix'
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user