2025-01-10 23:17:27 -05:00
|
|
|
{ pkgs, ... }:
|
2025-01-10 23:16:31 -05:00
|
|
|
{
|
|
|
|
programs.nixvim = {
|
|
|
|
enable = true;
|
|
|
|
plugins.lualine.enable = true;
|
|
|
|
opts = {
|
|
|
|
number = true;
|
|
|
|
relativenumber = true;
|
|
|
|
expandtab = true;
|
|
|
|
autoindent = true;
|
|
|
|
shiftwidth = 2;
|
|
|
|
smartindent = true;
|
|
|
|
tabstop = 2;
|
|
|
|
ignorecase = true;
|
|
|
|
incsearch = true;
|
|
|
|
smartcase = true;
|
|
|
|
};
|
|
|
|
colorscheme = "iceberg";
|
|
|
|
clipboard.register = "unnamedplus";
|
|
|
|
|
|
|
|
globals = {
|
|
|
|
mapleader = ",";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraPlugins = with pkgs.vimPlugins; [
|
|
|
|
iceberg-vim
|
|
|
|
];
|
|
|
|
|
|
|
|
keymaps = [
|
|
|
|
{
|
|
|
|
action = "<cmd>Neotree toggle<CR>";
|
|
|
|
key = "<space>s";
|
|
|
|
mode = "n";
|
|
|
|
options.silent = true;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# shortcut to command mode
|
|
|
|
action = ":";
|
|
|
|
key = ";";
|
2025-01-10 23:17:27 -05:00
|
|
|
mode = [
|
|
|
|
"n"
|
|
|
|
"x"
|
|
|
|
];
|
2025-01-10 23:16:31 -05:00
|
|
|
options.silent = true;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# insert line below without moving cursor
|
|
|
|
action = "printf('m`%so<ESC>``', v:count1)";
|
|
|
|
key = "<space>o";
|
|
|
|
options.expr = true;
|
|
|
|
mode = "n";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
# insert line above without moving cursor
|
|
|
|
action = "printf('m`%sO<ESC>``', v:count1)";
|
|
|
|
key = "<space>O";
|
|
|
|
options.expr = true;
|
|
|
|
mode = "n";
|
|
|
|
}
|
|
|
|
# nice emacs bindings
|
|
|
|
{
|
|
|
|
action = "<HOME>";
|
|
|
|
key = "<C-a>";
|
|
|
|
mode = "i";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
action = "<END>";
|
|
|
|
key = "<C-e>";
|
|
|
|
mode = "i";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
plugins.cmp = {
|
|
|
|
enable = true;
|
2025-01-11 00:08:00 -05:00
|
|
|
settings = {
|
|
|
|
formatting.fields = [
|
|
|
|
"abbr"
|
|
|
|
"kind"
|
|
|
|
"menu"
|
|
|
|
];
|
|
|
|
experimental = {
|
|
|
|
ghost_text = true;
|
|
|
|
};
|
|
|
|
snippet.expand = ''
|
|
|
|
function(args) require('luasnip').lsp_expand(args.body) end
|
2025-01-10 23:16:31 -05:00
|
|
|
'';
|
2025-01-11 00:08:00 -05:00
|
|
|
sources = [
|
|
|
|
{ name = "nvim_lsp"; }
|
|
|
|
{ name = "emoji"; }
|
|
|
|
{ name = "luasnip"; }
|
|
|
|
{ name = "buffer"; }
|
|
|
|
{ name = "path"; }
|
|
|
|
];
|
|
|
|
mapping = {
|
|
|
|
"<C-h>" = "cmp.mapping.abort()";
|
|
|
|
"<C-n>" = "cmp.mapping.select_next_item()";
|
|
|
|
"<C-p>" = "cmp.mapping.select_prev_item()";
|
2025-01-13 20:09:51 -05:00
|
|
|
"<C-u>" = "cmp.mapping.scroll_docs(-4)";
|
|
|
|
"<C-d>" = "cmp.mapping.scroll_docs(4)";
|
2025-01-11 00:08:00 -05:00
|
|
|
"<C-k>" = ''
|
|
|
|
cmp.mapping(function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
if require("luasnip").expandable() then
|
|
|
|
require("luasnip").expand()
|
|
|
|
else
|
|
|
|
cmp.confirm({
|
|
|
|
select = true,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
'';
|
|
|
|
"<Tab>" = ''
|
|
|
|
cmp.mapping(function(fallback)
|
|
|
|
if require("luasnip").jumpable(1) then
|
|
|
|
require("luasnip").jump(1)
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end,{"i","s"})
|
|
|
|
'';
|
|
|
|
"<S-Tab>" = ''
|
|
|
|
cmp.mapping(function(fallback)
|
|
|
|
if require("luasnip").jumpable(-1) then
|
|
|
|
require("luasnip").jump(-1)
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end,{"i","s"})
|
|
|
|
'';
|
|
|
|
};
|
2025-01-10 23:16:31 -05:00
|
|
|
};
|
|
|
|
};
|
2025-01-11 00:08:00 -05:00
|
|
|
|
2025-01-10 23:16:31 -05:00
|
|
|
plugins.lsp = {
|
|
|
|
enable = true;
|
|
|
|
keymaps.lspBuf = {
|
|
|
|
"K" = "hover";
|
|
|
|
"gd" = "definition";
|
|
|
|
"gD" = "references";
|
2025-01-11 22:50:00 -05:00
|
|
|
# "gt" = "type_definition"; # conflicts with switch tab
|
|
|
|
"gI" = "type_definition";
|
2025-01-10 23:16:31 -05:00
|
|
|
"gi" = "implementation";
|
|
|
|
};
|
|
|
|
servers = {
|
|
|
|
bashls.enable = true;
|
|
|
|
lua_ls.enable = true;
|
2025-01-16 23:28:56 -05:00
|
|
|
nil_ls = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
2025-01-18 21:11:26 -05:00
|
|
|
formatting.command = [
|
|
|
|
"nix"
|
|
|
|
"fmt"
|
|
|
|
];
|
2025-01-16 23:28:56 -05:00
|
|
|
nix.flake.autoArchive = true;
|
|
|
|
};
|
|
|
|
};
|
2025-01-10 23:16:31 -05:00
|
|
|
rust_analyzer = {
|
|
|
|
enable = true;
|
|
|
|
installRustc = true;
|
|
|
|
installCargo = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
plugins.treesitter = {
|
|
|
|
enable = true;
|
|
|
|
nixGrammars = true;
|
|
|
|
settings.indent.enable = true;
|
|
|
|
};
|
|
|
|
plugins.fzf-lua = {
|
|
|
|
enable = true;
|
|
|
|
keymaps = {
|
2025-01-14 00:01:37 -05:00
|
|
|
"<leader>ff" = "files";
|
2025-01-10 23:16:31 -05:00
|
|
|
"<leader>fg" = "live_grep";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
plugins.neo-tree = {
|
|
|
|
enable = true;
|
2025-01-13 15:13:10 -05:00
|
|
|
buffers.followCurrentFile.enabled = true;
|
|
|
|
window.width = 30;
|
2025-01-10 23:16:31 -05:00
|
|
|
};
|
|
|
|
|
2025-01-14 00:01:37 -05:00
|
|
|
plugins.gitsigns = {
|
|
|
|
enable = true;
|
|
|
|
settings.current_line_blame = true;
|
|
|
|
};
|
|
|
|
|
2025-01-10 23:16:31 -05:00
|
|
|
plugins.cmp-buffer.enable = true;
|
|
|
|
plugins.cmp-emoji.enable = true;
|
|
|
|
plugins.cmp-nvim-lsp.enable = true;
|
|
|
|
plugins.cmp-path.enable = true;
|
|
|
|
plugins.cmp_luasnip.enable = true;
|
|
|
|
plugins.luasnip.enable = true;
|
|
|
|
plugins.nvim-autopairs.enable = true;
|
|
|
|
plugins.rainbow-delimiters.enable = true;
|
|
|
|
plugins.web-devicons.enable = true;
|
2025-01-14 00:01:37 -05:00
|
|
|
plugins.auto-save.enable = true;
|
|
|
|
plugins.indent-blankline.enable = true;
|
2025-01-16 11:01:55 -05:00
|
|
|
plugins.undotree.enable = true;
|
2025-01-10 23:16:31 -05:00
|
|
|
};
|
|
|
|
}
|