From 4226b6f5d5fcf5a14d03a5231a4d3e4c3fcda055 Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius Date: Fri, 28 Jan 2022 11:45:38 +0200 Subject: [PATCH 1/3] add g:wiki_mappings_journal_local variable for customizing journal mappings --- autoload/wiki/buffer.vim | 3 +++ doc/wiki.txt | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/autoload/wiki/buffer.vim b/autoload/wiki/buffer.vim index 9e0c83c7..08705246 100644 --- a/autoload/wiki/buffer.vim +++ b/autoload/wiki/buffer.vim @@ -175,6 +175,9 @@ function! s:init_buffer_mappings() abort " {{{1 endif call extend(l:mappings, get(g:, 'wiki_mappings_local', {})) + if b:wiki.in_journal + call extend(l:mappings, get(g:, 'wiki_mappings_journal_local', {})) + endif call wiki#init#apply_mappings_from_dict(l:mappings, '') endfunction diff --git a/doc/wiki.txt b/doc/wiki.txt index 80183075..3d182b0d 100644 --- a/doc/wiki.txt +++ b/doc/wiki.txt @@ -594,6 +594,7 @@ OPTIONS *wiki-config-options* *g:wiki_mappings_global* *g:wiki_mappings_local* +*g:wiki_mappings_journal_local* These options allow one to customize global and buffer local mappings through dictionaries where the keys are the right-hand sides and the values are the desired mappings, e.g.: > @@ -616,6 +617,9 @@ OPTIONS *wiki-config-options* visual mode, respectively. The available `` mappings are listed in |wiki-mappings|. + For any local mappings that should only be applied in journal entries, + consider setting |g:wiki_mappings_journal_local|. + Default: Undefined *g:wiki_month_names* From 32b92d11b9c9dfc76c5c81f2415db4e19acc12df Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius Date: Fri, 28 Jan 2022 13:58:54 +0200 Subject: [PATCH 2/3] rename local journal mapping variable name --- autoload/wiki/buffer.vim | 2 +- doc/wiki.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/wiki/buffer.vim b/autoload/wiki/buffer.vim index 08705246..1f0cecd0 100644 --- a/autoload/wiki/buffer.vim +++ b/autoload/wiki/buffer.vim @@ -176,7 +176,7 @@ function! s:init_buffer_mappings() abort " {{{1 call extend(l:mappings, get(g:, 'wiki_mappings_local', {})) if b:wiki.in_journal - call extend(l:mappings, get(g:, 'wiki_mappings_journal_local', {})) + call extend(l:mappings, get(g:, 'wiki_mappings_local_journal', {})) endif call wiki#init#apply_mappings_from_dict(l:mappings, '') diff --git a/doc/wiki.txt b/doc/wiki.txt index 3d182b0d..410e0848 100644 --- a/doc/wiki.txt +++ b/doc/wiki.txt @@ -594,7 +594,7 @@ OPTIONS *wiki-config-options* *g:wiki_mappings_global* *g:wiki_mappings_local* -*g:wiki_mappings_journal_local* +*g:wiki_mappings_local_journal* These options allow one to customize global and buffer local mappings through dictionaries where the keys are the right-hand sides and the values are the desired mappings, e.g.: > @@ -618,7 +618,7 @@ OPTIONS *wiki-config-options* |wiki-mappings|. For any local mappings that should only be applied in journal entries, - consider setting |g:wiki_mappings_journal_local|. + consider setting |g:wiki_mappings_local_journal|. Default: Undefined From 276aad67990c9f530c5845dabe9773cd1f9f46ae Mon Sep 17 00:00:00 2001 From: Ignas Anikevicius Date: Fri, 28 Jan 2022 14:34:08 +0200 Subject: [PATCH 3/3] add more documentation on journal mappings --- doc/wiki.txt | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/wiki.txt b/doc/wiki.txt index 410e0848..4aefc03e 100644 --- a/doc/wiki.txt +++ b/doc/wiki.txt @@ -618,7 +618,16 @@ OPTIONS *wiki-config-options* |wiki-mappings|. For any local mappings that should only be applied in journal entries, - consider setting |g:wiki_mappings_local_journal|. + consider setting |g:wiki_mappings_local_journal|. For example, similar to + above: > + + let g:wiki_mappings_local = { + \ '(wiki-journal-prev)' : '[w', + \ '(wiki-journal-next)' : ']w', + \} +< + Here we create a pair of mappings `[w` and `]w` to navigate between journal + entries. Default: Undefined @@ -1212,6 +1221,23 @@ information about the different modes. `ox` at |(wiki-at)| `ox` it |(wiki-it)| +------------------------------------------------------------------------------ +DEFAULT JOURNAL MAPPINGS *wiki-mappings-journal-default* + +This is a list of default mappings four journal entries. For a more detailed +description of each mapping, read the documentation of the `(wiki-[name])` +form of the mapping. The mode specifier is a single letter which indicates +which mode the mapping is valid in. See e.g. |nmap|, |imap|, |omap| or |xmap| +for more information about the different modes. + + MODE LHS RHS~ + ==== === === + `n` |(wiki-journal-prev)| + `n` |(wiki-journal-next)| + `n` |(wiki-journal-copy-tonext)| + `n` wu |(wiki-journal-toweek)| + `n` wm |(wiki-journal-tomonth)| + ============================================================================== LINKS *wiki-link*