mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
auto_set_synax. closes #208
This commit is contained in:
67
README.md
67
README.md
@@ -87,32 +87,32 @@ of being able to edit it.
|
|||||||
|
|
||||||
<!-- vim-markdown-toc GFM -->
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
- [0. Install and setup](#0-install-and-setup)
|
* [0. Install and setup](#0-install-and-setup)
|
||||||
- [0.0 Prerequisites](#00-prerequisites)
|
* [0.0 Prerequisites](#00-prerequisites)
|
||||||
- [0.0.1 Telescope](#001-telescope)
|
* [0.0.1 Telescope](#001-telescope)
|
||||||
- [0.0.2 calendar-vim Plugin (optional)](#002-calendar-vim-plugin-optional)
|
* [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.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)
|
* [0.0.4 For image previews: telescope-media-files.nvim (optional)](#004-for-image-previews-telescope-media-filesnvim-optional)
|
||||||
- [catimg](#catimg)
|
* [catimg](#catimg)
|
||||||
- [viu](#viu)
|
* [viu](#viu)
|
||||||
- [telescope-media-files.nvim](#telescope-media-filesnvim)
|
* [telescope-media-files.nvim](#telescope-media-filesnvim)
|
||||||
- [0.1 Install the plugin](#01-install-the-plugin)
|
* [0.1 Install the plugin](#01-install-the-plugin)
|
||||||
- [0.1.0 Other useful plugins](#010-other-useful-plugins)
|
* [0.1.0 Other useful plugins](#010-other-useful-plugins)
|
||||||
- [0.2 Configure telekasten.nvim](#02-configure-telekastennvim)
|
* [0.2 Configure telekasten.nvim](#02-configure-telekastennvim)
|
||||||
- [0.3 Configure your own colors](#03-configure-your-own-colors)
|
* [0.3 Configure your own colors](#03-configure-your-own-colors)
|
||||||
- [1. Get Help](#1-get-help)
|
* [1. Get Help](#1-get-help)
|
||||||
- [2. Use it](#2-use-it)
|
* [2. Use it](#2-use-it)
|
||||||
- [2.0 Telekasten command](#20-telekasten-command)
|
* [2.0 Telekasten command](#20-telekasten-command)
|
||||||
- [2.1 Telekasten command palette](#21-telekasten-command-palette)
|
* [2.1 Telekasten command palette](#21-telekasten-command-palette)
|
||||||
- [2.2 Telekasten lua functions](#22-telekasten-lua-functions)
|
* [2.2 Telekasten lua functions](#22-telekasten-lua-functions)
|
||||||
- [2.3 Link notation](#23-link-notation)
|
* [2.3 Link notation](#23-link-notation)
|
||||||
- [2.4 Tag notation](#24-tag-notation)
|
* [2.4 Tag notation](#24-tag-notation)
|
||||||
- [2.5 Note templates](#25-note-templates)
|
* [2.5 Note templates](#25-note-templates)
|
||||||
- [2.5.1 Template files](#251-template-files)
|
* [2.5.1 Template files](#251-template-files)
|
||||||
- [2.6 Using the calendar](#26-using-the-calendar)
|
* [2.6 Using the calendar](#26-using-the-calendar)
|
||||||
- [2.7 Using the telescope pickers](#27-using-the-telescope-pickers)
|
* [2.7 Using the telescope pickers](#27-using-the-telescope-pickers)
|
||||||
- [3. Bind it](#3-bind-it)
|
* [3. Bind it](#3-bind-it)
|
||||||
- [4. The hardcoded stuff](#4-the-hardcoded-stuff)
|
* [4. The hardcoded stuff](#4-the-hardcoded-stuff)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
@@ -258,6 +258,11 @@ require('telekasten').setup({
|
|||||||
-- and thus the telekasten syntax will not be loaded either
|
-- and thus the telekasten syntax will not be loaded either
|
||||||
auto_set_filetype = true,
|
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)
|
-- dir names for special notes (absolute path or subdir name)
|
||||||
dailies = home .. '/' .. 'daily',
|
dailies = home .. '/' .. 'daily',
|
||||||
weeklies = home .. '/' .. 'weekly',
|
weeklies = home .. '/' .. 'weekly',
|
||||||
@@ -448,7 +453,8 @@ END
|
|||||||
| | - `dropdown`: floating popup window ||
|
| | - `dropdown`: floating popup window ||
|
||||||
| | - `get_cursor`: floating popup window at cursor position ||
|
| | - `get_cursor`: floating popup window at cursor position ||
|
||||||
| `subdirs_in_links` | include subdirs (if applicable) in generated (yanked, inserted) links| true |
|
| `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 |
|
| `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| |
|
| | - `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 ||
|
| | - `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
|
`:tag:` notation or to recompile ripgrep locally with the appropriate flag (see
|
||||||
issues # 115 and #145).
|
issues # 115 and #145).
|
||||||
|
|
||||||
**Note**: For proper highlighting, the `auto_set_filetype` option is set to `true` by default. This automatically
|
**Note**: For proper highlighting, the `auto_set_syntax` option is set to `true`
|
||||||
switches the filetype of opened notes from `markdown` to `telekasten`, and also registers the syntax with telescope
|
by default, as is `auto_set_filetype`. The latter automatically switches the
|
||||||
previewers for `.md` files.
|
filetype of opened notes from `markdown` to `telekasten`, and also registers the
|
||||||
|
syntax with telescope previewers for `.md` files.
|
||||||
|
|
||||||
### 2.5 Note templates
|
### 2.5 Note templates
|
||||||
|
|
||||||
|
|||||||
@@ -195,9 +195,14 @@ telekasten.setup({opts})
|
|||||||
|
|
||||||
*telekasten.settings.auto_set_filetype*
|
*telekasten.settings.auto_set_filetype*
|
||||||
auto_set_filetype: ~
|
auto_set_filetype: ~
|
||||||
If `false` (not recommended), the telekasten filetype will not be used
|
If `false`, the telekasten filetype will not be set. Markdown
|
||||||
and the telekasten syntax not be loaded; markdown files will get the
|
files will get the markdown filetype.
|
||||||
markdown filetype.
|
|
||||||
|
Default: `true`
|
||||||
|
|
||||||
|
*telekasten.settings.auto_set_syntax*
|
||||||
|
auto_set_syntax: ~
|
||||||
|
If `false`, the telekasten syntax will not be set.
|
||||||
|
|
||||||
Default: `true`
|
Default: `true`
|
||||||
|
|
||||||
@@ -841,8 +846,9 @@ Tag syntax:~
|
|||||||
example, #1984 is not a valid tag, but `#y1984` is.
|
example, #1984 is not a valid tag, but `#y1984` is.
|
||||||
|
|
||||||
Note:~
|
Note:~
|
||||||
For proper highlighting, the `auto_set_filetype` option is set to `true` by
|
For proper highlighting, the `auto_set_syntax` option is set to `true`
|
||||||
default. This automatically sets the to `telekasten`, and also registers the
|
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.
|
syntax with telescope previewers for `.md` files.
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ local function defaultConfig(home)
|
|||||||
-- and thus the telekasten syntax will not be loaded either
|
-- and thus the telekasten syntax will not be loaded either
|
||||||
auto_set_filetype = true,
|
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)
|
-- dir names for special notes (absolute path or subdir name)
|
||||||
dailies = home .. "/" .. "daily",
|
dailies = home .. "/" .. "daily",
|
||||||
weeklies = home .. "/" .. "weekly",
|
weeklies = home .. "/" .. "weekly",
|
||||||
@@ -1213,6 +1217,9 @@ picker_actions.post_open = function()
|
|||||||
if M.Cfg.auto_set_filetype then
|
if M.Cfg.auto_set_filetype then
|
||||||
vim.cmd("set ft=telekasten")
|
vim.cmd("set ft=telekasten")
|
||||||
end
|
end
|
||||||
|
if M.Cfg.auto_set_syntax then
|
||||||
|
vim.cmd("set syntax=telekasten")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
picker_actions.select_default = function(prompt_bufnr)
|
picker_actions.select_default = function(prompt_bufnr)
|
||||||
|
|||||||
Reference in New Issue
Block a user