mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
feat: use nixvim for manpager definition
This commit is contained in:
parent
cc04e10405
commit
c037780743
8 changed files with 78 additions and 141 deletions
65
users/modules/config/manpager.nix
Normal file
65
users/modules/config/manpager.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.sessionVariables.MANPAGER = lib.getExe (pkgs.nixvim.makeNixvim {
|
||||
package = pkgs.neovim-clean;
|
||||
|
||||
options = {
|
||||
buftype = "nowrite";
|
||||
backup = false;
|
||||
modeline = false;
|
||||
shelltemp = false;
|
||||
swapfile = false;
|
||||
undofile = false;
|
||||
writebackup = false;
|
||||
virtualedit = "all";
|
||||
splitkeep = "screen";
|
||||
termguicolors = false;
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
vim.opt.shadafile = vim.fn.stdpath "state" .. "/shada/man.shada";
|
||||
'';
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
action = "<C-]>";
|
||||
key = "<CR>";
|
||||
mode = ["n"];
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Jump to tag under cursor";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = ":pop<CR>";
|
||||
key = "<BS>";
|
||||
mode = ["n"];
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Jump to previous tag in stack";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = ":pop<CR>";
|
||||
key = "<C-Left>";
|
||||
mode = ["n"];
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Jump to previous tag in stack";
|
||||
};
|
||||
}
|
||||
{
|
||||
action = ":tag<CR>";
|
||||
key = "<C-Right>";
|
||||
mode = ["n"];
|
||||
options = {
|
||||
silent = true;
|
||||
desc = "Jump to next tag in stack";
|
||||
};
|
||||
}
|
||||
];
|
||||
});
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{pkgs, ...}: let
|
||||
nvimPager = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped nvimConfig;
|
||||
nvimConfig =
|
||||
pkgs.neovimUtils.makeNeovimConfig {
|
||||
wrapRc = false;
|
||||
withPython3 = false;
|
||||
withRuby = false;
|
||||
}
|
||||
// {
|
||||
wrapperArgs = ["--add-flags" "--clean -u ${./init.lua}"];
|
||||
};
|
||||
in {
|
||||
home.sessionVariables.MANPAGER = "${nvimPager}/bin/nvim '+Man!'";
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
vim.opt.buftype = "nowrite"
|
||||
vim.opt.backup = false
|
||||
vim.opt.modeline = false
|
||||
vim.opt.shelltemp = false
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.undofile = false
|
||||
vim.opt.writebackup = false
|
||||
vim.opt.shadafile = vim.fn.stdpath "state" .. "/shada/man.shada"
|
||||
vim.opt.virtualedit = "all"
|
||||
vim.opt.splitkeep = "screen"
|
||||
-- Make sure to use ANSI colors
|
||||
vim.opt.termguicolors = false
|
||||
|
||||
vim.keymap.set("n", "<CR>", "<C-]>", { silent = true, desc = "Jump to tag under cursor" })
|
||||
vim.keymap.set("n", "<BS>", ":pop<CR>", { silent = true, desc = "Jump to previous tag in stack" })
|
||||
vim.keymap.set("n", "<C-Left>", ":pop<CR>", { silent = true, desc = "Jump to previous tag in stack" })
|
||||
vim.keymap.set("n", "<C-Right>", ":tag<CR>", { silent = true, desc = "Jump to next tag in stack" })
|
|
@ -1,6 +1,4 @@
|
|||
{
|
||||
programs.neovim-custom.enable = true;
|
||||
|
||||
home.persistence."/state".directories = [
|
||||
".local/share/nvim"
|
||||
".local/state/nvim"
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
imports = [
|
||||
./uid.nix
|
||||
./secrets.nix
|
||||
./neovim.nix
|
||||
|
||||
./config/htop.nix
|
||||
./config/impermanence.nix
|
||||
./config/manpager
|
||||
./config/manpager.nix
|
||||
./config/neovim.nix
|
||||
./config/shell
|
||||
./config/utils.nix
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
concatMapStrings
|
||||
flip
|
||||
mkEnableOption
|
||||
mkIf
|
||||
mkOption
|
||||
mkPackageOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.programs.neovim-custom;
|
||||
|
||||
initLuaContent = ''
|
||||
${cfg.initEarly}
|
||||
|
||||
-- Begin plugin configuration
|
||||
${concatMapStrings (x: "${x.config}\n") (cfg.config.plugins or [])}
|
||||
-- End plugin configuration
|
||||
|
||||
${cfg.init}
|
||||
'';
|
||||
|
||||
nvimConfig =
|
||||
pkgs.neovimUtils.makeNeovimConfig cfg.config
|
||||
// {
|
||||
wrapRc = false;
|
||||
wrapperArgs = ["--add-flags" "-u ${pkgs.writeText "init.lua" initLuaContent}"];
|
||||
};
|
||||
|
||||
finalPackage =
|
||||
flip pkgs.wrapNeovimUnstable nvimConfig
|
||||
(cfg.package.overrideAttrs (_final: prev: {
|
||||
nativeBuildInputs = (prev.nativeBuildInputs or []) ++ [pkgs.makeWrapper];
|
||||
postInstall =
|
||||
(prev.postInstall or "")
|
||||
+ ''
|
||||
wrapProgram $out/bin/nvim --add-flags "--clean"
|
||||
'';
|
||||
}));
|
||||
in {
|
||||
options.programs.neovim-custom = {
|
||||
enable = mkEnableOption "Neovim";
|
||||
package = mkPackageOption pkgs "neovim-unwrapped" {};
|
||||
config = mkOption {
|
||||
description = "The neovim configuration to use (passed to makeNeovimConfig and then to wrapNeovimUnstable)";
|
||||
default = {};
|
||||
type = types.anything;
|
||||
};
|
||||
initEarly = mkOption {
|
||||
description = "The early init.lua content that will be added before plugin configs.";
|
||||
default = "";
|
||||
type = types.lines;
|
||||
};
|
||||
init = mkOption {
|
||||
description = "The init.lua content, added after plugin configs.";
|
||||
default = "";
|
||||
type = types.lines;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
# XXX: TODO packages = [finalPackage];
|
||||
shellAliases.E = "${finalPackage}/bin/nvim";
|
||||
sessionVariables.EDITOR = "nvim";
|
||||
shellAliases.vimdiff = "nvim -d";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue