refactor(nvim): move to homeManagerModules
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-22 02:48:41 -05:00
parent 303122dfc8
commit 11adcacd6f
35 changed files with 524 additions and 415 deletions

View file

@ -3,7 +3,6 @@
./bash ./bash
./direnv ./direnv
./git ./git
./neovim
./nix-index ./nix-index
./tmux ./tmux
]; ];

View file

@ -1,116 +0,0 @@
{
config,
pkgs,
...
}: {
imports = [
./git.nix
./langs
./theme.nix
./treesitter.nix
];
programs = {
neovim = {
enable = true;
extraLuaConfig =
# lua
''
-- by default, the indent is 2 spaces.
vim.opt.smartindent = true;
vim.opt.expandtab = true;
vim.opt.shiftwidth = 2;
vim.opt.softtabstop = 2;
vim.opt.tabstop = 2;
vim.opt.number = true;
vim.opt.relativenumber = true;
vim.opt.undofile = true;
vim.opt.undodir = '${config.xdg.cacheHome}/nvim/';
-- Always show the signcolumn, otherwise it would shift
-- the text each time diagnostics appear/become resolved
vim.opt.signcolumn = 'yes';
-- remove highlight on words
vim.keymap.set('n', '<esc>', ':noh<cr><esc>', {
noremap = true,
silent = true,
});
-- Get rid of deprecated messages
vim.tbl_add_reverse_lookup = function(tbl)
for k, v in pairs(tbl) do
tbl[v] = k;
end
end;
vim.tbl_islist = function(tbl)
return vim.islist(tbl);
end;
vim.diagnostic.is_disabled = function()
return not vim.diagnostic.is_enabled();
end;
vim.lsp.buf_get_clients = function()
return vim.lsp.get_clients();
end;
vim.lsp.get_active_clients = function()
return vim.lsp.get_clients();
end;
'';
plugins = [
pkgs.vimPlugins.fzfWrapper
pkgs.vimPlugins.fzf-vim
{
plugin = pkgs.vimPlugins.todo-comments-nvim;
type = "lua";
config =
# lua
''
require('todo-comments').setup();
'';
}
{
plugin = pkgs.vimPlugins.mini-nvim;
type = "lua";
config =
# lua
''
-- TODO: see how this works
local ts_input = require('mini.surround').gen_spec.input.treesitter;
require('mini.surround').setup({
custom_surroundings = {
-- Use tree-sitter to search for function call
f = {
input = ts_input({
outer = '@call.outer',
inner = '@call.inner',
});
},
},
});
'';
}
{
plugin = pkgs.vimPlugins.nvim-config-local;
type = "lua";
config =
# lua
''
require('config-local').setup({
config_files = { '.nvim.lua', '.nvimrc', '.exrc' },
-- Where the plugin keeps files data
hashfile = '${config.xdg.cacheHome}/nvim/config-local',
});
'';
}
];
};
};
}

View file

@ -1,31 +0,0 @@
{pkgs, ...}: {
programs = {
neovim = {
plugins = [
pkgs.vimPlugins.fugitive
{
plugin = pkgs.vimPlugins.gitsigns-nvim;
type = "lua";
config =
# lua
''
local gitsigns = require("gitsigns");
local function visual_stage()
local first_line = vim.fn.line('v');
local last_line = vim.fn.getpos('.')[2];
gitsigns.stage_hunk({ first_line, last_line });
end
vim.keymap.set("v", "gs", function()
visual_stage()
end);
gitsigns.setup();
'';
}
];
};
};
}

View file

