Skip to content

Instantly share code, notes, and snippets.

@GaetanLepage
Last active June 18, 2024 14:09
Show Gist options
  • Save GaetanLepage/5e74c97ebe83a880f22cd2186fcb053c to your computer and use it in GitHub Desktop.
Save GaetanLepage/5e74c97ebe83a880f22cd2186fcb053c to your computer and use it in GitHub Desktop.
Example of a nixvim configuration
{
programs.nixvim = {
enable = true;
vimAlias = true;
# Configure neovim options...
options = {
relativenumber = true;
incsearch = true;
};
# ...mappings...
maps = {
normal = {
"<C-s>" = ":w<CR>";
"<esc>" = { action = ":noh<CR>"; silent = true; };
};
visual = {
">" = ">gv";
"<" = "<gv";
};
};
# ...plugins...
plugins = {
telescope.enable = true;
harpoon = { # Hi Prime :)
enable = true;
keymaps.addFile = "<leader>a";
};
lsp = {
keymaps = {
silent = true;
diagnostic = {
"<leader>k" = "goto_prev";
"<leader>j" = "goto_next";
};
lspBuf = {
gd = "definition";
K = "hover";
};
};
servers = {
bashls.enable = true;
clangd.enable = true;
nil_ls.enable = true;
};
};
};
# ... and even highlights and autocommands !
highlight.ExtraWhitespace.bg = "red";
match.ExtraWhitespace = "\\s\\+$";
autoCmd = [
{
event = "FileType";
pattern = "nix";
command = "setlocal tabstop=2 shiftwidth=2";
}
];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment