Files
dotfiles/nix/modules/nixvim/home.nix

200 lines
4.2 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.tokyonight.enable = true;
performance.byteCompileLua = {
enable = true;
plugins = true;
nvimRuntime = true;
};
plugins = {
lsp-status.enable = true;
lsp = {
enable = true;
servers = {
rust_analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
nixd = {
enable = true;
};
};
};
notify.enable = true;
mini-cursorword.enable = true;
# mini-statusline.enable = true;
lualine.enable = true;
web-devicons.enable = true;
vim-dadbod-completion.enable = true;
telescope.enable = true;
lazygit.enable = true;
trouble.enable = true;
cmp = {
enable = true;
autoEnableSources = true;
settings.sources = [
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "buffer"; }
];
};
lspkind.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
]
++ [
(pkgs.vimUtils.buildVimPlugin {
name = "telescope-tabs";
doCheck = false; # i didnt figure out how to do deps so lmfao
src = pkgs.fetchFromGitHub {
owner = "LukasPietzschmann";
repo = "telescope-tabs";
rev = "777b1f630f3d6a12a2e71635a82581c988d6da2e";
hash = "sha256-5NpH9+0ECrcKi8quPLpCHLSPTuzGETWtq4E+2jqUKio=";
};
})
];
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>Telescope file_browser<cr>";
key = "<leader>fv";
options = {
silent = true;
};
}
{
action = "<cmd>Telescope telescope-tabs list_tabs<cr>";
key = "<leader>ft";
options = {
silent = true;
};
}
{
action = "<cmd>tabnew<cr>";
key = "<leader>tt";
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;
};
}
];
};
}