Skip to content

Commit

Permalink
Feat(obsidian) add obsidian nvim to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Gako358 committed Oct 25, 2024
1 parent c2a0e40 commit a8bb215
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 1 deletion.
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
flake = false;
};

# Notes
plugins-obsidian = {
url = "github:epwalsh/obsidian.nvim";
flake = false;
};

# Visuals
plugins-nvim-autopairs = {
url = "github:windwp/nvim-autopairs";
Expand Down Expand Up @@ -299,6 +305,7 @@
ui.enable = true;
};
vim.undo.enable = true;
vim.note.enable = true;
vim.visuals = {
enable = true;
autopairs.enable = true;
Expand Down
1 change: 1 addition & 0 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
./keys
./languages
./lsp
./note
./snippets
./telescope
./treesitter
Expand Down
73 changes: 73 additions & 0 deletions modules/note/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.note;
in {
options.vim.note = {
enable = mkEnableOption "enable note taking in nvim";
};

config = mkIf (cfg.enable) {
vim.startPlugins = [
"obsidian"
];

vim.luaConfigRC.sql =
nvim.dag.entryAnywhere
/*
lua
*/
''
vim.api.nvim_set_keymap('n', '<leader>on', '<cmd>ObsidianNew<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>of', '<cmd>ObsidianSearch<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>ow', '<cmd>ObsidianWorkspace<CR>', { noremap = true, silent = true })
require("obsidian").setup({
workspaces = {
{
name = "personal",
path = "~/Documents/notes/private",
},
{
name = "work",
path = "~/Documents/notes/work",
},
},
completion = {
nvim_cmp = true,
min_chars = 2,
},
mappings = {
["<leader>oc"] = {
action = function()
return require("obsidian").util.toggle_checkbox()
end,
opts = { buffer = true },
},
["<os>"] = {
action = function()
return require("obsidian").util.smart_action()
end,
opts = { buffer = true, expr = true },
}
},
preferred_link_style = "wiki",
picker = {
name = "telescope.nvim",
note_mappings = {
new = "<C-x>",
insert_link = "<C-l>",
},
tag_mappings = {
tag_note = "<C-x>",
insert_tag = "<C-l>",
},
},
})
'';
};
}
3 changes: 2 additions & 1 deletion modules/treesitter/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
pkgs,
config,
lib,
...
Expand Down Expand Up @@ -44,6 +43,8 @@ in {
lua
*/
''
vim.opt.conceallevel = 2
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
Expand Down

0 comments on commit a8bb215

Please sign in to comment.