nix-config/users/tacocat/neovim/default.nix

124 lines
2.7 KiB
Nix

{pkgs, ...}: {
imports = [
./lsp.nix
./plugins.nix
./cmp.nix
];
programs.nixvim = {
enable = true;
colorschemes.kanagawa.enable = true;
clipboard = {
providers.wl-copy.enable = true;
register = "unnamedplus";
};
extraPackages = with pkgs; [
tectonic
texliveMedium
zathura
];
opts = {
number = true;
relativenumber = true;
tabstop = 2;
shiftwidth = 2;
expandtab = false;
scrolloff = 5;
autoindent = true;
smartindent = true;
copyindent = true;
signcolumn = "yes";
cursorline = true;
showmode = false;
};
extraConfigLuaPre = ''
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
'';
files = {
"ftplugin/nix.lua" = {
options = {
expandtab = true;
shiftwidth = 2;
tabstop = 2;
};
};
"ftplugin/markdown.lua" = {
options = {
spell = true;
};
};
"ftplugin/tex.lua" = {
options = {
spell = true;
};
keymaps = [
{
action = "<cmd>TexlabBuild<CR>";
key = "<C-,>";
}
];
};
};
keymaps = [
{
action = "<cmd>nohl<CR>";
key = "<C-q>";
mode = ["n"];
options = {
desc = "Remove search highlighting";
silent = true;
};
}
{
action = "function() require(\"luasnip\").expand() end";
key = "<C-L>";
mode = ["i"];
lua = true;
options = {
desc = "Luasnip expand";
silent = true;
};
}
{
action = "function() require(\"luasnip\").jump(1) end";
key = "<C-J>";
mode = ["i" "s"];
lua = true;
options = {
desc = "Luasnip jump to next";
silent = true;
};
}
{
action = "function() require(\"luasnip\").jump(-1) end";
key = "<C-K>";
mode = ["i" "s"];
lua = true;
options = {
desc = "Luasnip jump to previous";
silent = true;
};
}
{
action = ''
function()
if require("luasnip").choice_active() then
require("luasnip").change_choice(1)
end
end
'';
key = "<C-E>";
mode = ["i" "s"];
lua = true;
options = {
desc = "Luasnip change choice";
silent = true;
};
}
];
};
}