mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
Compare commits
4 commits
fd6f6a01ec
...
c79d25a2df
Author | SHA1 | Date | |
---|---|---|---|
|
c79d25a2df | ||
|
bf22c22ce5 | ||
|
668efb05bf | ||
|
3142a1bf68 |
4 changed files with 49 additions and 20 deletions
16
flake.nix
16
flake.nix
|
@ -21,6 +21,7 @@
|
|||
./flake/legacyPackages.nix
|
||||
./flake/overlays.nix
|
||||
./flake/packages.nix
|
||||
./flake/develop.nix
|
||||
];
|
||||
|
||||
flake = {
|
||||
|
@ -56,20 +57,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
perSystem = {
|
||||
self',
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
devShells = {
|
||||
default = self'.devShells.lsp;
|
||||
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
||||
lsp = pkgs.mkShell {
|
||||
packages = with pkgs; [nil statix deadnix alejandra];
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
# Provide the default formatter. `nix fmt` in project root
|
||||
# will format available files with the correct formatter.
|
||||
# P.S: Please do not format with nixfmt! It messes with many
|
||||
|
|
29
flake/develop.nix
Normal file
29
flake/develop.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{lib, ...}: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
config,
|
||||
self',
|
||||
...
|
||||
}: {
|
||||
devShells = {
|
||||
default = self'.devShells.lsp;
|
||||
nvim-nix = pkgs.mkShellNoCC {packages = [config.packages.nix];};
|
||||
lsp = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [nil statix deadnix alejandra];
|
||||
};
|
||||
};
|
||||
|
||||
# This package exists to make development easier by providing the place and
|
||||
# boilerplate to build a test nvf configuration. Feel free to use this for
|
||||
# testing, but make sure to discard the changes before creating a pull
|
||||
# request.
|
||||
packages.dev = let
|
||||
configuration = {};
|
||||
in
|
||||
(lib.nvim.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [configuration];
|
||||
})
|
||||
.neovim;
|
||||
};
|
||||
}
|
|
@ -3,13 +3,26 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (builtins) attrNames typeOf tryEval concatStringsSep;
|
||||
|
||||
borders = config.vim.ui.borders.plugins.nvim-cmp;
|
||||
# From https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/config/window.lua
|
||||
# This way users can still override the options
|
||||
windowOpts = {
|
||||
border = borders.style;
|
||||
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
|
||||
zindex = 1001;
|
||||
scrolloff = 0;
|
||||
col_offset = 0;
|
||||
side_padding = 1;
|
||||
scrollbar = true;
|
||||
};
|
||||
|
||||
cfg = config.vim.autocomplete.nvim-cmp;
|
||||
luasnipEnable = config.vim.snippets.luasnip.enable;
|
||||
getPluginName = plugin:
|
||||
|
@ -81,10 +94,9 @@ in {
|
|||
setupOpts = {
|
||||
sources = map (s: {name = s;}) (attrNames cfg.sources);
|
||||
|
||||
# TODO: try to get nvim-cmp to follow global border style
|
||||
window = mkIf config.vim.ui.borders.enable {
|
||||
completion = mkLuaInline "cmp.config.window.bordered()";
|
||||
documentation = mkLuaInline "cmp.config.window.bordered()";
|
||||
window = mkIf borders.enable {
|
||||
completion = mkDefault windowOpts;
|
||||
documentation = mkDefault windowOpts;
|
||||
};
|
||||
|
||||
formatting.format = cfg.format;
|
||||
|
|
|
@ -72,7 +72,7 @@ in {
|
|||
};
|
||||
|
||||
format = mkOption {
|
||||
type = luaInline;
|
||||
type = nullOr luaInline;
|
||||
default = mkLuaInline ''
|
||||
function(entry, vim_item)
|
||||
vim_item.menu = (${toLuaObject cfg.sources})[entry.source.name]
|
||||
|
|
Loading…
Reference in a new issue