Files
dotfiles/modules/nixvim/home.nix

254 lines
5.6 KiB
Nix

{
config,
inputs,
pkgs,
lib,
...
}:
let
cfg = config.modules.nixvim;
in
{
options.modules.nixvim = {
enable = lib.mkEnableOption "Nixvim";
};
imports = [
inputs.nixvim.homeModules.nixvim
./plugins
];
config.home.packages = with pkgs; [
# formatters
nixfmt
rustfmt
# misc
ripgrep
# misc
nixd
];
config.programs.nixvim = lib.mkIf cfg.enable {
enable = true;
defaultEditor = true;
colorschemes.gruvbox-material.enable = true;
performance.byteCompileLua = {
enable = true;
plugins = true;
nvimRuntime = true;
luaLib = true;
configs = true;
};
plugins = {
todo-comments.enable = true;
lsp-status.enable = true;
transparent.enable = true;
lsp = {
enable = true;
servers = {
qmlls = {
enable = true;
config = {
cmd = "-E";
};
};
rust_analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
nixd = {
enable = true;
};
astro = {
enable = true;
};
ts_ls = {
enable = true;
};
svelte.enable = true;
};
};
lsp-format = {
enable = true;
# lspServersToEnable = [ "qmlls" ];
};
notify = {
enable = true;
settings = {
background_color = "#00000000";
};
};
mini-cursorword.enable = true;
# mini-statusline.enable = true;
lualine = {
enable = true;
settings = {
sections = {
lualine_a = [ "mode" ];
lualine_b = [
"branch"
"diff"
"diagnostics"
];
lualine_c = [ "filename" ];
lualine_x = [
"encoding"
"fileformat"
"filetype"
];
lualine_y = [ "lsp_status" ];
lualine_z = [ "location" ];
};
inactive_sections = {
lualine_a = [ ];
lualine_b = [ ];
lualine_c = [ "filename" ];
lualine_x = [ "location" ];
lualine_y = [ ];
lualine_z = [ ];
};
};
};
web-devicons.enable = true;
vim-dadbod-completion.enable = true;
telescope.enable = true;
lazygit.enable = true;
mini-indentscope = {
enable = true;
settings = {
draw = {
delay = 10;
};
};
};
mini-files = {
enable = true;
settings = {
windows = {
preview = true;
};
};
};
trouble.enable = true;
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
];
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
};
};
};
lspkind.enable = true;
tiny-inline-diagnostic.enable = true;
# persisted.enable = true;
auto-session = {
enable = true;
settings = {
enabled = true;
auto_save = true;
auto_restore = true;
};
};
wakatime.enable = true;
treesitter = {
enable = true;
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
bash
json
lua
make
markdown
nix
regex
toml
vim
vimdoc
xml
yaml
];
settings = {
highlight.enable = true;
};
};
};
extraPlugins = with pkgs; [
# vimPlugins.mini-completion
vimPlugins.mini-comment
vimPlugins.melange-nvim
vimPlugins.telescope-file-browser-nvim
vimPlugins.lsp-progress-nvim
];
opts = {
number = true;
bg = "dark";
tabstop = 2;
shiftwidth = 2;
termguicolors = true;
};
globals = {
mapleader = " ";
};
keymaps = [
{
action = "<cmd>Telescope persisted<cr>";
key = "<leader>fs";
options = {
silent = true;
};
}
{
action = "<cmd>Telescope find_files<cr>";
key = "<leader>ff";
options = {
silent = true;
};
}
{
action = "<cmd>:lua MiniFiles.open()<cr>";
key = "<leader>fv";
options = {
silent = true;
};
}
{
action = "<cmd>LazyGit<cr>";
key = "<leader>lg";
options = {
silent = true;
};
}
{
action = "<cmd>Telescope buffers<cr>";
key = "<leader>fb";
options = {
silent = true;
};
}
{
action = "<cmd>Telescope live_grep<cr>";
key = "<leader>fg";
options = {
silent = true;
};
}
{
action = "<cmd>Trouble diagnostics toggle<cr>";
key = "<leader>fd";
options = {
silent = true;
};
}
];
};
}