@ -1,179 +0,0 @@
{
config,
pkgs,
lib,
nvim-theme-src,
...
}: let
inherit (lib) fileContents optionals;
inherit (config.vars) neovimIde;
in {
programs = {
neovim = {
extraPackages = builtins.attrValues {
inherit (pkgs) bat;
};
plugins =
[
{
plugin = pkgs.vimPlugins.dracula-nvim.overrideAttrs {
src = nvim-theme-src;
};
type = "lua";
config =
# lua
''
-- set dot icon in place of trailing whitespaces
vim.opt.listchars = {
tab = ' ',
trail = '',
extends = '',
precedes = '',
nbsp = '',
};
vim.opt.list = true;
-- Add visual indicator for trailing whitespaces
vim.opt.fillchars = { eob = " " };
vim.fn.matchadd('errorMsg', [[\s\+$]]);
vim.cmd.colorscheme('dracula');
'';
}
{
plugin = pkgs.vimPlugins.indent-blankline-nvim;
type = "lua";
config =
# lua
''
--
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
};
local hooks = require('ibl.hooks');
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" });
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" });
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" });
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" });
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" });
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" });
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" });
end);
require('ibl').setup({
indent = {
highlight = highlight,
char = "",
},
});
'';
}
{
plugin = pkgs.vimPlugins.nvim-highlight-colors;
type = "lua";
config =
# lua
''
-- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true;
require('nvim-highlight-colors').setup({});
'';
}
# Deps of heirline config
pkgs.vimPlugins.nvim-web-devicons
{
plugin = pkgs.vimPlugins.heirline-nvim;
type = "lua";
config = fileContents ./plugins/heirline.lua;
}
]
++ optionals neovimIde [
{
plugin = pkgs.vimPlugins.neo-tree-nvim;
type = "lua";
config = fileContents ./plugins/neotree.lua;
}
{
plugin = pkgs.vimPlugins.codewindow-nvim;
type = "lua";
config =
# lua
''
--
local codewindow = require('codewindow');
codewindow.setup({
auto_enable = false,
minimap_width = 8,
relative = 'editor',
window_border = 'none',
exclude_filetypes = { 'help' },
});
vim.api.nvim_create_autocmd({ 'VimEnter', 'VimResized' }, {
pattern = '*',
callback = function()
if vim.api.nvim_win_get_width(0) < 88 then
codewindow.close_minimap();
else
codewindow.open_minimap();
end
end,
});
'';
}
{
plugin = pkgs.vimPlugins.transparent-nvim;
type = "lua";
config =
# lua
''
require('transparent').setup({
groups = {
'Normal',
'NormalNC',
'Comment',
'Constant',
'Special',
'Identifier',
'Statement',
'PreProc',
'Type',
'Underlined',
'Todo',
'String',
'Function',
'Conditional',
'Repeat',
'Operator',
'Structure',
'LineNr',
'NonText',
'SignColumn',
'CursorLine',
'CursorLineNr',
'StatusLine',
'StatusLineNC',
'EndOfBuffer',
},
extra_groups = {},
exclude_groups = {},
});
'';
}
];
};
};
}

View file

@ -1,6 +1,7 @@
{ {
config, config,
lib, lib,
self,
... ...
}: { }: {
imports = [ imports = [
@ -41,6 +42,7 @@
} }
./home ./home
self.homeManagerModules.neovim
{ {
programs.bash.sessionVariables = { programs.bash.sessionVariables = {

View file

@ -39,11 +39,6 @@ in {
}; };
}; };
}; };
neovimIde = mkOption {
type = types.bool;
default = true;
};
}; };
config = { config = {

View file

@ -4,10 +4,7 @@
pkgs, pkgs,
... ...
}: { }: {
vars = { vars.mainUser = "nix-on-droid";
mainUser = "nix-on-droid";
neovimIde = false;
};
environment.variables.FLAKE = "/data/data/com.termux.nix/files/home/.nix"; environment.variables.FLAKE = "/data/data/com.termux.nix/files/home/.nix";

View file

@ -19,10 +19,23 @@ in {
self.nixosModules.server self.nixosModules.server
]; ];
home-manager.users.${mainUser}.imports = [ home-manager.users = rec {
root = {
imports = [
self.homeManagerModules.firefox self.homeManagerModules.firefox
self.homeManagerModules.neovim
]; ];
programs.neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};
${mainUser} = root;
};
# State Version: DO NOT CHANGE # State Version: DO NOT CHANGE
system.stateVersion = "23.11"; system.stateVersion = "23.11";

View file

@ -19,6 +19,22 @@ in {
self.nixosModules.server self.nixosModules.server
]; ];
home-manager.users = rec {
root = {
imports = [
self.homeManagerModules.neovim
];
programs.neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};
${mainUser} = root;
};
# State Version: DO NOT CHANGE # State Version: DO NOT CHANGE
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View file

