2024-04-05 11:55:35 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
2024-05-04 20:57:33 +02:00
|
|
|
} @ args: let
|
2024-03-03 15:20:42 +01:00
|
|
|
cfg = config.jhome.nvim;
|
|
|
|
hmAvailable = args ? hmConfig;
|
|
|
|
nixosAvailable = args ? nixosConfig;
|
|
|
|
darwinAvailable = args ? darwinConfig;
|
|
|
|
canSetAsDefault = hmAvailable || nixosAvailable;
|
|
|
|
notStandalone = hmAvailable || nixosAvailable || darwinAvailable;
|
2024-05-04 20:57:33 +02:00
|
|
|
in {
|
|
|
|
imports = [./options.nix];
|
2024-03-03 15:20:42 +01:00
|
|
|
|
|
|
|
config = lib.mkMerge [
|
2024-05-04 20:57:33 +02:00
|
|
|
(lib.optionalAttrs canSetAsDefault {defaultEditor = lib.mkDefault true;})
|
|
|
|
(lib.optionalAttrs notStandalone {enable = lib.mkDefault true;})
|
2024-03-03 15:20:42 +01:00
|
|
|
(lib.mkIf cfg.enable {
|
2024-05-31 06:28:46 +02:00
|
|
|
# package = pkgs.neovim;
|
2024-03-03 15:20:42 +01:00
|
|
|
globals.mapleader = " ";
|
|
|
|
# Appearance
|
2024-05-17 18:50:01 +02:00
|
|
|
colorschemes.gruvbox = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
bold = true;
|
|
|
|
transparent_mode = true;
|
|
|
|
terminal_colors = true;
|
|
|
|
};
|
2024-04-05 11:38:57 +02:00
|
|
|
};
|
2024-05-17 18:50:01 +02:00
|
|
|
|
2024-04-05 11:38:57 +02:00
|
|
|
opts = {
|
|
|
|
number = true;
|
|
|
|
relativenumber = true;
|
|
|
|
colorcolumn = "+1";
|
|
|
|
cursorline = true;
|
|
|
|
wrap = false;
|
|
|
|
splitright = true;
|
|
|
|
# Tabs & indentation
|
|
|
|
smarttab = true;
|
|
|
|
autoindent = true;
|
|
|
|
smartindent = true;
|
|
|
|
# Search path
|
|
|
|
path = ".,/usr/include,**";
|
|
|
|
wildmenu = true;
|
|
|
|
hlsearch = true;
|
|
|
|
incsearch = true;
|
|
|
|
ignorecase = true; # Search ignores cases
|
|
|
|
smartcase = true; # Unless it has a capital letter
|
|
|
|
# Enable local configuration :h 'exrc'
|
|
|
|
exrc = true; # safe since nvim 0.9
|
|
|
|
};
|
2024-05-04 20:57:33 +02:00
|
|
|
plugins = import ./plugins.nix {inherit lib pkgs;};
|
2024-03-03 15:20:42 +01:00
|
|
|
keymaps = import ./mappings.nix;
|
|
|
|
inherit (import ./augroups.nix) autoGroups autoCmd;
|
2024-05-04 20:57:33 +02:00
|
|
|
extraPlugins = let
|
2024-05-04 22:02:13 +02:00
|
|
|
plugins = pkgs.vimPlugins;
|
2024-05-04 20:57:33 +02:00
|
|
|
jjdescription = pkgs.callPackage ./vim-jjdescription.nix {};
|
2024-05-04 22:02:13 +02:00
|
|
|
in [
|
|
|
|
plugins.nui-nvim
|
|
|
|
plugins.nvim-web-devicons
|
|
|
|
jjdescription
|
|
|
|
];
|
2024-03-03 15:20:42 +01:00
|
|
|
# Formatting
|
2024-05-04 22:02:13 +02:00
|
|
|
extraPackages = [
|
|
|
|
pkgs.stylua
|
|
|
|
pkgs.shfmt
|
|
|
|
pkgs.taplo
|
|
|
|
pkgs.yamlfmt
|
|
|
|
pkgs.nixpkgs-fmt
|
|
|
|
pkgs.alejandra
|
|
|
|
pkgs.nixfmt-classic
|
|
|
|
pkgs.luajitPackages.jsregexp
|
2024-03-03 15:20:42 +01:00
|
|
|
];
|
|
|
|
extraConfigLuaPre = ''
|
|
|
|
-- Lua Pre Config
|
|
|
|
if vim.fn.has 'termguicolors' then
|
|
|
|
-- Enable RGB colors
|
|
|
|
vim.g.termguicolors = true
|
|
|
|
end
|
|
|
|
|
|
|
|
-- 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
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|