You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got an idea that i could try to create null-ls custom code action to create new notes, but i'm failing on execution.
This is my pseudo-code:
localnull_ls=require("null-ls")
localzk_custom_actions= {
method=null_ls.methods.CODE_ACTION,
filetypes= { "markdown" }, -- or even custom `markdown.zk` filetypegenerator= {
fn=function(context)
-- print(vim.inspect(context))if'[[pre-link]]' then-- some more advanced conditionreturn {
{
title="Create new note from default template",
action=function()
-- Get the position, text, etc. of "pre-link". Mby `v2a[` ?-- Execute `ZkNew` custom command-- Prompt for new note title-- Put the "pre-link" text as new note title placeholder-- Create new note-- Get the link of the new note-- Replace [[pre-link]] with [new note title](link-of-new-note.md)-- End of my fancy logicend
}
}
endend
}
}
null_ls.register(zk_custom_actions)
I am failing to figure out, how to select [[pre-link]] (wikilink) text node.
In TSPlayground all I get is this which does not look too promising:
Should i go some fancy regex way, or to try extend upstream markdown parser?
My general idea is to enable custom code action on [[pre-link]] node:
Some [[pre-link]] in the markdown text.
I want to select code action to create a new note with that or some other title and automatically replace that [[pre-link]] with [Pre-link](202301081246.md). Then i can just hit <cr> and go into that note.
I don't use vimwiki links because those does not play well with other tooling.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I got an idea that i could try to create
null-ls
custom code action to create new notes, but i'm failing on execution.This is my pseudo-code:
I am failing to figure out, how to select
[[pre-link]]
(wikilink) text node.In
TSPlayground
all I get is this which does not look too promising:Should i go some fancy regex way, or to try extend upstream markdown parser?
My general idea is to enable custom code action on
[[pre-link]]
node:I want to select code action to create a new note with that or some other title and automatically replace that
[[pre-link]]
with[Pre-link](202301081246.md)
. Then i can just hit<cr>
and go into that note.I don't use vimwiki links because those does not play well with other tooling.
Or maybe this whole idea of mine is trash?
Beta Was this translation helpful? Give feedback.
All reactions