neovim: changes to how we access nvf.lib

This commit is contained in:
ooks-io 2025-01-06 16:27:13 +11:00
parent 7868ac1529
commit 8d9c2a0ed2
39 changed files with 30 additions and 28 deletions

View file

@ -0,0 +1,10 @@
{
imports = [
./settings.nix
./opts.nix
./theme.nix
./keymaps.nix
./plugins
./modules
];
}

View file

@ -0,0 +1,5 @@
{
config.vim = {
globals.mapleader = " ";
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./plugins
];
}

View file

@ -0,0 +1,6 @@
{
imports = [
./gruvbox-material
./telescope
];
}

View file

@ -0,0 +1,80 @@
{
config,
lib,
inputs,
pkgs,
...
}: let
inherit (lib) mkOption mkIf boolToString;
inherit (lib.types) bool enum lines;
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.gruvbox-material;
in {
options.vim.gruvbox-material = {
enable = mkOption {
type = bool;
description = "Enable gruvbox-material-theme";
default = false;
};
contrast = mkOption {
type = enum ["dark" "medium" "soft"];
description = "Set contrast, can be any of 'hard', 'medium', 'soft'";
default = "dark";
};
italics = mkOption {
type = bool;
description = "Enable italic comments";
default = true;
};
transparent = mkOption {
type = bool;
description = "Set background to transparent";
default = false;
};
floatForceBackground = mkOption {
type = bool;
description = "Force backgrounds on floats even when transparent = true";
default = false;
};
signsHighlight = mkOption {
type = bool;
description = "Enable sign highlighting";
default = true;
};
extraConfig = mkOption {
type = lines;
description = "Additional lua configuration after";
};
};
config = mkIf cfg.enable {
vim = {
startPlugins = [pkgs.vimPlugins.gruvbox-material-nvim];
luaConfigRC.theme =
entryAfter ["basic"]
/*
lua
*/
''
require('gruvbox-material').setup{
contrast = "${cfg.contrast}",
comments = {
italics = ${boolToString cfg.italics},
},
background = {
transparent = ${boolToString cfg.transparent},
},
float = {
force_background = ${boolToString cfg.floatForceBackground},
background_color = nil,
},
signs = {
highlight = ${boolToString cfg.signsHighlight},
},
}
${cfg.extraConfig}
'';
};
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./config.nix
];
}

View file

@ -0,0 +1,55 @@
{
config,
lib,
inputs,
...
}: let
inherit (lib) mkIf mkOption;
inherit (lib.types) bool;
inherit (inputs.nvf.lib.nvim.dag) entryAfter;
cfg = config.vim.telescope;
in {
options.vim.telescope = {
autostart = mkOption {
type = bool;
default = false;
description = "Auto start telescope when opening neovim unless opening a file";
};
};
config = mkIf cfg.autostart {
vim.luaConfigRC.telescope-autostart =
entryAfter ["pluginConfigs"]
#lua
''
local find_files_hijack_netrw = vim.api.nvim_create_augroup("find_files_hijack_netrw", { clear = true })
-- clear FileExplorer appropriately to prevent netrw from launching on folders
-- netrw may or may not be loaded before telescope-find-files
-- conceptual credits to nvim-tree and telescope-file-browser
vim.api.nvim_create_autocmd("VimEnter", {
pattern = "*",
once = true,
callback = function()
pcall(vim.api.nvim_clear_autocmds, { group = "FileExplorer" })
end,
})
vim.api.nvim_create_autocmd("BufEnter", {
group = find_files_hijack_netrw,
pattern = "*",
callback = function()
vim.schedule(function()
-- Early return if netrw or not a directory
if vim.bo[0].filetype == "netrw" or vim.fn.isdirectory(vim.fn.expand("%:p")) == 0 then
return
end
vim.api.nvim_buf_set_option(0, "bufhidden", "wipe")
require("telescope.builtin").find_files({
cwd = vim.fn.expand("%:p:h"),
})
end)
end,
})
'';
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./config.nix
];
}

View file

