[fix] nvim: system module brok plugins
The architecture of nixvim doesn't let me use NixOS modules T-T, I need to use manual imports instead.
This commit is contained in:
parent
ac5e62a37c
commit
3aea6bbc41
6 changed files with 471 additions and 489 deletions
|
@ -250,8 +250,8 @@
|
|||
system,
|
||||
}: {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
just
|
||||
buildInputs = [
|
||||
pkgs.just
|
||||
self.packages.${system}.nvim
|
||||
];
|
||||
QEMU_OPTS_WL = "--enable-kvm -smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless";
|
||||
|
|
|
@ -1,94 +1,87 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
helpers,
|
||||
...
|
||||
}: let
|
||||
{helpers, ...}: let
|
||||
inherit (helpers) mkRaw;
|
||||
cfg = config.jhome.nvim;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
autoGroups = {
|
||||
"highlightOnYank" = {};
|
||||
"lspConfig" = {};
|
||||
"restoreCursorPosition" = {};
|
||||
};
|
||||
autoCmd = [
|
||||
{
|
||||
group = "highlightOnYank";
|
||||
event = "TextYankPost";
|
||||
pattern = "*";
|
||||
callback = mkRaw ''
|
||||
function()
|
||||
vim.highlight.on_yank {
|
||||
higroup = (
|
||||
vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch'
|
||||
),
|
||||
timeout = 200,
|
||||
}
|
||||
in {
|
||||
autoGroups = {
|
||||
"highlightOnYank" = {};
|
||||
"lspConfig" = {};
|
||||
"restoreCursorPosition" = {};
|
||||
};
|
||||
autoCmd = [
|
||||
{
|
||||
group = "highlightOnYank";
|
||||
event = "TextYankPost";
|
||||
pattern = "*";
|
||||
callback = mkRaw ''
|
||||
function()
|
||||
vim.highlight.on_yank {
|
||||
higroup = (
|
||||
vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch'
|
||||
),
|
||||
timeout = 200,
|
||||
}
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
group = "restoreCursorPosition";
|
||||
event = "BufReadPost";
|
||||
pattern = "*";
|
||||
callback = mkRaw ''
|
||||
function()
|
||||
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
|
||||
vim.cmd [[execute "normal! g'\""]]
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
group = "lspConfig";
|
||||
event = "LspAttach";
|
||||
pattern = "*";
|
||||
callback = let
|
||||
opts = "noremap = true, buffer = bufnr";
|
||||
in
|
||||
mkRaw ''
|
||||
function(opts)
|
||||
local bufnr = opts.buf
|
||||
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
||||
local capabilities = client.server_capabilities
|
||||
-- Set Omnifunc if supported
|
||||
if capabilities.completionProvider then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
end
|
||||
-- Enable inlay hints if supported
|
||||
if capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
-- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless
|
||||
vim.keymap.set('n', '<space>ht', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({bufnr = 0}), { bufnr = 0 })
|
||||
end,
|
||||
{ desc = '[H]ints [T]oggle', ${opts} }
|
||||
)
|
||||
-- Enable hover if supported
|
||||
if capabilities.hoverProvider then
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} })
|
||||
end
|
||||
-- Enable rename if supported
|
||||
if capabilities.renameProvider then
|
||||
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} })
|
||||
end
|
||||
-- Enable code actions if supported
|
||||
if capabilities.codeActionProvider then
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} })
|
||||
end
|
||||
-- Enable formatting if supported
|
||||
if capabilities.documentFormattingProvider then
|
||||
vim.keymap.set('n', '<leader>w', function() require("conform").format({ lsp_fallback = true }) end, { desc = 'Format Buffer', ${opts} })
|
||||
end
|
||||
-- Other keybinds
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} })
|
||||
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} })
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} })
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
group = "restoreCursorPosition";
|
||||
event = "BufReadPost";
|
||||
pattern = "*";
|
||||
callback = mkRaw ''
|
||||
function()
|
||||
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
|
||||
vim.cmd [[execute "normal! g'\""]]
|
||||
end
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
group = "lspConfig";
|
||||
event = "LspAttach";
|
||||
pattern = "*";
|
||||
callback = let
|
||||
opts = "noremap = true, buffer = bufnr";
|
||||
in
|
||||
mkRaw ''
|
||||
function(opts)
|
||||
local bufnr = opts.buf
|
||||
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
||||
local capabilities = client.server_capabilities
|
||||
-- Set Omnifunc if supported
|
||||
if capabilities.completionProvider then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
end
|
||||
-- Enable inlay hints if supported
|
||||
if capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
-- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless
|
||||
vim.keymap.set('n', '<space>ht', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({bufnr = 0}), { bufnr = 0 })
|
||||
end,
|
||||
{ desc = '[H]ints [T]oggle', ${opts} }
|
||||
)
|
||||
-- Enable hover if supported
|
||||
if capabilities.hoverProvider then
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} })
|
||||
end
|
||||
-- Enable rename if supported
|
||||
if capabilities.renameProvider then
|
||||
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} })
|
||||
end
|
||||
-- Enable code actions if supported
|
||||
if capabilities.codeActionProvider then
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} })
|
||||
end
|
||||
-- Enable formatting if supported
|
||||
if capabilities.documentFormattingProvider then
|
||||
vim.keymap.set('n', '<leader>w', function() require("conform").format({ lsp_fallback = true }) end, { desc = 'Format Buffer', ${opts} })
|
||||
end
|
||||
-- Other keybinds
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} })
|
||||
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} })
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} })
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{pkgs, ...} @ opts: {
|
||||
args: {
|
||||
imports = [./options.nix];
|
||||
|
||||
config.programs.nixvim = (import ./nixvim.nix opts).config;
|
||||
config.programs.nixvim = (import ./nixvim.nix args).config;
|
||||
}
|
||||
|
|
|
@ -1,158 +1,148 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
helpers,
|
||||
...
|
||||
}: let
|
||||
{helpers, ...}: let
|
||||
inherit (helpers) mkRaw;
|
||||
|
||||
cfg = config.jhome.nvim;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
keymaps = [
|
||||
# Quickfix
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qo";
|
||||
action = "<cmd>Copen<CR>";
|
||||
options.desc = "Quickfix Open";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qq";
|
||||
action = "<cmd>cclose<CR>";
|
||||
options.desc = "Quickfix Quit";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qj";
|
||||
action = "<cmd>cnext<CR>";
|
||||
options.desc = "Quickfix next [J]";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qk";
|
||||
action = "<cmd>cprev<CR>";
|
||||
options.desc = "Quickfix previous [K]";
|
||||
}
|
||||
# Open or create file
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>gf";
|
||||
action = "<cmd>e <cfile><CR>";
|
||||
options.desc = "Go to File";
|
||||
}
|
||||
# Keep Selection when indenting
|
||||
{
|
||||
mode = "x";
|
||||
key = ">";
|
||||
action = ">gv";
|
||||
options.desc = "Indent Selection";
|
||||
}
|
||||
{
|
||||
mode = "x";
|
||||
key = "<";
|
||||
action = "<gv";
|
||||
options.desc = "Deindent Selection";
|
||||
}
|
||||
# Diagnostics
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dj";
|
||||
action = mkRaw "vim.diagnostic.goto_next";
|
||||
options.desc = "Diagnostics next [J]";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dk";
|
||||
action = mkRaw "vim.diagnostic.goto_prev";
|
||||
options.desc = "Diagnostics previous [K]";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xx";
|
||||
action = mkRaw "require('trouble').toggle";
|
||||
options.desc = "Toggle trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xw";
|
||||
action = mkRaw "function() require('trouble').toggle('workspace_diagnostics') end";
|
||||
options.desc = "Toggle Workspace trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xd";
|
||||
action = mkRaw "function() require('trouble').toggle('document_diagnostics') end";
|
||||
options.desc = "Toggle Document trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xq";
|
||||
action = mkRaw "function() require('trouble').toggle('quickfix') end";
|
||||
options.desc = "Toggle Quickfix trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xl";
|
||||
action = mkRaw "function() require('trouble').toggle('loclist') end";
|
||||
options.desc = "Toggle Loclist trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gR";
|
||||
action = mkRaw "function() require('trouble').toggle('lsp_references') end";
|
||||
options.desc = "Toggle lsp References trouble";
|
||||
}
|
||||
# Telescope
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ff";
|
||||
action = mkRaw "require('telescope.builtin').find_files";
|
||||
options.desc = "Find Files";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fg";
|
||||
action = mkRaw "require('telescope.builtin').live_grep";
|
||||
options.desc = "Find Grep";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fh";
|
||||
action = mkRaw "require('telescope.builtin').help_tags";
|
||||
options.desc = "Find Help";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fb";
|
||||
action = mkRaw "require('telescope.builtin').buffers";
|
||||
options.desc = "Find Buffer";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fd";
|
||||
action = mkRaw "require('telescope.builtin').diagnostics";
|
||||
options.desc = "Find Diagnostics";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fq";
|
||||
action = mkRaw "require('telescope.builtin').quickfix";
|
||||
options.desc = "Find Quickfix";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>w";
|
||||
action = mkRaw "require('conform').format";
|
||||
options.desc = "Format buffer";
|
||||
}
|
||||
# Nvim Silicon
|
||||
{
|
||||
mode = "v";
|
||||
key = "<leader>sc";
|
||||
action = mkRaw "require('nvim-silicon').clip";
|
||||
options.desc = "Snap Code (to clipboard)";
|
||||
}
|
||||
];
|
||||
in [
|
||||
# Quickfix
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qo";
|
||||
action = "<cmd>Copen<CR>";
|
||||
options.desc = "Quickfix Open";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qq";
|
||||
action = "<cmd>cclose<CR>";
|
||||
options.desc = "Quickfix Quit";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qj";
|
||||
action = "<cmd>cnext<CR>";
|
||||
options.desc = "Quickfix next [J]";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>qk";
|
||||
action = "<cmd>cprev<CR>";
|
||||
options.desc = "Quickfix previous [K]";
|
||||
}
|
||||
# Open or create file
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>gf";
|
||||
action = "<cmd>e <cfile><CR>";
|
||||
options.desc = "Go to File";
|
||||
}
|
||||
# Keep Selection when indenting
|
||||
{
|
||||
mode = "x";
|
||||
key = ">";
|
||||
action = ">gv";
|
||||
options.desc = "Indent Selection";
|
||||
}
|
||||
{
|
||||
mode = "x";
|
||||
key = "<";
|
||||
action = "<gv";
|
||||
options.desc = "Deindent Selection";
|
||||
}
|
||||
# Diagnostics
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dj";
|
||||
action = mkRaw "vim.diagnostic.goto_next";
|
||||
options.desc = "Diagnostics next [J]";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dk";
|
||||
action = mkRaw "vim.diagnostic.goto_prev";
|
||||
options.desc = "Diagnostics previous [K]";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xx";
|
||||
action = mkRaw "require('trouble').toggle";
|
||||
options.desc = "Toggle trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xw";
|
||||
action = mkRaw "function() require('trouble').toggle('workspace_diagnostics') end";
|
||||
options.desc = "Toggle Workspace trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xd";
|
||||
action = mkRaw "function() require('trouble').toggle('document_diagnostics') end";
|
||||
options.desc = "Toggle Document trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xq";
|
||||
action = mkRaw "function() require('trouble').toggle('quickfix') end";
|
||||
options.desc = "Toggle Quickfix trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xl";
|
||||
action = mkRaw "function() require('trouble').toggle('loclist') end";
|
||||
options.desc = "Toggle Loclist trouble";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gR";
|
||||
action = mkRaw "function() require('trouble').toggle('lsp_references') end";
|
||||
options.desc = "Toggle lsp References trouble";
|
||||
}
|
||||
# Telescope
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ff";
|
||||
action = mkRaw "require('telescope.builtin').find_files";
|
||||
options.desc = "Find Files";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fg";
|
||||
action = mkRaw "require('telescope.builtin').live_grep";
|
||||
options.desc = "Find Grep";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fh";
|
||||
action = mkRaw "require('telescope.builtin').help_tags";
|
||||
options.desc = "Find Help";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fb";
|
||||
action = mkRaw "require('telescope.builtin').buffers";
|
||||
options.desc = "Find Buffer";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fd";
|
||||
action = mkRaw "require('telescope.builtin').diagnostics";
|
||||
options.desc = "Find Diagnostics";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fq";
|
||||
action = mkRaw "require('telescope.builtin').quickfix";
|
||||
options.desc = "Find Quickfix";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>w";
|
||||
action = mkRaw "require('conform').format";
|
||||
options.desc = "Format buffer";
|
||||
}
|
||||
# Nvim Silicon
|
||||
{
|
||||
mode = "v";
|
||||
key = "<leader>sc";
|
||||
action = mkRaw "require('nvim-silicon').clip";
|
||||
options.desc = "Snap Code (to clipboard)";
|
||||
}
|
||||
]
|
||||
|
|
|
@ -10,14 +10,18 @@
|
|||
darwinAvailable = args ? darwinConfig;
|
||||
canSetAsDefault = hmAvailable || nixosAvailable;
|
||||
notStandalone = hmAvailable || nixosAvailable || darwinAvailable;
|
||||
augroups = import ./augroups.nix args;
|
||||
in {
|
||||
imports = [./options.nix ./plugins.nix ./mappings.nix ./augroups.nix];
|
||||
imports = [./options.nix];
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.optionalAttrs canSetAsDefault {defaultEditor = lib.mkDefault true;})
|
||||
(lib.optionalAttrs notStandalone {enable = lib.mkDefault true;})
|
||||
(lib.mkIf cfg.enable {
|
||||
package = pkgs.unstable.neovim-unwrapped;
|
||||
inherit (augroups) autoGroups autoCmd;
|
||||
plugins = import ./plugins.nix args;
|
||||
keymaps = import ./mappings.nix args;
|
||||
globals.mapleader = " ";
|
||||
# Appearance
|
||||
colorschemes.gruvbox = {
|
||||
|
|
469
nvim/plugins.nix
469
nvim/plugins.nix
|
@ -2,246 +2,241 @@
|
|||
lib,
|
||||
pkgs,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (helpers) mkRaw;
|
||||
cfg = config.jhome.nvim;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
plugins = {
|
||||
bacon = {
|
||||
enable = true;
|
||||
settings.quickfix.enabled = true;
|
||||
in {
|
||||
bacon = {
|
||||
enable = true;
|
||||
settings.quickfix.enabled = true;
|
||||
};
|
||||
cmp = {
|
||||
enable = true;
|
||||
cmdline = {
|
||||
"/" = {
|
||||
mapping = mkRaw "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "rg";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
};
|
||||
cmp = {
|
||||
enable = true;
|
||||
cmdline = {
|
||||
"/" = {
|
||||
mapping = mkRaw "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "rg";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
};
|
||||
":" = {
|
||||
mapping = mkRaw "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "path";}
|
||||
{name = "cmdline";}
|
||||
];
|
||||
};
|
||||
};
|
||||
settings = {
|
||||
# Snippets
|
||||
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
# Completion Sources
|
||||
sources = [
|
||||
{
|
||||
name = "buffer";
|
||||
groupIndex = 3;
|
||||
}
|
||||
{
|
||||
name = "calc";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "conventionalcommits";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "crates";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "luasnip";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "nvim_lsp";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "nvim_lsp_document_symbol";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "nvim_lsp_signature_help";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "path";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "spell";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "treesitter";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "zsh";
|
||||
groupIndex = 1;
|
||||
}
|
||||
];
|
||||
mapping = mkRaw ''
|
||||
cmp.mapping.preset.insert({
|
||||
["<C-n>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-p>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
require("luasnip").jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-u>"] = cmp.mapping(function(fallback)
|
||||
if require("luasnip").choice_active() then
|
||||
require("luasnip").next_choice()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete { },
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
})
|
||||
'';
|
||||
};
|
||||
};
|
||||
# FIXME: doesn't include formatters
|
||||
conform-nvim = {
|
||||
enable = true;
|
||||
formattersByFt = {
|
||||
"_" = ["trim_whitespace"];
|
||||
c = ["clang_format"];
|
||||
cpp = ["clang_format"];
|
||||
lua = ["stylua"];
|
||||
nix = ["alejandra"];
|
||||
rust = ["rustfmt"];
|
||||
sh = ["shfmt"];
|
||||
toml = ["taplo"];
|
||||
yaml = ["yamlfmt"];
|
||||
zig = ["zigfmt"];
|
||||
};
|
||||
};
|
||||
gitsigns.enable = true;
|
||||
lint = {
|
||||
enable = true;
|
||||
lintersByFt = {
|
||||
rust = ["typos"];
|
||||
latex = ["chktex" "typos"];
|
||||
markdown = ["typos"];
|
||||
nix = ["statix"];
|
||||
sh = ["dash"];
|
||||
zsh = ["zsh"];
|
||||
};
|
||||
};
|
||||
lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
bashls.enable = true;
|
||||
bashls.package = pkgs.unstable.bash-language-server;
|
||||
# clangd.enable = true; # Adds ~2GiB
|
||||
html.enable = true;
|
||||
jsonls.enable = true;
|
||||
marksman.enable = true;
|
||||
nixd.enable = true;
|
||||
nil-ls = {
|
||||
enable = true;
|
||||
settings.nix.flake = {
|
||||
autoArchive = true;
|
||||
autoEvalInputs = true;
|
||||
};
|
||||
};
|
||||
ruff-lsp.enable = true;
|
||||
taplo.enable = true;
|
||||
# texlab.enable = true; # Not writing TeX rn
|
||||
typos-lsp.enable = true;
|
||||
typst-lsp.enable = true;
|
||||
};
|
||||
};
|
||||
lspkind = {
|
||||
enable = true;
|
||||
mode = "symbol";
|
||||
extraOptions.maxwidth = 50;
|
||||
};
|
||||
lualine = {
|
||||
enable = true;
|
||||
theme = lib.mkForce "gruvbox";
|
||||
};
|
||||
luasnip = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
update_events = "TextChanged,TextChangedI";
|
||||
};
|
||||
};
|
||||
noice = {
|
||||
enable = true;
|
||||
lsp.override = {
|
||||
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
||||
"vim.lsp.util.stylize_markdown" = true;
|
||||
"cmp.entry.get_documentation" = true;
|
||||
};
|
||||
presets = {
|
||||
# use a classic bottom cmdline for search
|
||||
bottom_search = true;
|
||||
# position the cmdline and popupmenu together
|
||||
command_palette = false;
|
||||
# long messages will be sent to a split
|
||||
long_message_to_split = true;
|
||||
# enables an input dialog for inc-rename.nvim
|
||||
inc_rename = false;
|
||||
# add a border to hover docs and signature help
|
||||
lsp_doc_border = true;
|
||||
};
|
||||
};
|
||||
notify = {
|
||||
enable = true;
|
||||
backgroundColour = "#000000";
|
||||
};
|
||||
nvim-colorizer = {
|
||||
enable = true;
|
||||
userDefaultOptions = {
|
||||
names = false; # disable named colors (i.e. red)
|
||||
mode = "virtualtext";
|
||||
};
|
||||
};
|
||||
rustaceanvim = {
|
||||
enable = true;
|
||||
# Install through rustup
|
||||
rustAnalyzerPackage = null;
|
||||
};
|
||||
telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
ui-select.enable = true;
|
||||
fzy-native.enable = true;
|
||||
};
|
||||
};
|
||||
treesitter = {
|
||||
enable = true;
|
||||
indent = true;
|
||||
incrementalSelection.enable = true;
|
||||
};
|
||||
trouble = {
|
||||
enable = true;
|
||||
settings.auto_close = true;
|
||||
":" = {
|
||||
mapping = mkRaw "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "path";}
|
||||
{name = "cmdline";}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
settings = {
|
||||
# Snippets
|
||||
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
# Completion Sources
|
||||
sources = [
|
||||
{
|
||||
name = "buffer";
|
||||
groupIndex = 3;
|
||||
}
|
||||
{
|
||||
name = "calc";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "conventionalcommits";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "crates";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "luasnip";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "nvim_lsp";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "nvim_lsp_document_symbol";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "nvim_lsp_signature_help";
|
||||
groupIndex = 1;
|
||||
}
|
||||
{
|
||||
name = "path";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "spell";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "treesitter";
|
||||
groupIndex = 2;
|
||||
}
|
||||
{
|
||||
name = "zsh";
|
||||
groupIndex = 1;
|
||||
}
|
||||
];
|
||||
mapping = mkRaw ''
|
||||
cmp.mapping.preset.insert({
|
||||
["<C-n>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-p>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
require("luasnip").jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-u>"] = cmp.mapping(function(fallback)
|
||||
if require("luasnip").choice_active() then
|
||||
require("luasnip").next_choice()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete { },
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
})
|
||||
'';
|
||||
};
|
||||
};
|
||||
# FIXME: doesn't include formatters
|
||||
conform-nvim = {
|
||||
enable = true;
|
||||
formattersByFt = {
|
||||
"_" = ["trim_whitespace"];
|
||||
c = ["clang_format"];
|
||||
cpp = ["clang_format"];
|
||||
lua = ["stylua"];
|
||||
nix = ["alejandra"];
|
||||
rust = ["rustfmt"];
|
||||
sh = ["shfmt"];
|
||||
toml = ["taplo"];
|
||||
yaml = ["yamlfmt"];
|
||||
zig = ["zigfmt"];
|
||||
};
|
||||
};
|
||||
gitsigns.enable = true;
|
||||
lint = {
|
||||
enable = true;
|
||||
lintersByFt = {
|
||||
rust = ["typos"];
|
||||
latex = ["chktex" "typos"];
|
||||
markdown = ["typos"];
|
||||
nix = ["statix"];
|
||||
sh = ["dash"];
|
||||
zsh = ["zsh"];
|
||||
};
|
||||
};
|
||||
lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
bashls.enable = true;
|
||||
bashls.package = pkgs.unstable.bash-language-server;
|
||||
# clangd.enable = true; # Adds ~2GiB
|
||||
html.enable = true;
|
||||
jsonls.enable = true;
|
||||
marksman.enable = true;
|
||||
nixd.enable = true;
|
||||
nil-ls = {
|
||||
enable = true;
|
||||
settings.nix.flake = {
|
||||
autoArchive = true;
|
||||
autoEvalInputs = true;
|
||||
};
|
||||
};
|
||||
ruff-lsp.enable = true;
|
||||
taplo.enable = true;
|
||||
# texlab.enable = true; # Not writing TeX rn
|
||||
typos-lsp.enable = true;
|
||||
typst-lsp.enable = true;
|
||||
};
|
||||
};
|
||||
lspkind = {
|
||||
enable = true;
|
||||
mode = "symbol";
|
||||
extraOptions.maxwidth = 50;
|
||||
};
|
||||
lualine = {
|
||||
enable = true;
|
||||
theme = lib.mkForce "gruvbox";
|
||||
};
|
||||
luasnip = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
update_events = "TextChanged,TextChangedI";
|
||||
};
|
||||
};
|
||||
noice = {
|
||||
enable = true;
|
||||
lsp.override = {
|
||||
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
||||
"vim.lsp.util.stylize_markdown" = true;
|
||||
"cmp.entry.get_documentation" = true;
|
||||
};
|
||||
presets = {
|
||||
# use a classic bottom cmdline for search
|
||||
bottom_search = true;
|
||||
# position the cmdline and popupmenu together
|
||||
command_palette = false;
|
||||
# long messages will be sent to a split
|
||||
long_message_to_split = true;
|
||||
# enables an input dialog for inc-rename.nvim
|
||||
inc_rename = false;
|
||||
# add a border to hover docs and signature help
|
||||
lsp_doc_border = true;
|
||||
};
|
||||
};
|
||||
notify = {
|
||||
enable = true;
|
||||
backgroundColour = "#000000";
|
||||
};
|
||||
nvim-colorizer = {
|
||||
enable = true;
|
||||
userDefaultOptions = {
|
||||
names = false; # disable named colors (i.e. red)
|
||||
mode = "virtualtext";
|
||||
};
|
||||
};
|
||||
rustaceanvim = {
|
||||
enable = true;
|
||||
# Install through rustup
|
||||
rustAnalyzerPackage = null;
|
||||
};
|
||||
telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
ui-select.enable = true;
|
||||
fzy-native.enable = true;
|
||||
};
|
||||
};
|
||||
treesitter = {
|
||||
enable = true;
|
||||
indent = true;
|
||||
incrementalSelection.enable = true;
|
||||
};
|
||||
trouble = {
|
||||
enable = true;
|
||||
settings.auto_close = true;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue