2024-02-16 20:36:20 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.jhome.nvim;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./options.nix
|
|
|
|
];
|
2024-02-16 20:10:20 +01:00
|
|
|
|
2024-02-16 20:36:20 +01:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-03-02 20:48:34 +01:00
|
|
|
programs.nixvim = {
|
2024-02-16 20:10:20 +01:00
|
|
|
enable = true;
|
2024-02-16 20:36:20 +01:00
|
|
|
package = pkgs.neovim-nightly;
|
|
|
|
defaultEditor = true;
|
|
|
|
globals.mapleader = " ";
|
|
|
|
# Appearance
|
2024-03-02 21:42:57 +01:00
|
|
|
colorschemes.gruvbox.enable = true;
|
|
|
|
colorschemes.gruvbox.settings.bold = true;
|
|
|
|
colorschemes.gruvbox.settings.transparent_mode = true;
|
|
|
|
colorschemes.gruvbox.settings.terminal_colors = true;
|
2024-02-16 20:36:20 +01:00
|
|
|
options.number = true;
|
|
|
|
options.relativenumber = true;
|
|
|
|
options.colorcolumn = "+1";
|
|
|
|
options.cursorline = true;
|
|
|
|
options.wrap = false;
|
|
|
|
options.splitright = true;
|
|
|
|
# Tabs & indentation
|
|
|
|
options.smarttab = true;
|
|
|
|
options.autoindent = true;
|
|
|
|
options.smartindent = true;
|
|
|
|
# Search path
|
|
|
|
options.path = ".,/usr/include,**";
|
|
|
|
options.wildmenu = true;
|
|
|
|
options.hlsearch = true;
|
|
|
|
options.incsearch = true;
|
|
|
|
options.ignorecase = true; # Search ignores cases
|
|
|
|
options.smartcase = true; # Unless it has a capital letter
|
|
|
|
# Enable local configuration :h 'exrc'
|
|
|
|
options.exrc = true; # safe since nvim 0.9
|
|
|
|
plugins = import ./plugins;
|
2024-03-02 20:49:44 +01:00
|
|
|
keymaps = import ./mappings.nix;
|
2024-03-02 21:04:02 +01:00
|
|
|
inherit (import ./augroups.nix) autoGroups autoCmd;
|
2024-02-16 20:36:20 +01:00
|
|
|
extraPlugins =
|
2024-02-24 16:30:15 +01:00
|
|
|
(with pkgs.vimExtraPlugins; [
|
|
|
|
dressing-nvim
|
|
|
|
idris2-nvim
|
|
|
|
nui-nvim
|
|
|
|
])
|
|
|
|
++ (with pkgs.vimPlugins; [
|
|
|
|
lualine-lsp-progress
|
|
|
|
nvim-web-devicons
|
|
|
|
FTerm-nvim
|
|
|
|
cmp-cmdline
|
|
|
|
]);
|
2024-02-16 20:36:20 +01:00
|
|
|
# Formatting
|
2024-02-24 16:30:15 +01:00
|
|
|
extraPackages = with pkgs; [
|
|
|
|
stylua
|
|
|
|
shfmt
|
|
|
|
taplo
|
|
|
|
yamlfmt
|
|
|
|
nixpkgs-fmt
|
|
|
|
rust-analyzer
|
|
|
|
];
|
2024-02-16 20:36:20 +01:00
|
|
|
extraLuaPreConfig = ''
|
|
|
|
-- Lua Pre Config
|
|
|
|
if vim.fn.has 'termguicolors' then
|
|
|
|
-- Enable RGB colors
|
|
|
|
vim.g.termguicolors = true
|
|
|
|
end
|
2024-02-16 20:10:20 +01:00
|
|
|
|
2024-02-16 20:36:20 +01:00
|
|
|
-- Useful function
|
|
|
|
local has_words_before = function()
|
|
|
|
-- unpack = unpack or table.unpack
|
|
|
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
|
|
return col ~= 0
|
|
|
|
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
|
|
|
|
end
|
|
|
|
-- END: Lua Pre Config
|
|
|
|
'';
|
|
|
|
extraLuaPostConfig = ''
|
|
|
|
do -- Setup cmp-cmdline
|
|
|
|
local cmp = require "cmp"
|
|
|
|
cmp.setup.cmdline("/", {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = cmp.config.sources { {name = "rg" }, { name = "buffer" } },
|
|
|
|
})
|
|
|
|
cmp.setup.cmdline(":", {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = cmp.config.sources({ { name = "path" } }, { { name = "cmdline" } })
|
|
|
|
})
|
|
|
|
end
|
2024-02-16 20:10:20 +01:00
|
|
|
|
2024-02-16 20:36:20 +01:00
|
|
|
do -- Setup dressing.nvim
|
|
|
|
-- require("dressing").setup()
|
|
|
|
end
|
2024-02-16 20:10:20 +01:00
|
|
|
|
2024-02-16 20:36:20 +01:00
|
|
|
do -- Setup idris2-nvim
|
|
|
|
require("idris2").setup { }
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
};
|
2024-02-16 20:10:20 +01:00
|
|
|
};
|
|
|
|
}
|