configuration.nix/nvim/nixvim.nix

94 lines
2.7 KiB
Nix
Raw Normal View History

{
pkgs,
lib,
config,
...
2024-05-04 20:57:33 +02:00
} @ args: let
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];
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;})
(lib.mkIf cfg.enable {
package = pkgs.unstable.neovim-unwrapped;
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
};
plugins = import ./plugins.nix {inherit lib;};
keymaps = import ./mappings.nix;
inherit (import ./augroups.nix) autoGroups autoCmd;
2024-05-04 20:57:33 +02:00
extraPlugins = let
plugins = pkgs.unstable.vimPlugins;
jjdescription = pkgs.unstable.callPackage ./vim-jjdescription.nix {};
in [
plugins.nui-nvim
plugins.nvim-web-devicons
jjdescription
];
2024-06-01 16:24:05 +02:00
# Formatting & linters
extraPackages = [
2024-06-01 16:24:05 +02:00
pkgs.unstable.alejandra
pkgs.unstable.luajitPackages.jsregexp
pkgs.unstable.statix
pkgs.unstable.stylua
pkgs.unstable.shfmt
pkgs.unstable.taplo
2024-06-01 16:24:05 +02:00
pkgs.unstable.typos
pkgs.unstable.yamlfmt
];
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
'';
})
];
}