auto_set_synax. closes #208

This commit is contained in:
Rene Schallner
2023-01-25 20:25:17 +01:00
parent cfa3c6e038
commit db45a161ad
3 changed files with 55 additions and 35 deletions

View File

@@ -87,32 +87,32 @@ of being able to edit it.
<!-- vim-markdown-toc GFM -->
- [0. Install and setup](#0-install-and-setup)
- [0.0 Prerequisites](#00-prerequisites)
- [0.0.1 Telescope](#001-telescope)
- [0.0.2 calendar-vim Plugin (optional)](#002-calendar-vim-plugin-optional)
- [0.0.3 For pasting images: xclip (optional), wl-clipboard (optional)](#003-for-pasting-images-xclip-optional-wl-clipboard-optional)
- [0.0.4 For image previews: telescope-media-files.nvim (optional)](#004-for-image-previews-telescope-media-filesnvim-optional)
- [catimg](#catimg)
- [viu](#viu)
- [telescope-media-files.nvim](#telescope-media-filesnvim)
- [0.1 Install the plugin](#01-install-the-plugin)
- [0.1.0 Other useful plugins](#010-other-useful-plugins)
- [0.2 Configure telekasten.nvim](#02-configure-telekastennvim)
- [0.3 Configure your own colors](#03-configure-your-own-colors)
- [1. Get Help](#1-get-help)
- [2. Use it](#2-use-it)
- [2.0 Telekasten command](#20-telekasten-command)
- [2.1 Telekasten command palette](#21-telekasten-command-palette)
- [2.2 Telekasten lua functions](#22-telekasten-lua-functions)
- [2.3 Link notation](#23-link-notation)
- [2.4 Tag notation](#24-tag-notation)
- [2.5 Note templates](#25-note-templates)
- [2.5.1 Template files](#251-template-files)
- [2.6 Using the calendar](#26-using-the-calendar)
- [2.7 Using the telescope pickers](#27-using-the-telescope-pickers)
- [3. Bind it](#3-bind-it)
- [4. The hardcoded stuff](#4-the-hardcoded-stuff)
* [0. Install and setup](#0-install-and-setup)
* [0.0 Prerequisites](#00-prerequisites)
* [0.0.1 Telescope](#001-telescope)
* [0.0.2 calendar-vim Plugin (optional)](#002-calendar-vim-plugin-optional)
* [0.0.3 For pasting images: xclip (optional), wl-clipboard (optional)](#003-for-pasting-images-xclip-optional-wl-clipboard-optional)
* [0.0.4 For image previews: telescope-media-files.nvim (optional)](#004-for-image-previews-telescope-media-filesnvim-optional)
* [catimg](#catimg)
* [viu](#viu)
* [telescope-media-files.nvim](#telescope-media-filesnvim)
* [0.1 Install the plugin](#01-install-the-plugin)
* [0.1.0 Other useful plugins](#010-other-useful-plugins)
* [0.2 Configure telekasten.nvim](#02-configure-telekastennvim)
* [0.3 Configure your own colors](#03-configure-your-own-colors)
* [1. Get Help](#1-get-help)
* [2. Use it](#2-use-it)
* [2.0 Telekasten command](#20-telekasten-command)
* [2.1 Telekasten command palette](#21-telekasten-command-palette)
* [2.2 Telekasten lua functions](#22-telekasten-lua-functions)
* [2.3 Link notation](#23-link-notation)
* [2.4 Tag notation](#24-tag-notation)
* [2.5 Note templates](#25-note-templates)
* [2.5.1 Template files](#251-template-files)
* [2.6 Using the calendar](#26-using-the-calendar)
* [2.7 Using the telescope pickers](#27-using-the-telescope-pickers)
* [3. Bind it](#3-bind-it)
* [4. The hardcoded stuff](#4-the-hardcoded-stuff)
<!-- vim-markdown-toc -->
@@ -258,6 +258,11 @@ require('telekasten').setup({
-- and thus the telekasten syntax will not be loaded either
auto_set_filetype = true,
-- auto-set telekasten syntax: if false, the telekasten syntax will not be used
-- this syntax setting is independent from auto-set filetype
auto_set_syntax = true,
-- dir names for special notes (absolute path or subdir name)
dailies = home .. '/' .. 'daily',
weeklies = home .. '/' .. 'weekly',
@@ -448,7 +453,8 @@ END
| | - `dropdown`: floating popup window ||
| | - `get_cursor`: floating popup window at cursor position ||
| `subdirs_in_links` | include subdirs (if applicable) in generated (yanked, inserted) links| true |
| `auto_set_filetype` | if false (not recommended), the telekasten filetype will not be used and the telekasten syntax not be loaded; markdown files will get the markdown filetype. | default: `true` |
| `auto_set_filetype` | if false, the telekasten filetype will not be used and the telekasten syntax not be loaded; markdown files will get the markdown filetype. | default: `true` |
| `auto_set_syntax` | if false, the telekasten syntax will not be set. | default: `true` |
| `template_handling` | Strategy for telekasten to pick a template when a new note is created via `new_note()` or by `follow_link()` to a non-existing note | smart |
| | - `smart` (default): if day or week is detected in title, use daily / weekly templates, else the new note template| |
| | - `prefer_new_note`: use the `new_note` template ||
@@ -785,9 +791,10 @@ actual tags and will return everything. A workaround is to either use the
`:tag:` notation or to recompile ripgrep locally with the appropriate flag (see
issues # 115 and #145).
**Note**: For proper highlighting, the `auto_set_filetype` option is set to `true` by default. This automatically
switches the filetype of opened notes from `markdown` to `telekasten`, and also registers the syntax with telescope
previewers for `.md` files.
**Note**: For proper highlighting, the `auto_set_syntax` option is set to `true`
by default, as is `auto_set_filetype`. The latter automatically switches the
filetype of opened notes from `markdown` to `telekasten`, and also registers the
syntax with telescope previewers for `.md` files.
### 2.5 Note templates

View File

@@ -195,9 +195,14 @@ telekasten.setup({opts})
*telekasten.settings.auto_set_filetype*
auto_set_filetype: ~
If `false` (not recommended), the telekasten filetype will not be used
and the telekasten syntax not be loaded; markdown files will get the
markdown filetype.
If `false`, the telekasten filetype will not be set. Markdown
files will get the markdown filetype.
Default: `true`
*telekasten.settings.auto_set_syntax*
auto_set_syntax: ~
If `false`, the telekasten syntax will not be set.
Default: `true`
@@ -841,8 +846,9 @@ Tag syntax:~
example, #1984 is not a valid tag, but `#y1984` is.
Note:~
For proper highlighting, the `auto_set_filetype` option is set to `true` by
default. This automatically sets the to `telekasten`, and also registers the
For proper highlighting, the `auto_set_syntax` option is set to `true`
by default, as is `auto_set_filetype`. The latter automatically sets
the filetype of opened notes to `telekasten`, and also registers the
syntax with telescope previewers for `.md` files.
Note:

View File

@@ -45,6 +45,10 @@ local function defaultConfig(home)
-- and thus the telekasten syntax will not be loaded either
auto_set_filetype = true,
-- auto-set telekasten syntax: if false, the telekasten syntax will not be set
-- this syntax setting is independent from auto-set filetype
auto_set_syntax = true,
-- dir names for special notes (absolute path or subdir name)
dailies = home .. "/" .. "daily",
weeklies = home .. "/" .. "weekly",
@@ -1213,6 +1217,9 @@ picker_actions.post_open = function()
if M.Cfg.auto_set_filetype then
vim.cmd("set ft=telekasten")
end
if M.Cfg.auto_set_syntax then
vim.cmd("set syntax=telekasten")
end
end
picker_actions.select_default = function(prompt_bufnr)