Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Jan 8, 2024
1 parent 2058508 commit 211c684
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
4 changes: 3 additions & 1 deletion lua/config/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ end
--add your own here if you want them to
--show up in the popup as well
wk.register({
n = {
name = 'notes (obsidian)',
},
c = {
name = "code",
c = { ":SlimeConfig<cr>", "slime config" },
Expand Down Expand Up @@ -251,7 +254,6 @@ wk.register({
}, { mode = "n", prefix = "<leader>" })


-- n = { "<cmd>ObsidianQuickSwitch<cr>", "notes" },

local is_code_chunk = function()
local current, range = require("otter.keeper").get_current_language_context()
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/quarto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ return {
-- otherwise only the autocommand of lspconfig that attaches
-- the language server will be executed without setting the filetype
set_filetype = true,
write_to_disk = true,
write_to_disk = false,
},
},
},
Expand Down
42 changes: 36 additions & 6 deletions lua/plugins/specific.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,26 @@ return {
-- },
{
"epwalsh/obsidian.nvim",
-- n = { "<cmd>ObsidianQuickSwitch<cr>", "notes" },
ft = "markdown",
event = {
-- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
"BufReadPre " .. vim.fn.expand"~/notes/**/*.md",
"BufNewFile " .. vim.fn.expand"~/notes/**/*.md",
"BufReadPre " .. vim.fn.expand "~/notes/**/*.md",
"BufNewFile " .. vim.fn.expand "~/notes/**/*.md",
},
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",

},
keys = {
{ "<leader>nd", ':ObsidianToday<cr>', "obsidian daily" },
{ "<leader>nt", ':ObsidianTomorrow<cr>', "obsidian tomorrow" },
{ "<leader>ny", ':ObsidianYesterday<cr>', "obsidian yesterday" },
{ "<leader>nb", ':ObsidianBacklinks<cr>', "obsidian backlinks" },
{ "<leader>nl", ':ObsidianLink<cr>', "obsidian link selection" },
{ "<leader>nf", ':ObsidianFollowLink<cr>', "obsidian follow link" },
{ "<leader>nn", ':ObsidianNew<cr>', "obsidian new" },
{ "<leader>ns", ':ObsidianSearch<cr>', "obsidian search" },
{ "<leader>no", ':ObsidianQuickSwitch<cr>', "obsidian quickswitch" },
},
opts = {
workspaces = {
Expand All @@ -32,6 +40,28 @@ return {
path = "~/notes",
},
},
},
mappings = {
-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
["gf"] = {
action = function()
return require("obsidian").util.gf_passthrough()
end,
opts = { noremap = false, expr = true, buffer = true },
},
-- create and toggle checkboxes
["<cr>"] = {
action = function()
local line = vim.api.nvim_get_current_line()
if line:match("%s*- %[") then
require("obsidian").util.toggle_checkbox()
elseif line:match("%s*-") then
vim.cmd [[s/-/- [ ]/]]
vim.cmd.nohlsearch()
end
end,
opts = { buffer = true },
},
},
}
}
}

0 comments on commit 211c684

Please sign in to comment.