From 9be6f7a8b6cf2c53b65d578eaeb17a344262dca2 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Thu, 9 Dec 2021 06:16:24 +0100 Subject: [PATCH] u r + h --- README.md | 20 ++++++++++------ doc/telekasten.txt | 57 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 766bb10..c355b48 100644 --- a/README.md +++ b/README.md @@ -228,7 +228,10 @@ require('telekasten').setup({ insert_after_inserting = true, -- make syntax available to markdown buffers and telescope previewers - install_syntax = true + install_syntax = true, + + -- tag notation: '#tag', ':tag:', 'yaml-bare' + tag_notation = "#tag", }) END @@ -259,10 +262,13 @@ END | `close_after_yanking` | close telescope preview after yanking via ctrly| false | | `insert_after_inserting` | enter insert mode after inserting a link from a telescope picker via ctrli| true | | `install_syntax` | if `true`, telekasten's syntax for links, tags, etc. will be used for markdown files, also in telescope previewers. Your configured markdown syntax will be inherited, though. | true | +| `tag_notation` | the tag style you want to use| `#tag` | +| | - `#tag` | | +| | - `:tag:` | | +| | - `yaml-bare` | | +| | see [2.1 Tag notation](#21-tag-notation)| | -**Please note:** If you do not want to use a template, set its associated option to `nil` or remove it from your config. - The calendar support has its own options, contained in `calendar_opts`: | calendar setting | description | example | @@ -288,7 +294,7 @@ Telekasten.nvim allows you to color your `[[links]]` and `#tags` by providing th - `tkHighlight` : ==highlighted== text (non-standard markdown) - `tkTag` : well, tags -`tkHighlight`, has nothing to do with links but I added it anyway, since I like highlighting text when +`tkHighlight` has nothing to do with links but I added it anyway, since I like highlighting text when taking notes 😄. I also like the navigation buttons of the calendar to appear less prevalent, so I also redefine the `CalNavi` class. @@ -354,7 +360,7 @@ The plugin defines the following functions: - this function accepts a parameter `{i}`. If `true`, it will enter input mode by pressing the 'A' key. This is useful when being used in a simple `inoremap` key mapping like shown in [Bind it](#3-bind-it). - example: `insert_link({ i=true })` -- `follow_link()`: take text between brackets (linked note) and open a Telescope file finder with it: selects note to +- `follow_link()`: take text between brackets (linked note) or of a tag 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 - **note**: - notes linked to with headings or paragraph IDs **will not be created automatically**. See below for link notation. @@ -380,7 +386,7 @@ The plugin defines the following functions: - `preview_img()` : uses the `telescope-media-files.nvim` extension to preview the image / media file under the cursor of a markdown image link: `![](path/to/img.png)`. The cursor must be between `(the two parenthesis)`. - **note**: this requires the `telescope-media-files.nvim` plugin to be installed. -- `browse_media()` : uses the `telescope-media-files.nvim` extension to preview the image / media files +- `browse_media()` : uses the `telescope-media-files.nvim` extension to preview the image / media file linked to under the cursor. - **note**: this requires the `telescope-media-files.nvim` plugin to be installed. - `setup(opts)`: used for configuring paths, file extension, etc. @@ -453,7 +459,7 @@ Telekasten supports the following tag notations: 1. `#tag` 2. `:tag:` -3. bare tags in a tag collection in the yaml metadata: +3. `yaml-bare`: bare tags in a tag collection in the yaml metadata: ```yaml --- diff --git a/doc/telekasten.txt b/doc/telekasten.txt index 902bca7..142282c 100644 --- a/doc/telekasten.txt +++ b/doc/telekasten.txt @@ -110,10 +110,15 @@ telekasten.setup({opts}) -- make syntax available to markdown buffers and telescope previewers install_syntax = true, + + -- tag notation: '#tag', ':tag:', 'yaml-bare' + tag_notation = "#tag", } < + --------------------- Valid keys for {opts} + --------------------- *telekasten.settings.home* home: ~ @@ -210,13 +215,31 @@ telekasten.setup({opts}) Default: `nil` Example: `'~/zettelkasten/templates/daily.md'` + *telekasten.settings.install_syntax* install_syntax:~ If `true`, telekasten's syntax for links, tags, etc. will be used for markdown files, also in telescope previewers. Your configured markdown syntax will be inherited, though. + Default: `true` + *telekasten.settings.tag_notation* + tag_notation:~ + The tag style you want to use. + + Valid options are: + - `'#tag'` + - `':tag:'` + - `'yaml-bare'` + + Default: `#tag` + + See |telekasten.tag_notation| for more information. + + *telekasten.calendar_opts* + ----------------------------------- Valid keys for {opts.calendar_opts} + ----------------------------------- *telekasten.calendar_opts.weeknm* weeknm: ~ @@ -262,9 +285,13 @@ groups: - `tkLink` : the link title inside the brackets - `tkBrackets` : the brackets surrounding the link title - `tkHighlight` : ==highlighted== text (non-standard markdown) +- `tkTag` : well, tags -The last one, `tkHighlight`, has nothing to do with links but I added it -anyway, since I like highlighting text when taking notes. +`tkHighlight`, has nothing to do with links but I added it anyway, since I like +highlighting text when taking notes. + +I also like the navigation buttons of the calendar to appear less prevalent, so +I redefine the `CalNavi` class as well. You can assign colors to the new syntax groups in your `init.vim`: > @@ -279,8 +306,13 @@ You can assign colors to the new syntax groups in your `init.vim`: " highlight ==highlighted== text hi tkHighlight ctermbg=yellow ctermfg=darkred cterm=bold -< + " colors for tags: + hi tkTag ctermfg=175 + " tag separator is only relevant in the following syntax: + " tags: [ tag1, tag2, tag3 ] + hi tkTagSep ctermfg=gray +< ================================================================================ Section 3: Usage *telekasten.usage* @@ -407,8 +439,8 @@ telekasten.insert_link({opts})~ *telekasten.follow_link()* telekasten.insert_link()~ - Take the text between the brackets of a link, pointing to a linked note, and - open a Telescope file finder with it. + Take the text between the brackets of a link pointing to a linked note, or + of a tag and open a Telescope file finder with it. If the linked note does not exist and the setting `follow_creates_nonexisting` is set to `true`, a new note will be created @@ -478,6 +510,14 @@ telekasten.preview_img()~ file under the cursor of a markdown image link: `![](path/to/img.png)`. The cursor must be between `(the two parenthesis)`. + Note:~ + This requires the `telescope-media-files.nvim` plugin to be installed. + + *telekasten.browse_media()* +telekasten.browse_media()~ + Uses the `telescope-media-files.nvim` extension to preview the image / media + file under the cursor. + Note:~ This requires the `telescope-media-files.nvim` plugin to be installed. @@ -515,15 +555,16 @@ Optionally, notes can live in specific sub-directories: with id ^xxxxxxxx within the note named 'A cool title' in some/subdirectory +Note that notes linked to with headings or paragraph IDs **will not be created +automatically**. Non-existing notes will be ignored in this case, a global +telescope search wil be performed instead. + Media links~ Use these for images, PDF files, videos. If telescope-media-files is installed, these can be previewed. `![optional title](path/to/file)` ... links to the file `path/to/file` -Note that notes linked to with headings or paragraph IDs **will not be created -automatically**. - -------------------------------------------------------------------------------- Section 3.2: Tag Notation *telekasten.tag_notation*