From 6777c73c4438dcc07660f4b2bbd09a58e98cf6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Thu, 6 Apr 2023 09:34:58 +0200 Subject: [PATCH] feat!: change default filetype to Markdown refer: #289 --- README.md | 6 ++---- doc/wiki.txt | 44 ++++++++++++++++++++------------------------ plugin/wiki.vim | 6 +++--- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 84c8ff5..87d2d9e 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,8 @@ a list of available features. For more details, please read the [full documentation](doc/wiki.txt). Note: `wiki.vim` is _not_ a filetype plugin. It is designed to be used _with_ - filetype plugins, e.g. dedicated Markdown plugins. A simple alternative - is to use [wiki-ft.vim](https://github.com/lervag/wiki-ft.vim) for syntax - highlighting and folding of `.wiki` files. Users are adviced to read - `:help wiki-intro-plugins` for a list of plugins that work well with + filetype plugins, e.g. dedicated Markdown plugins. Users are adviced to + read `:help wiki-intro-plugins` for a list of plugins that work well with `wiki.vim`. Note: Some features require a recent version of Vim (>= 8.1) or NeoVim (>= 0.5). diff --git a/doc/wiki.txt b/doc/wiki.txt index e42f1e8..051ac1e 100644 --- a/doc/wiki.txt +++ b/doc/wiki.txt @@ -71,13 +71,13 @@ a personal knowledge base. Please see |wiki-intro-usage| for a simple quick-start guide, and |wiki-intro-guide| for more in-depth info on what this is and how one could use such a system efficiently. -The plugin will activate by default for any `.wiki` files, but this may be +The plugin will activate by default for Markdown files (`*.md`). This may be customized with |g:wiki_filetypes| and |g:wiki_global_load|. One may also explicitly activate with |WikiEnable|. The wiki root is automatically detected -as long as there is a top-level `index.wiki` file available (the index name -may be changed with |g:wiki_index_name|). If no such file is found, it sets -the root to the same directory as the current file. In addition, one may -specify a main wiki with the |g:wiki_root| option. This allows convenient +as long as there is a top-level index file available, e.g. `index.md` (the +index name may be changed with |g:wiki_index_name|). If no such file is found, +it sets the root to the same directory as the current file. In addition, one +may specify a main wiki with the |g:wiki_root| option. This allows convenient mappings and commands for opening the main wiki from anywhere. The plugin was initially based on Vimwiki [0], but it is written mostly from @@ -120,21 +120,10 @@ This outlines the basic steps to get started: let g:wiki_root = '~/wiki' -3. Now you can open the index file (by default `index.wiki`; see also +3. Now you can open the index file (by default `index.md`; see also |g:wiki_index_name|) with `ww` and start to add your notes as desired. -Note: As one can see from the above, the default extension recognized by - |wiki.vim| is the `.wiki` extension. If one instead wants to use `.md` - (Markdown) as the default extension, then one usually wants to add the - following to `vimrc`: >vim - - let g:wiki_filetypes = ['md'] - let g:wiki_link_extension = '.md' -< - See |g:wiki_filetypes| and |g:wiki_link_extension| for more details on - these options. - ------------------------------------------------------------------------------ FEATURES *wiki-intro-features* @@ -365,9 +354,11 @@ The following is a list of plugins that one may want to use alongside things that it is lacking, they are very welcome to suggest additions! Markdown ~ -Many users prefer to use |wiki.vim| with the Markdown filetype, in which case -they will want to use a dedicated filetype plugin. There are a lot of -options, e.g.: +Many users prefer to use |wiki.vim| with the Markdown filetype. Vim and neovim +ship with a decent Markdown plugin by default, but there are also popular and +well maintained alternatives with more features. Here are some popular +options: + - https://github.com/tpope/vim-markdown (this is shipped with Vim and neovim) - https://github.com/preservim/vim-markdown - https://github.com/SidOfc/mkdx/ @@ -376,7 +367,12 @@ options, e.g.: wiki-ft.vim ~ https://github.com/lervag/wiki-ft.vim `wiki-ft.vim` is a simple filetype plugin for `.wiki` files that provides -syntax highlighting and folding. +syntax highlighting and folding. Recommended settings if you want to use +this: >vim + + let g:wiki_filetypes = ['wiki'] + let g:wiki_link_target_type = '' + let g:wiki_link_extension = '' lists.vim ~ https://github.com/lervag/lists.vim @@ -508,7 +504,7 @@ OPTIONS *wiki-config-options* < See also |g:wiki_link_extension|, which is often relevant in many filetypes. - Default: `['wiki']` + Default: `['md']` *g:wiki_file_handler* Name of a function or a |FuncRef| for a function that should be used to @@ -722,7 +718,7 @@ OPTIONS *wiki-config-options* Specify the extension that should be applied to wiki links. This should be in the format `.ext`, e.g. `.md` or `.wiki`. - Default: `''` + Default: `'.md'` *g:wiki_link_toggle_on_follow* This option allows disabling the toggle behaviour in |WikiLinkFollow| where @@ -753,7 +749,7 @@ OPTIONS *wiki-config-options* Toggling between link types can still be achieved using |WikiLinkToggle|. - Default: `'wiki'` + Default: `'md'` *g:wiki_link_toggles* This option specifies the template for toggling a specific type of link with diff --git a/plugin/wiki.vim b/plugin/wiki.vim index f6a33f5..457bb9c 100644 --- a/plugin/wiki.vim +++ b/plugin/wiki.vim @@ -25,7 +25,7 @@ call wiki#init#option('wiki_export', { \ 'view' : v:false, \ 'output' : fnamemodify(tempname(), ':h'), \}) -call wiki#init#option('wiki_filetypes', ['wiki']) +call wiki#init#option('wiki_filetypes', ['md']) call wiki#init#option('wiki_fzf_pages_opts', '') call wiki#init#option('wiki_fzf_tags_opts', '') call wiki#init#option('wiki_global_load', 1) @@ -43,8 +43,8 @@ call wiki#init#option('wiki_journal_index', { \ 'link_text_parser': { b, d, p -> d }, \ 'link_url_parser': { b, d, p -> 'journal:' . d } \}) -call wiki#init#option('wiki_link_extension', '') -call wiki#init#option('wiki_link_target_type', 'wiki') +call wiki#init#option('wiki_link_extension', '.md') +call wiki#init#option('wiki_link_target_type', 'md') call wiki#init#option('wiki_link_toggle_on_follow', 1) call wiki#init#option('wiki_link_toggles', { \ 'wiki': 'wiki#link#md#template',