@ -18,6 +18,22 @@ in {
self.nixosModules.server self.nixosModules.server
]; ];
home-manager.users = rec {
root = {
imports = [
self.homeManagerModules.neovim
];
programs.neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};
${mainUser} = root;
};
# State Version: DO NOT CHANGE # State Version: DO NOT CHANGE
system.stateVersion = "24.11"; system.stateVersion = "24.11";

View file

@ -18,6 +18,22 @@ in {
self.nixosModules.server self.nixosModules.server
]; ];
home-manager.users = rec {
root = {
imports = [
self.homeManagerModules.neovim
];
programs.neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};
${mainUser} = root;
};
# State Version: DO NOT CHANGE # State Version: DO NOT CHANGE
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View file

@ -18,6 +18,22 @@ in {
self.nixosModules.server self.nixosModules.server
]; ];
home-manager.users = rec {
root = {
imports = [
self.homeManagerModules.neovim
];
programs.neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};
${mainUser} = root;
};
# State Version: DO NOT CHANGE # State Version: DO NOT CHANGE
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View file

@ -22,10 +22,23 @@ in {
self.nixosModules.server self.nixosModules.server
]; ];
home-manager.users.${mainUser}.imports = [ home-manager.users = rec {
root = {
imports = [
self.homeManagerModules.firefox self.homeManagerModules.firefox
self.homeManagerModules.neovim
]; ];
programs.neovim = {
enable = true;
enableIde = true;
user = mainUser;
};
};
${mainUser} = root;
};
# State Version: DO NOT CHANGE # State Version: DO NOT CHANGE
system.stateVersion = "23.05"; system.stateVersion = "23.05";

View file

@ -1,3 +1,4 @@
self: { self: {
firefox = import ./firefox self; firefox = import ./firefox self;
neovim = import ./neovim self;
} }

View file

@ -0,0 +1,128 @@
self: {
config,
lib,
pkgs,
...
}: let
inherit (lib) mkOption types;
in {
imports = [
./git.nix
./treesitter.nix
(import ./langs self)
(import ./theme.nix self)
];
options.programs.neovim = {
user = mkOption {
type = types.str;
};
enableIde = mkOption {
type = types.bool;
default = false;
};
};
config.programs.neovim = {
extraLuaConfig =
# lua
''
-- by default, the indent is 2 spaces.
vim.opt.smartindent = true;
vim.opt.expandtab = true;
vim.opt.shiftwidth = 2;
vim.opt.softtabstop = 2;
vim.opt.tabstop = 2;
vim.opt.number = true;
vim.opt.relativenumber = true;
vim.opt.undofile = true;
vim.opt.undodir = '${config.xdg.cacheHome}/nvim/';
-- Always show the signcolumn, otherwise it would shift
-- the text each time diagnostics appear/become resolved
vim.opt.signcolumn = 'yes';
-- remove highlight on words
vim.keymap.set('n', '<esc>', ':noh<cr><esc>', {
noremap = true,
silent = true,
});
-- Get rid of deprecated messages
vim.tbl_add_reverse_lookup = function(tbl)
for k, v in pairs(tbl) do
tbl[v] = k;
end
end;
vim.tbl_islist = function(tbl)
return vim.islist(tbl);
end;
vim.diagnostic.is_disabled = function()
return not vim.diagnostic.is_enabled();
end;
vim.lsp.buf_get_clients = function()
return vim.lsp.get_clients();
end;
vim.lsp.get_active_clients = function()
return vim.lsp.get_clients();
end;
'';
plugins = [
pkgs.vimPlugins.fzfWrapper
pkgs.vimPlugins.fzf-vim
{
plugin = pkgs.vimPlugins.todo-comments-nvim;
type = "lua";
config =
# lua
''
require('todo-comments').setup();
'';
}
{
plugin = pkgs.vimPlugins.mini-nvim;
type = "lua";
config =
# lua
''
-- TODO: see how this works
local ts_input = require('mini.surround').gen_spec.input.treesitter;
require('mini.surround').setup({
custom_surroundings = {
-- Use tree-sitter to search for function call
f = {
input = ts_input({
outer = '@call.outer',
inner = '@call.inner',
});
},
},
});
'';
}
{
plugin = pkgs.vimPlugins.nvim-config-local;
type = "lua";
config =
# lua
''
require('config-local').setup({
config_files = { '.nvim.lua', '.nvimrc', '.exrc' },
-- Where the plugin keeps files data
hashfile = '${config.xdg.cacheHome}/nvim/config-local',
});
'';
}
];
};
# For accurate stack trace
_file = ./default.nix;
}

