yank notelink

This commit is contained in:
Rene Schallner
2021-11-22 12:24:18 +01:00
parent bc8776cf9e
commit 3d0533ba73
3 changed files with 17 additions and 1 deletions

View File

@@ -1,9 +1,10 @@
# Backlog # Backlog
- extend markdown syntax highlights for [[links]]
- maybe choose template in create note - maybe choose template in create note
## Dones ## Dones
- [x] yank notelink
- [x] extend markdown syntax highlights for [[links]]
- [x] avoid creating new note in home dir when following link to daily or weekly - [x] avoid creating new note in home dir when following link to daily or weekly
- [x] get rid of `daily_finder.sh` - [x] get rid of `daily_finder.sh`
- [x] find weekly note - [x] find weekly note

View File

@@ -101,6 +101,7 @@ The plugin defines the following functions.
- `search_notes()`: live grep for word under cursor in all notes (search in notes), via Telescope - `search_notes()`: live grep for word under cursor in all notes (search in notes), via Telescope
- `insert_link()` : select a note by name, via Telescope, and place a `[[link]]` at the current cursor position - `insert_link()` : select a note by name, via Telescope, and place a `[[link]]` at the current cursor position
- `follow_link()`: take text between brackets (linked note) and open a Telescope file finder with it: selects note to open (incl. preview) - with optional note creation for non-existing notes, honoring the configured template - `follow_link()`: take text between brackets (linked note) and open a Telescope file finder with it: selects note to open (incl. preview) - with optional note creation for non-existing notes, honoring the configured template
- `yank_notelink` : yank a link to the current note, ready to paste
- `setup(opts)`: used for configuring paths, file extension, etc. - `setup(opts)`: used for configuring paths, file extension, etc.
To use one of the functions above, just run them with the `:lua ...` command. To use one of the functions above, just run them with the `:lua ...` command.

View File

@@ -193,6 +193,19 @@ FollowLink = function(opts)
end end
--
-- YankLink:
-- -----------
--
-- Create and yank a [[link]] from the current note.
--
YankLink = function()
local title = '[[' .. path_to_linkname(vim.fn.expand('%')) .. ']]'
vim.fn.setreg('"', title)
print('yanked ' .. title)
end
-- --
-- GotoToday: -- GotoToday:
-- ---------- -- ----------
@@ -335,6 +348,7 @@ local M = {
new_note = CreateNote, new_note = CreateNote,
goto_thisweek = GotoThisWeek, goto_thisweek = GotoThisWeek,
find_weekly_notes = FindWeeklyNotes, find_weekly_notes = FindWeeklyNotes,
yank_notelink = YankLink,
} }
return M return M