aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Igne <git@federicoigne.com>2023-02-22 10:45:51 +0100
committerFederico Igne <git@federicoigne.com>2023-02-22 10:45:51 +0100
commitaee25d39e76b04473b62befa6b537fa367b6a269 (patch)
tree21eef38f7ee02165fa452396ac726d385d11cd12
parent8c6b0f886359e8cf3d0b92eb5a55cffdd243b65d (diff)
downloaddotfiles-aee25d39e76b04473b62befa6b537fa367b6a269.tar.gz
dotfiles-aee25d39e76b04473b62befa6b537fa367b6a269.zip
[nvim] add experimental support for note resource folders in zettel
-rw-r--r--neovim/.config/nvim/lua/dyamon/zettel.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/neovim/.config/nvim/lua/dyamon/zettel.lua b/neovim/.config/nvim/lua/dyamon/zettel.lua
index daf3c6a..7a10da5 100644
--- a/neovim/.config/nvim/lua/dyamon/zettel.lua
+++ b/neovim/.config/nvim/lua/dyamon/zettel.lua
@@ -6,6 +6,7 @@
6local zettel = {} 6local zettel = {}
7 7
8local api = vim.api 8local api = vim.api
9local cmd = vim.cmd
9local exec = api.nvim_command 10local exec = api.nvim_command
10local base = vim.env.NOTES 11local base = vim.env.NOTES
11 12
@@ -189,6 +190,22 @@ function zettel.live_grep(mappings)
189 } 190 }
190end 191end
191 192
193--- Returns the path of the resource folder for the current zettel.
194function zettel.resources()
195 return 'resources/' .. vim.fn.expand('%:t:r') .. '/'
196end
197
198--- Opens the resource path in nnn.
199--
200-- It creates the necessary directory structure if necessary.
201function zettel.open_resources()
202 local dir = zettel.base .. '/' .. zettel.resources()
203 -- Create directory if not existent
204 vim.fn.system({'mkdir', '-p', dir})
205 -- Open resource directory in nnn
206 cmd.NnnPicker(dir)
207end
208
192--- Setup zettel-specific mappings and options. 209--- Setup zettel-specific mappings and options.
193function zettel.setup() 210function zettel.setup()
194 local map = require 'dyamon.util.map' 211 local map = require 'dyamon.util.map'