@ -0,0 +1,9 @@
{
vim = {
options = {
tabstop = 2;
shiftwidth = 2;
autoindent = true;
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.autocomplete.nvim-cmp = {
enable = true;
};
}

View file

@ -0,0 +1,5 @@
{
vim.comments = {
comment-nvim.enable = true;
};
}

View file

@ -0,0 +1,15 @@
{
imports = [
./telescope.nix
./filetree.nix
./cmp.nix
./terminal.nix
./git.nix
./projects.nix
./utility.nix
./ui.nix
./languages
./statusline.nix
./snippets.nix
];
}

View file

@ -0,0 +1,17 @@
{
vim.filetree = {
neo-tree = {
enable = true;
setupOpts = {
filesystem = {
hijack_netrw_behavior = "open_current";
follow_current_file.enabled = true;
};
};
};
};
vim.maps.normal."<C-e>" = {
desc = "Toggle Tree";
action = "<cmd>Neotree toggle reveal<cr>";
};
}

View file

@ -0,0 +1,9 @@
{
vim.git = {
enable = true;
gitsigns = {
enable = true;
codeActions.enable = false;
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.bash = {
enable = true;
};
}

View file

@ -0,0 +1,6 @@
{
vim.languages.css = {
enable = true;
format.enable = true;
};
}

View file

@ -0,0 +1,21 @@
{
imports = [
./nix.nix
./lsp.nix
./bash.nix
./treesitter.nix
./html.nix
./ts.nix
./go.nix
./lua.nix
];
vim.languages = {
enableLSP = true;
enableTreesitter = true;
enableFormat = true;
enableExtraDiagnostics = true;
typst.enable = true;
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.go = {
enable = true;
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.html = {
enable = true;
};
}

View file

@ -0,0 +1,8 @@
{
vim.lsp = {
formatOnSave = true;
lspkind.enable = true;
lspSignature.enable = true;
trouble = {enable = true;};
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.lua = {
enable = true;
};
}

View file

@ -0,0 +1,11 @@
{
vim = {
languages.markdown = {
enable = true;
format = true;
};
utility = {
preview.markdownPreview = {enable = true;};
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.nix = {
enable = true;
};
}

View file

@ -0,0 +1,11 @@
{pkgs, ...}: {
vim.treesitter = {
enable = true;
fold = true;
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
kdl
regex
fish
];
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.ts = {
enable = true;
};
}

View file

@ -0,0 +1,16 @@
{
vim.projects = {
project-nvim = {
enable = true;
setupOpts = {
manualMode = false;
detectionMethods = ["lsp" "pattern"];
patterns = [
".git"
"index.*"
"flake.nix"
];
};
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.snippets.luasnip = {
enable = true;
};
}

View file

@ -0,0 +1,52 @@
{
vim.statusline.lualine = {
enable = true;
activeSection = {
a = [
#lua
''
{
"mode",
icons_enabled = true,
seperator = {left = "", right = " ", }
}
''
#lua
''
{
draw_empty = true,
seperator = { left = " ", right = " " }
}
''
];
b = [
#lua
''
{
"",
draw_empty = true,
}
''
];
c = ["filename"];
x = [
# lua
''
{
"diagnostics",
sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp'},
symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '},
colored = true,
update_in_insert = false,
always_visible = false,
diagnostics_color = {
color_error = { fg = 'red' },
color_warn = { fg = 'yellow' },
color_info = { fg = 'cyan' },
}
}
''
];
};
};
}

View file

@ -0,0 +1,16 @@
{
vim.telescope = {
enable = true;
mappings = {
findFiles = "<leader>ff";
liveGrep = "<leader>/";
open = null;
gitCommits = null;
gitBufferCommits = null;
gitBranches = null;
gitStatus = null;
gitStash = null;
};
};
}

View file

@ -0,0 +1,11 @@
{
vim.terminal = {
toggleterm = {
enable = true;
lazygit = {
enable = true;
direction = "float";
};
};
};
}

View file

@ -0,0 +1,33 @@
{
vim = {
ui = {
borders = {
enable = true;
globalStyle = "single";
};
# better cmd line
noice.enable = true;
colorizer.enable = true;
illuminate.enable = true;
};
# < https://github.com/NotAShelf/nvf/tree/main/modules/plugins/visuals >
visuals = {
# icons that other plugins depend on.
nvim-web-devicons.enable = true;
fidget-nvim.enable = true;
# indent lines
indent-blankline = {
enable = true;
setupOpts = {
scope = {
enabled = false;
injected_languages = false;
};
};
};
};
};
}

View file

@ -0,0 +1,15 @@
{
vim = {
binds.whichKey = {
enable = true;
};
utility = {
preview = {
markdownPreview = {
enable = true;
autoStart = true;
};
};
};
};
}

View file

@ -0,0 +1,14 @@
{pkgs, ...}: {
vim = {
package = pkgs.neovim-unwrapped;
searchCase = "smart";
enableLuaLoader = true;
enableEditorconfig = true;
useSystemClipboard = true;
autopairs.nvim-autopairs.enable = true;
hideSearchHighlight = true;
theme = {
enable = false;
};
};
}

View file

@ -0,0 +1,20 @@
{
vim.gruvbox-material = {
enable = true;
contrast = "medium";
italics = false;
transparent = false;
extraConfig =
# lua
''
local g_colors = require("gruvbox-material.colors")
local colors = g_colors.get(vim.o.background, "soft")
-- Noice
vim.api.nvim_set_hl(0, "NoiceCmdlinePopupBorderHelp", { fg = colors.yellow })
vim.api.nvim_set_hl(0, "NoiceCmdlinePopupBorder", { fg = colors.grey1 })
vim.api.nvim_set_hl(0, "NoiceCmdlineIcon", { fg = colors.green })
vim.api.nvim_set_hl(0, "NoiceCmdLinePopupTitle", { fg = colors.grey1 })
'';
};
}