configuration.nix/nvim/nixvim.nix

94 lines
2.6 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 {
flake.lock: Update Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/05e6ba83eb3585ce0aff7b41e4bd0e317d05ad4a?narHash=sha256-TnZETiQPXbyT5mdCHMOyrJnx2%2BBwroMBRrguciz1vEo%3D' (2024-05-26) → 'github:nix-community/home-manager/0eb314b4f0ba337e88123e0b1e57ef58346aafd9?narHash=sha256-HC5vJ3oYsjwsCaSbkIPv80e4ebJpNvFKQTBOGlHvjLs%3D' (2024-05-30) • Updated input 'lix': 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/5986a720d47041b79ead2d1f58a172f410d29db5.tar.gz?narHash=sha256-VXsSaj3athaUjgbX9bovTNhSOgevU%2B8qWx9pgaQePdE%3D' (2024-05-26) → 'https://git.lix.systems/api/v1/repos/lix-project/lix/archive/3df013597d7a2b5e400839e6625c05bd47de4dca.tar.gz?narHash=sha256-3sOBY0cNLgIFNk0YhBw%2Bkz57JLVphHTSypAKnkYz01g%3D' (2024-05-30) • Updated input 'lix-module': 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/18fa4a89e208cb8e881f5f71c75bbd4c1c2fd37d.tar.gz?narHash=sha256-fzY708SyfHwLOFrg5ZU0fXW9mNdvRvqz64jg97vvpJM%3D' (2024-05-23) → 'https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/b4b38e6b5fe18da9464f291ae5fbf2ea9acb9ccb.tar.gz?narHash=sha256-joKTxvywYlKspGGKOIXho6oRbggOPyayEqAyuZCavO0%3D' (2024-05-30) • Removed input 'neovim-flake' • Removed input 'neovim-src' • Updated input 'nixos-hardware': 'github:NixOS/nixos-hardware/2e7d6c568063c83355fe066b8a8917ee758de1b8?narHash=sha256-fe6Z33pbfqu4TI5ijmcaNc5vRBs633tyxJ12HTghy3w%3D' (2024-05-26) → 'github:NixOS/nixos-hardware/8251761f93d6f5b91cee45ac09edb6e382641009?narHash=sha256-uuEkErFVsFdg2K0cKbNQ9JlFSAm/xYqPr4rbPLI91Y8%3D' (2024-05-29) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/bfb7a882678e518398ce9a31a881538679f6f092?narHash=sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8%3D' (2024-05-24) → 'github:NixOS/nixpkgs/ad57eef4ef0659193044870c731987a6df5cf56b?narHash=sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs%3D' (2024-05-29) • Updated input 'nixvim': 'github:nix-community/nixvim/8212bf1cd2d2dfe6ba521dd8c65a13b67e562d1a?narHash=sha256-Zu0fn7bC%2BM/LwOOkR1RmeoOuCIbvvFwuqTldVBVe4WY%3D' (2024-05-26) → 'github:nix-community/nixvim/6ff3493c9bc85063ae829f0c25c21be3bde5c5b3?narHash=sha256-cKEGHGLaZoiNroMd34RrDgVDB7xgfff7HBShMz7cEy8%3D' (2024-05-30) • Added input 'nixvim/git-hooks': 'github:cachix/git-hooks.nix/0e8fcc54b842ad8428c9e705cb5994eaf05c26a0?narHash=sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA%3D' (2024-05-20) • Added input 'nixvim/git-hooks/flake-compat': 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04) • Added input 'nixvim/git-hooks/gitignore': 'github:hercules-ci/gitignore.nix/637db329424fd7e46cf4185293b9cc8c88c95394?narHash=sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs%3D' (2024-02-28) • Added input 'nixvim/git-hooks/gitignore/nixpkgs': follows 'nixvim/git-hooks/nixpkgs' • Added input 'nixvim/git-hooks/nixpkgs': follows 'nixvim/nixpkgs' • Added input 'nixvim/git-hooks/nixpkgs-stable': follows 'nixvim/nixpkgs' • Removed input 'nixvim/pre-commit-hooks' • Updated input 'stylix': 'github:jalil-salame/stylix/e5a4701b7d96c4909105a4c2366e4af3f188f802?narHash=sha256-u8enWMWhynbYlEFuVtTghwk1%2BLu8iT4tBoVWZxWCe/g%3D' (2024-05-24) → 'github:jalil-salame/stylix/036128f2517b1ff7d33d04773f48ea98d680128f?narHash=sha256-5ZHVsIg5akOIWImypmQMX/fXZZf3/7tzqJICLteFGZc%3D' (2024-05-27)
2024-05-31 06:28:46 +02:00
# package = pkgs.neovim;
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;};
keymaps = import ./mappings.nix;
inherit (import ./augroups.nix) autoGroups autoCmd;
2024-05-04 20:57:33 +02:00
extraPlugins = let
plugins = pkgs.vimPlugins;
2024-05-04 20:57:33 +02:00
jjdescription = pkgs.callPackage ./vim-jjdescription.nix {};
in [
plugins.nui-nvim
plugins.nvim-web-devicons
jjdescription
];
# Formatting
extraPackages = [
pkgs.stylua
pkgs.shfmt
pkgs.taplo
pkgs.yamlfmt
pkgs.nixpkgs-fmt
pkgs.alejandra
pkgs.nixfmt-classic
pkgs.luajitPackages.jsregexp
];
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
'';
})
];
}