neovim: add extended obsidian plugin module
This commit is contained in:
parent
928db722b4
commit
acb87b6bb1
14 changed files with 139 additions and 34 deletions
|
|
@ -5,6 +5,5 @@
|
|||
./theme.nix
|
||||
./keymaps.nix
|
||||
./plugins
|
||||
./modules
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./plugins
|
||||
];
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./gruvbox-material
|
||||
./telescope
|
||||
./obsidian
|
||||
];
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkOption mkIf boolToString;
|
||||
inherit (lib.types) bool enum lines;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.gruvbox-material;
|
||||
in {
|
||||
options.vim.gruvbox-material = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
description = "Enable gruvbox-material-theme";
|
||||
default = false;
|
||||
};
|
||||
contrast = mkOption {
|
||||
type = enum ["dark" "medium" "soft"];
|
||||
description = "Set contrast, can be any of 'hard', 'medium', 'soft'";
|
||||
default = "dark";
|
||||
};
|
||||
italics = mkOption {
|
||||
type = bool;
|
||||
description = "Enable italic comments";
|
||||
default = true;
|
||||
};
|
||||
transparent = mkOption {
|
||||
type = bool;
|
||||
description = "Set background to transparent";
|
||||
default = false;
|
||||
};
|
||||
floatForceBackground = mkOption {
|
||||
type = bool;
|
||||
description = "Force backgrounds on floats even when transparent = true";
|
||||
default = false;
|
||||
};
|
||||
signsHighlight = mkOption {
|
||||
type = bool;
|
||||
description = "Enable sign highlighting";
|
||||
default = true;
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
type = lines;
|
||||
description = "Additional lua configuration after";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [pkgs.vimPlugins.gruvbox-material-nvim];
|
||||
luaConfigRC.theme =
|
||||
entryAfter ["basic"]
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
require('gruvbox-material').setup{
|
||||
contrast = "${cfg.contrast}",
|
||||
comments = {
|
||||
italics = ${boolToString cfg.italics},
|
||||
},
|
||||
background = {
|
||||
transparent = ${boolToString cfg.transparent},
|
||||
},
|
||||
float = {
|
||||
force_background = ${boolToString cfg.floatForceBackground},
|
||||
background_color = nil,
|
||||
},
|
||||
signs = {
|
||||
highlight = ${boolToString cfg.signsHighlight},
|
||||
},
|
||||
}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
inherit (options.vim.notes.obsidian) mappings;
|
||||
|
||||
cfg = config.vim.notes.obsidian;
|
||||
keys = cfg.mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
keymaps = [
|
||||
(mkKeymap "n" keys.openNote "<cmd>ObsidianOpen<CR>" {desc = mappings.openNote.description;})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./obsidian.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
in {
|
||||
options.vim.notes.obsidian = {
|
||||
mappings = {
|
||||
openNote = mkMappingOption "Open obsidian note" "<leader>oo";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkOption;
|
||||
inherit (lib.types) bool;
|
||||
inherit (inputs.nvf.lib.nvim.dag) entryAfter;
|
||||
cfg = config.vim.telescope;
|
||||
in {
|
||||
options.vim.telescope = {
|
||||
autostart = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Auto start telescope when opening neovim unless opening a file";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.autostart {
|
||||
vim.luaConfigRC.telescope-autostart =
|
||||
entryAfter ["pluginConfigs"]
|
||||
#lua
|
||||
''
|
||||
local find_files_hijack_netrw = vim.api.nvim_create_augroup("find_files_hijack_netrw", { clear = true })
|
||||
-- clear FileExplorer appropriately to prevent netrw from launching on folders
|
||||
-- netrw may or may not be loaded before telescope-find-files
|
||||
-- conceptual credits to nvim-tree and telescope-file-browser
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
pattern = "*",
|
||||
once = true,
|
||||
callback = function()
|
||||
pcall(vim.api.nvim_clear_autocmds, { group = "FileExplorer" })
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = find_files_hijack_netrw,
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
-- Early return if netrw or not a directory
|
||||
if vim.bo[0].filetype == "netrw" or vim.fn.isdirectory(vim.fn.expand("%:p")) == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_option(0, "bufhidden", "wipe")
|
||||
|
||||
require("telescope.builtin").find_files({
|
||||
cwd = vim.fn.expand("%:p:h"),
|
||||
})
|
||||
end)
|
||||
end,
|
||||
})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,10 +1,17 @@
|
|||
{
|
||||
vim = {
|
||||
notes = {
|
||||
obsidian = {
|
||||
obsidianExtended = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
dir = "~/Documents/notes";
|
||||
daily_notes = {
|
||||
folder = "~/Documents/notes/dailies";
|
||||
};
|
||||
templates = {
|
||||
folder = "~/Documents/notes/templates";
|
||||
};
|
||||
ui.enable = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue