This repository has been archived on 2024-04-14. You can view files and clone it, but cannot push or open issues or pull requests.
nixos-dotfiles/user/configs/neovim/default.nix

173 lines
3.4 KiB
Nix
Raw Normal View History

2023-03-19 21:35:09 +00:00
{ config, pkgs, lib, inputs, ... }:
2023-03-25 05:40:02 +00:00
let
colors = config.colorScheme.colors;
in
2023-03-19 21:35:09 +00:00
{
imports = [
inputs.nixvim.homeManagerModules.nixvim
];
programs.nixvim = {
enable = true;
2023-03-24 01:43:20 +00:00
globals = {
2023-04-05 10:36:45 +01:00
mapleader = ",";
2023-03-24 01:43:20 +00:00
};
2023-03-19 21:35:09 +00:00
colorschemes.gruvbox = {
enable = true;
transparentBg = true;
};
autoCmd = [
{
event = [ "VimEnter" ];
pattern = [ "*" ];
command = "hi! Normal ctermbg=NONE guibg=NONE";
}
2023-04-05 10:36:45 +01:00
{
event = [ "BufWinLeave" ] ;
pattern = [ "*" ];
command = "silent! mkview";
}
{
event = [ "BufWinEnter" ] ;
pattern = [ "*" ];
command = "silent! loadview";
}
2023-03-19 21:35:09 +00:00
];
options = {
number = true;
2023-04-05 10:36:45 +01:00
relativenumber = true;
2023-03-19 21:35:09 +00:00
ignorecase = true;
smartcase = true;
tabstop = 2;
shiftwidth = 2;
expandtab = true;
autoindent = true;
2023-03-24 01:43:20 +00:00
listchars = "tab:!·,trail:·";
2023-03-19 21:35:09 +00:00
};
plugins = {
intellitab.enable = true;
2023-03-19 23:27:44 +00:00
2023-03-19 21:35:09 +00:00
airline = {
enable = true;
powerline = true;
theme = "base16_gruvbox_dark_medium";
};
2023-03-19 23:27:44 +00:00
2023-03-20 02:18:47 +00:00
lsp.servers = {
clangd.enable = true;
rnix-lsp.enable = true;
bashls.enable = true;
};
2023-03-19 23:27:44 +00:00
comment-nvim.enable = true;
2023-03-19 21:35:09 +00:00
fugitive.enable = true;
2023-03-25 05:40:02 +00:00
lsp = {
enable = true;
keymaps.lspBuf = {
K = "hover";
gD = "references";
gd = "definition";
gi = "implementation";
gt = "type_definition";
};
};
2023-03-19 21:35:09 +00:00
nvim-autopairs.enable = true;
2023-03-19 23:27:44 +00:00
lspkind = {
enable = true;
cmp = {
enable = true;
};
};
cmp-treesitter.enable = true;
2023-03-20 02:18:47 +00:00
2023-03-20 02:49:03 +00:00
luasnip = {
enable = true;
fromVscode = [
{ paths = inputs.friendly-snippets.outPath; }
];
};
2023-03-20 02:18:47 +00:00
cmp_luasnip.enable = true;
2023-03-24 01:43:20 +00:00
cmp-cmdline.enable = true;
2023-03-20 02:18:47 +00:00
2023-03-19 23:27:44 +00:00
nvim-cmp = {
enable = true;
sources = [
2023-03-20 02:18:47 +00:00
{ name = "nvim_lsp"; }
{ name = "luasnip";}
2023-03-19 23:27:44 +00:00
{ name = "path"; }
{ name = "buffer"; }
2023-03-20 02:18:47 +00:00
{ name = "grammar"; }
2023-03-19 23:27:44 +00:00
];
2023-03-20 02:18:47 +00:00
mappingPresets = [ "insert" ];
2023-03-19 23:27:44 +00:00
mapping = {
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.abort()";
};
2023-03-20 02:18:47 +00:00
window.completion = {
border = "single";
scrollbar = true;
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
};
window.documentation = {
border = "single";
maxHeight = "math.floor(40 * (40 / vim.o.lines))";
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
};
2023-03-19 23:27:44 +00:00
};
2023-03-19 21:35:09 +00:00
nvim-colorizer.enable = true;
nvim-lightbulb.enable = true;
2023-03-20 02:49:03 +00:00
2023-03-19 21:35:09 +00:00
neo-tree.enable = true;
2023-03-19 23:27:44 +00:00
2023-03-24 01:43:20 +00:00
telescope = {
enable = true;
keymaps = {
"<leader>c" = "git_files";
"<leader>v" = "live_grep";
};
};
2023-03-19 23:27:44 +00:00
treesitter = {
enable = true;
indent = true;
};
2023-03-25 05:40:02 +00:00
2023-03-19 21:35:09 +00:00
};
maps = {
normal."<C-n>" = {
silent = true;
action = "<cmd>NeoTreeFocusToggle<CR>";
};
2023-04-05 10:36:45 +01:00
normal."<mapleader><Space>" = {
silent = true;
action = "<cmd>nohlsearch<CR>";
};
2023-03-19 21:35:09 +00:00
};
};
}