Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions autoload/wiki/buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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_local_journal', {}))
endif

call wiki#init#apply_mappings_from_dict(l:mappings, '<buffer>')
endfunction
Expand Down
30 changes: 30 additions & 0 deletions doc/wiki.txt
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ OPTIONS *wiki-config-options*

*g:wiki_mappings_global*
*g:wiki_mappings_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.: >
Expand All @@ -616,6 +617,18 @@ OPTIONS *wiki-config-options*
visual mode, respectively. The available `<plug>` mappings are listed in
|wiki-mappings|.

For any local mappings that should only be applied in journal entries,
consider setting |g:wiki_mappings_local_journal|. For example, similar to
above: >

let g:wiki_mappings_local = {
\ '<plug>(wiki-journal-prev)' : '[w',
\ '<plug>(wiki-journal-next)' : ']w',
\}
<
Here we create a pair of mappings `[w` and `]w` to navigate between journal
entries.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps one should add an example for this as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an example and an extra table for the defaults.

Default: Undefined

*g:wiki_month_names*
Expand Down Expand Up @@ -1208,6 +1221,23 @@ information about the different modes.
`ox` at |<plug>(wiki-at)|
`ox` it |<plug>(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 `<plug>(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` <c-n> |<plug>(wiki-journal-prev)|
`n` <c-p> |<plug>(wiki-journal-next)|
`n` <leader><c-n> |<plug>(wiki-journal-copy-tonext)|
`n` <leader>wu |<plug>(wiki-journal-toweek)|
`n` <leader>wm |<plug>(wiki-journal-tomonth)|

==============================================================================
LINKS *wiki-link*

Expand Down