View file

@ -0,0 +1,27 @@
{pkgs, ...}: {
programs.neovim.plugins = [
pkgs.vimPlugins.fugitive
{
plugin = pkgs.vimPlugins.gitsigns-nvim;
type = "lua";
config =
# lua
''
local gitsigns = require("gitsigns");
local function visual_stage()
local first_line = vim.fn.line('v');
local last_line = vim.fn.getpos('.')[2];
gitsigns.stage_hunk({ first_line, last_line });
end
vim.keymap.set("v", "gs", function()
visual_stage()
end);
gitsigns.setup();
'';
}
];
}

View file

@ -1,13 +1,14 @@
{ {
config, config,
pkgs,
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib) getExe mkIf; inherit (lib) getExe mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in { in {
programs = { programs = mkIf cfg.enable {
# I love doing typos # I love doing typos
bash.shellAliases = { bash.shellAliases = {
nivm = "nvim"; nivm = "nvim";
@ -19,13 +20,13 @@ in {
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
extraPackages = mkIf neovimIde [ extraPackages = mkIf cfg.enableIde [
pkgs.nodePackages.bash-language-server pkgs.nodePackages.bash-language-server
pkgs.shellcheck pkgs.shellcheck
]; ];
extraLuaConfig = extraLuaConfig =
mkIf neovimIde mkIf cfg.enableIde
# lua # lua
'' ''
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {

View file

@ -1,13 +1,14 @@
{ {
config, config,
pkgs,
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in in
mkIf neovimIde { mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraPackages = builtins.attrValues { extraPackages = builtins.attrValues {

View file

@ -1,13 +1,14 @@
{ {
config, config,
pkgs,
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in in
mkIf neovimIde { mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraPackages = builtins.attrValues { extraPackages = builtins.attrValues {

View file

@ -1,11 +1,12 @@
{ self: {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) fileContents mkBefore mkIf; inherit (lib) fileContents mkBefore mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in { in {
imports = [ imports = [
./bash.nix ./bash.nix
@ -15,29 +16,19 @@ in {
./java.nix ./java.nix
./json.nix ./json.nix
./lua.nix ./lua.nix
./markdown.nix
./nix.nix
./python.nix ./python.nix
./rust.nix ./rust.nix
./web.nix (import ./markdown.nix self)
(import ./nix.nix self)
(import ./web.nix self)
]; ];
programs = mkIf neovimIde { config.programs = mkIf cfg.enableIde {
neovim = { neovim = {
extraLuaConfig = extraLuaConfig =
mkBefore mkBefore
# lua # lua
'' ''
-- Start completion / snippet stuff
vim.g.coq_settings = {
auto_start = 'shut-up',
keymap = {
recommended = false,
},
-- https://github.com/NixOS/nixpkgs/issues/168928#issuecomment-1109581739
xdg = true,
};
-- Add formatting cmd -- Add formatting cmd
vim.api.nvim_create_user_command( vim.api.nvim_create_user_command(
'Format', 'Format',
@ -101,4 +92,7 @@ in {
]; ];
}; };
}; };
# For accurate stack trace
_file = ./default.nix;
} }

View file

@ -4,9 +4,10 @@
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in in
mkIf neovimIde { mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraLuaConfig = extraLuaConfig =

View file

@ -5,12 +5,13 @@
... ...
}: let }: let
inherit (lib) getExe mkIf; inherit (lib) getExe mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
javaSdk = pkgs.temurin-bin-17; javaSdk = pkgs.temurin-bin-17;
javaPkgs = builtins.attrValues {inherit (pkgs) gradle maven;}; javaPkgs = builtins.attrValues {inherit (pkgs) gradle maven;};
in in
mkIf neovimIde { mkIf cfg.enableIde {
home.packages = javaPkgs; home.packages = javaPkgs;
xdg.dataFile.".gradle/gradle.properties".text = '' xdg.dataFile.".gradle/gradle.properties".text = ''

View file

@ -5,9 +5,10 @@
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in in
mkIf neovimIde { mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraPackages = builtins.attrValues { extraPackages = builtins.attrValues {

View file

@ -1,15 +1,16 @@
{ {
config, config,
pkgs,
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
flakeEnv = config.programs.bash.sessionVariables.FLAKE; flakeEnv = config.programs.bash.sessionVariables.FLAKE;
in in
mkIf neovimIde { mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraPackages = builtins.attrValues { extraPackages = builtins.attrValues {

View file

@ -1,17 +1,18 @@
{ self: {
config, config,
lib, lib,
pkgs, pkgs,
self, self,
vimplugin-easytables-src,
... ...
}: let }: let
inherit (lib) mkIf; inherit (self.inputs) vimplugin-easytables-src;
inherit (config.vars) neovimIde;
inherit (self.lib.${pkgs.system}) buildPlugin; inherit (self.lib.${pkgs.system}) buildPlugin;
in
mkIf neovimIde { inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraPackages = builtins.attrValues { extraPackages = builtins.attrValues {
@ -125,4 +126,8 @@ in
]; ];
}; };
}; };
};
# For accurate stack trace
_file = ./markdown.nix;
} }

View file

@ -1,30 +1,29 @@
{ self: {
config, config,
lib,
osConfig, osConfig,
pkgs, pkgs,
lib,
nixd,
self,
... ...
}: let }: let
inherit (lib) getExe hasPrefix mkIf removePrefix; inherit (lib) getExe hasPrefix mkIf removePrefix;
inherit (config.vars) mainUser neovimIde;
inherit (osConfig.networking) hostName; inherit (osConfig.networking) hostName;
cfg = config.programs.neovim;
defaultFormatter = self.formatter.${pkgs.system}; defaultFormatter = self.formatter.${pkgs.system};
nixdPkg = nixd.packages.${pkgs.system}.default; nixdPkg = self.inputs.nixd.packages.${pkgs.system}.default;
flakeEnv = config.programs.bash.sessionVariables.FLAKE; flakeEnv = config.programs.bash.sessionVariables.FLAKE;
flakeDir = "${removePrefix "/home/${mainUser}/" flakeEnv}"; flakeDir = "${removePrefix "/home/${cfg.user}/" flakeEnv}";
in in {
mkIf neovimIde { config = mkIf cfg.enableIde {
assertions = [ assertions = [
{ {
assertion = assertion =
neovimIde cfg.enableIde
&& hasPrefix "/home/${mainUser}/" flakeEnv && hasPrefix "/home/${cfg.user}/" flakeEnv
|| !neovimIde; || !cfg.enableIde;
message = '' message = ''
Your $FLAKE environment variable needs to point to a directory in Your $FLAKE environment variable needs to point to a directory in
the main users' home to use the neovim module. the main users' home to use the neovim module.
@ -74,4 +73,8 @@ in
''; '';
}; };
}; };
};
# For accurate stack trace
_file = ./nix.nix;
} }

View file

@ -5,9 +5,10 @@
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in in
mkIf neovimIde { mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
withPython3 = true; withPython3 = true;

View file

@ -1,16 +1,17 @@
{ {
config, config,
pkgs,
lib, lib,
pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) attrValues mkIf;
inherit (config.vars) neovimIde;
cfg = config.programs.neovim;
in in
mkIf neovimIde { mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
extraPackages = builtins.attrValues { extraPackages = attrValues {
inherit inherit
(pkgs) (pkgs)
cargo cargo

View file

@ -1,17 +1,17 @@
{ self: {
config, config,
lib, lib,
pkgs, pkgs,
self,
vimplugin-ts-error-translator-src,
... ...
}: let }: let
inherit (lib) mkIf; inherit (self.inputs) vimplugin-ts-error-translator-src;
inherit (config.vars) neovimIde;
inherit (self.lib.${pkgs.system}) buildPlugin; inherit (self.lib.${pkgs.system}) buildPlugin;
in
mkIf neovimIde { inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf cfg.enableIde {
programs = { programs = {
neovim = { neovim = {
withNodeJs = true; withNodeJs = true;
@ -197,4 +197,8 @@ in
]; ];
}; };
}; };
};
# For accurate stack trace
_file = ./web.nix;
} }

View file

@ -0,0 +1,181 @@
self: {
config,
pkgs,
lib,
...
}: let
inherit (self.inputs) nvim-theme-src;
inherit (lib) attrValues fileContents optionals;
cfg = config.programs.neovim;
in {
config.programs.neovim = {
extraPackages = attrValues {
inherit (pkgs) bat;
};
plugins =
[
{
plugin = pkgs.vimPlugins.dracula-nvim.overrideAttrs {
src = nvim-theme-src;
};
type = "lua";
config =
# lua
''
-- set dot icon in place of trailing whitespaces
vim.opt.listchars = {
tab = ' ',
trail = '',
extends = '',
precedes = '',
nbsp = '',
};
vim.opt.list = true;
-- Add visual indicator for trailing whitespaces
vim.opt.fillchars = { eob = " " };
vim.fn.matchadd('errorMsg', [[\s\+$]]);
vim.cmd.colorscheme('dracula');
'';
}
{
plugin = pkgs.vimPlugins.indent-blankline-nvim;
type = "lua";
config =
# lua
''
--
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
};
local hooks = require('ibl.hooks');
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" });
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" });
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" });
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" });
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" });
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" });
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" });
end);
require('ibl').setup({
indent = {
highlight = highlight,
char = "",
},
});
'';
}
{
plugin = pkgs.vimPlugins.nvim-highlight-colors;
type = "lua";
config =
# lua
''
-- Ensure termguicolors is enabled if not already
vim.opt.termguicolors = true;
require('nvim-highlight-colors').setup({});
'';
}
# Deps of heirline config
pkgs.vimPlugins.nvim-web-devicons
{
plugin = pkgs.vimPlugins.heirline-nvim;
type = "lua";
config = fileContents ./plugins/heirline.lua;
}
]
++ optionals cfg.enableIde [
{
plugin = pkgs.vimPlugins.neo-tree-nvim;
type = "lua";
config = fileContents ./plugins/neotree.lua;
}
{
plugin = pkgs.vimPlugins.codewindow-nvim;
type = "lua";
config =
# lua
''
--
local codewindow = require('codewindow');
codewindow.setup({
auto_enable = false,
minimap_width = 8,
relative = 'editor',
window_border = 'none',
exclude_filetypes = { 'help' },
});
vim.api.nvim_create_autocmd({ 'VimEnter', 'VimResized' }, {
pattern = '*',
callback = function()
if vim.api.nvim_win_get_width(0) < 88 then
codewindow.close_minimap();
else
codewindow.open_minimap();
end
end,
});
'';
}
{
plugin = pkgs.vimPlugins.transparent-nvim;
type = "lua";
config =
# lua
''
require('transparent').setup({
groups = {
'Normal',
'NormalNC',
'Comment',
'Constant',
'Special',
'Identifier',
'Statement',
'PreProc',
'Type',
'Underlined',
'Todo',
'String',
'Function',
'Conditional',
'Repeat',
'Operator',
'Structure',
'LineNr',
'NonText',
'SignColumn',
'CursorLine',
'CursorLineNr',
'StatusLine',
'StatusLineNC',
'EndOfBuffer',
},
extra_groups = {},
exclude_groups = {},
});
'';
}
];
};
# For accurate stack trace
_file = ./theme.nix;
}