Compare commits

..

24 Commits

Author SHA1 Message Date
Marc Jakobi
f6d0af5576 feat(keymaps): <space>dt to toggle diagnostics 2024-12-05 12:06:37 +01:00
Marc Jakobi
0394b1a0b5 chore(deps): update flake.lock 2024-12-05 12:05:28 +01:00
Marc Jakobi
2fad4f4a41 chore(deps): update flake.lock 2024-11-16 11:10:26 +01:00
Marc Jakobi
b10145093a chore: update flake.lock 2024-10-07 19:49:31 +02:00
Marc Jakobi
881b465b81 fix: override meta.mainProgram on custom appName 2024-09-19 21:24:53 +02:00
Yuto Nishida
c7af6abe23
fix: appName typo in mkNeovim (#41) 2024-09-19 17:55:03 +02:00
Marc Jakobi
43effe2122 fix: set viAlias and vimAlias if appName is null 2024-09-14 09:04:21 +02:00
Marc Jakobi
9e43f5801b
docs(readme): revert last change 2024-08-28 00:07:55 +07:00
Marc Jakobi
f6fd1fa555 docs(readme): disassociate from toxic people 2024-08-21 21:31:25 +02:00
bartbie
7dd380b31b
fix: allow users to remove nvim/ subdirectories except nvim/lua (#35) 2024-08-20 23:54:47 +02:00
Marc Jakobi
2181d879ce fix: codelens refresh autocommand 2024-08-04 18:46:47 +02:00
Marc Jakobi
842431c0c2
docs: fix broken link 2024-07-26 23:13:56 +02:00
Marc Jakobi
132a8cd28c chore: update flake.lock + use which-key helix preset 2024-07-25 00:10:41 +02:00
Marc Jakobi
37bc6855bd docs(readme): lazy-nix-helper -> lz.n 2024-06-18 18:59:41 +02:00
Marc Jakobi
52b723c553 fix: update inlay_hint toggle 2024-06-11 09:51:12 +02:00
Marc Jakobi
45487b52e8 fix: stop using deprecated sign_define to configure diagnostics 2024-06-11 09:51:12 +02:00
Marc Jakobi
639ec8ce0d chore(deps): update flake.lock 2024-06-08 14:41:59 +02:00
Marc Jakobi
834ee1df08 fix: default to using neovim-unwrapped from pinned nixpkgs 2024-06-08 14:37:49 +02:00
Bartek Łuka
703510d8f3
fix: use buildVimPlugin instead of buildNeovimPlugin (#28) 2024-05-30 16:24:59 +02:00
Marc Jakobi
758ca4ef42 chore(deps): update flake.lock 2024-05-25 00:28:01 +02:00
Marc Jakobi
15e7f309b3 chore: buildVimPlugin -> buildNeovimPlugin 2024-05-25 00:26:50 +02:00
Marc Jakobi
d1fb5431af
fix: prepend nvim directory to the runtimepath (#23)
to ensure that neovim sources user ftplugins before builtin ones.
2024-05-12 23:31:31 +02:00
Marc Jakobi
18d5fa7976
fix: remove obsolete syntax command invocations (#22) 2024-05-12 15:30:34 +02:00
Marc Jakobi
c219a78cd4
style(readme): center align badges 2024-05-03 16:28:20 +02:00
9 changed files with 165 additions and 69 deletions

View File

@ -24,8 +24,6 @@
for <a href="https://neovim.io/">Neovim</a> for <a href="https://neovim.io/">Neovim</a>
</strong> </strong>
</p> </p>
</div>
<!-- markdownlint-restore -->
[![Neovim][neovim-shield]][neovim-url] [![Neovim][neovim-shield]][neovim-url]
[![Nix][nix-shield]][nix-url] [![Nix][nix-shield]][nix-url]
@ -33,6 +31,8 @@
[![GPL2 License][license-shield]][license-url] [![GPL2 License][license-shield]][license-url]
[![Issues][issues-shield]][issues-url] [![Issues][issues-shield]][issues-url]
</div>
<!-- markdownlint-restore -->
![](https://github.com/nix-community/kickstart-nix.nvim/assets/12857160/84faa268-82de-4401-acf3-efddc26dd58a) ![](https://github.com/nix-community/kickstart-nix.nvim/assets/12857160/84faa268-82de-4401-acf3-efddc26dd58a)
@ -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 plugins to/from the [Neovim overlay](./nix/neovim-overlay.nix).
1. Add/remove plugin configs to/from the `nvim/plugin` directory. 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, ...). 1. Modify as you wish (you will probably want to add a color theme, ...).
See: [Design](#design). See: [Design](#robot-design).
1. You can create more than one package using the `mkNeovim` function by 1. You can create more than one package using the `mkNeovim` function by
- Passing different plugin lists. - Passing different plugin lists.
- Adding `ignoreConfigRegexes` (e.g. `= [ "^ftplugin/.*.lua" ]`). - 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): - [`nixCats-nvim`](https://github.com/BirdeeHub/nixCats-nvim):
A project that organises plugins into categories. A project that organises plugins into categories.
It also separates lua and nix configuration. It also separates lua and nix configuration.
- [`lazy-nix-helper.nvim`](https://github.com/b-src/lazy-nix-helper.nvim): - [`lz.n`](https://github.com/nvim-neorocks/lz.n):
For lazy.nvim users who would like to manage plugins with Nix, A plugin-manager agnostic Lua library for lazy-loading plugins.
but load them with lazy.nvim. Can be used with Nix.
> [!NOTE] > [!NOTE]
> >

132
flake.lock generated
View File

@ -1,15 +1,31 @@
{ {
"nodes": { "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": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1706830856, "lastModified": 1717285511,
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -23,11 +39,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1731533236,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -39,14 +55,16 @@
"gen-luarc": { "gen-luarc": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"luvit-meta": "luvit-meta",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1710933866, "lastModified": 1724097937,
"narHash": "sha256-GtYTuxY6AdFxl3uwFkTkqpvOP4lQLzu2YwqnejhDs1Q=", "narHash": "sha256-Q4tgm8ZHAQUdvsNft86MqIbHQAm7OF7RT/wwYWXqSdY=",
"owner": "mrcjkb", "owner": "mrcjkb",
"repo": "nix-gen-luarc-json", "repo": "nix-gen-luarc-json",
"rev": "6e8912ea4fbfaa10797caafb1f5628fb4178b6e8", "rev": "b36b69c4ded9f31b079523bc452e23458734cf00",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -55,13 +73,75 @@
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1708475490, "lastModified": 1718714799,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=", "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260", "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -73,29 +153,39 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"dir": "lib", "lastModified": 1717284937,
"lastModified": 1706550542, "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=",
"narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", "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=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", "rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"dir": "lib",
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-24.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1713714899, "lastModified": 1733212471,
"narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6143fc5eeb9c4f00163267708e26191d1e918932", "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -11,6 +11,8 @@ with lib;
# NVIM_APPNAME - Defaults to 'nvim' if not set. # NVIM_APPNAME - Defaults to 'nvim' if not set.
# If set to something else, this will also rename the binary. # If set to something else, this will also rename the binary.
appName ? null, appName ? null,
# The Neovim package to wrap
neovim-unwrapped ? pkgs-wrapNeovim.neovim-unwrapped,
plugins ? [], # List of plugins plugins ? [], # List of plugins
# List of dev plugins (will be bootstrapped) - useful for plugin developers # List of dev plugins (will be bootstrapped) - useful for plugin developers
# { name = <plugin-name>; url = <git-url>; } # { name = <plugin-name>; url = <git-url>; }
@ -30,8 +32,10 @@ with lib;
withSqlite ? true, # Add sqlite? This is a dependency for some plugins withSqlite ? true, # Add sqlite? This is a dependency for some plugins
# You probably don't want to create vi or vim aliases # You probably don't want to create vi or vim aliases
# if the appName is something different than "nvim" # if the appName is something different than "nvim"
viAlias ? appName == "nvim", # Add a "vi" binary to the build output as an alias? # 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? viAlias ? appName == null || appName == "nvim",
# Add a "vim" binary to the build output as an alias?
vimAlias ? appName == null || appName == "nvim",
}: let }: let
# This is the structure of a plugin definition. # This is the structure of a plugin definition.
# Each plugin in the `plugins` argument list can also be defined as this attrset # Each plugin in the `plugins` argument list can also be defined as this attrset
@ -95,11 +99,17 @@ with lib;
''; '';
installPhase = '' installPhase = ''
cp -r after $out/after
rm -r after
cp -r lua $out/lua cp -r lua $out/lua
rm -r lua rm -r lua
cp -r * $out/nvim # 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
''; '';
}; };
@ -160,7 +170,7 @@ with lib;
''--set LIBSQLITE "${pkgs.sqlite.out}/lib/libsqlite3.so"'') ''--set LIBSQLITE "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
); );
luaPackages = pkgs.neovim-unwrapped.lua.pkgs; luaPackages = neovim-unwrapped.lua.pkgs;
resolvedExtraLuaPackages = extraLuaPackages luaPackages; resolvedExtraLuaPackages = extraLuaPackages luaPackages;
# Native Lua libraries # Native Lua libraries
@ -174,7 +184,7 @@ with lib;
''--suffix LUA_PATH ";" "${concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages}"''; ''--suffix LUA_PATH ";" "${concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages}"'';
# wrapNeovimUnstable is the nixpkgs utility function for building a Neovim derivation. # wrapNeovimUnstable is the nixpkgs utility function for building a Neovim derivation.
neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable pkgs.neovim-unwrapped (neovimConfig neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable neovim-unwrapped (neovimConfig
// { // {
luaRcContent = initLua; luaRcContent = initLua;
wrapperArgs = wrapperArgs =
@ -197,4 +207,8 @@ with lib;
+ lib.optionalString isCustomAppName '' + lib.optionalString isCustomAppName ''
mv $out/bin/nvim $out/bin/${lib.escapeShellArg appName} mv $out/bin/nvim $out/bin/${lib.escapeShellArg appName}
''; '';
meta.mainProgram
= if isCustomAppName
then appName
else oa.meta.mainProgram;
}) })

View File

@ -5,7 +5,7 @@ with final.pkgs.lib; let
# Use this to create a plugin from a flake input # Use this to create a plugin from a flake input
mkNvimPlugin = src: pname: mkNvimPlugin = src: pname:
pkgs.vimUtils.buildNeovimPlugin { pkgs.vimUtils.buildVimPlugin {
inherit pname src; inherit pname src;
version = src.lastModifiedDate; version = src.lastModifiedDate;
}; };

View File

@ -50,19 +50,6 @@ local function prefix_diagnostic(prefix, diagnostic)
return string.format(prefix .. ' %s', diagnostic.message) return string.format(prefix .. ' %s', diagnostic.message)
end 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 { vim.diagnostic.config {
virtual_text = { virtual_text = {
prefix = '', prefix = '',
@ -83,7 +70,15 @@ vim.diagnostic.config {
return prefix_diagnostic('', diagnostic) return prefix_diagnostic('', diagnostic)
end, end,
}, },
signs = true, signs = {
text = {
-- Requires Nerd fonts
[vim.diagnostic.severity.ERROR] = '󰅚',
[vim.diagnostic.severity.WARN] = '',
[vim.diagnostic.severity.INFO] = '',
[vim.diagnostic.severity.HINT] = '󰌶',
},
},
update_in_insert = false, update_in_insert = false,
underline = true, underline = true,
severity_sort = true, severity_sort = true,
@ -107,9 +102,3 @@ cmd.packadd('cfilter') -- Allows filtering the quickfix list with :cfdo
-- let sqlite.lua (which some plugins depend on) know where to find sqlite -- let sqlite.lua (which some plugins depend on) know where to find sqlite
vim.g.sqlite_clib_path = require('luv').os_getenv('LIBSQLITE') 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')

View File

@ -96,10 +96,10 @@ vim.api.nvim_create_autocmd('LspAttach', {
keymap.set('n', '<space>f', function() keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true } vim.lsp.buf.format { async = true }
end, desc('[lsp] [f]ormat buffer')) end, desc('[lsp] [f]ormat buffer'))
if client.server_capabilities.inlayHintProvider then if client and client.server_capabilities.inlayHintProvider then
keymap.set('n', '<space>h', function() keymap.set('n', '<space>h', function()
local current_setting = vim.lsp.inlay_hint.is_enabled(bufnr) local current_setting = vim.lsp.inlay_hint.is_enabled { bufnr = bufnr }
vim.lsp.inlay_hint.enable(bufnr, not current_setting) vim.lsp.inlay_hint.enable(not current_setting, { bufnr = bufnr })
end, desc('[lsp] toggle inlay hints')) end, desc('[lsp] toggle inlay hints'))
end end
@ -107,22 +107,16 @@ vim.api.nvim_create_autocmd('LspAttach', {
if not client then if not client then
return return
end 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), {}) local group = api.nvim_create_augroup(string.format('lsp-%s-%s', bufnr, client.id), {})
if client.server_capabilities.codeLensProvider then if client.server_capabilities.codeLensProvider then
vim.api.nvim_create_autocmd({ 'InsertLeave', 'BufWritePost', 'TextChanged' }, { vim.api.nvim_create_autocmd({ 'InsertLeave', 'BufWritePost', 'TextChanged' }, {
group = group, group = group,
callback = buf_refresh_codeLens, callback = function()
vim.lsp.codelens.refresh { bufnr = bufnr }
end,
buffer = bufnr, buffer = bufnr,
}) })
buf_refresh_codeLens() vim.lsp.codelens.refresh { bufnr = bufnr }
end end
end, end,
}) })

View File

@ -174,6 +174,13 @@ keymap.set('n', ']h', function()
} }
end, { noremap = true, silent = true, desc = 'next [h]int diagnostic' }) 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() local function toggle_spell_check()
---@diagnostic disable-next-line: param-type-mismatch ---@diagnostic disable-next-line: param-type-mismatch
vim.opt.spell = not (vim.opt.spell:get()) vim.opt.spell = not (vim.opt.spell:get())

View File

@ -7,4 +7,3 @@ vim.g.did_load_plugins_plugin = true
-- even with default configs -- even with default configs
require('nvim-surround').setup() require('nvim-surround').setup()
require('which-key').setup()

View File

@ -0,0 +1,3 @@
require('which-key').setup {
preset = 'helix'
}