vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 19f913429f285099033f7db864d530d1c08db86c
parent 3cc6fa71f6e6404caaf517c7d2d5ab9fb36cd8b1
Author: Rane Brown <rane.brown@gmail.com>
Date:   Mon, 23 Dec 2019 13:35:31 -0700

Don't overwrite user setting of list_margin.

Closes #789

Diffstat:
Mautoload/vimwiki/vars.vim | 8+++++---
Mtest/list_margin.vader | 3+++
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim @@ -321,6 +321,7 @@ function! s:normalize_global_settings() abort endfunction +let s:margin_set_by_user = 0 function! s:populate_wikilocal_options() abort let default_values = { \ 'auto_diary_index': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, @@ -375,6 +376,9 @@ function! s:populate_wikilocal_options() abort for key in keys(default_values) if has_key(users_wiki_settings, key) call s:check_users_value(key, users_wiki_settings[key], default_values[key], 0) + if key ==# 'list_margin' + let s:margin_set_by_user = 1 + endif let new_wiki_settings[key] = users_wiki_settings[key] else let new_wiki_settings[key] = default_wiki_settings[key] @@ -498,11 +502,9 @@ function! s:normalize_wikilocal_settings() abort let wiki_settings.syntax = 'media' endif - if wiki_settings.syntax ==# 'markdown' + if wiki_settings.syntax ==# 'markdown' && !s:margin_set_by_user " default list margin to 0 let wiki_settings.list_margin = 0 - else - let wiki_settings.list_margin = -1 endif endfor diff --git a/test/list_margin.vader b/test/list_margin.vader @@ -21,6 +21,7 @@ Execute (Set syntax default): set shiftwidth=8 AssertEqual 8, &shiftwidth call SetSyntax('default') + call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr')) Execute (Generate Links): VimwikiGenerateLinks @@ -47,6 +48,7 @@ Expect (Links with margin == 2): Execute (Set syntax media): call SetSyntax('media') + call vimwiki#vars#set_wikilocal('list_margin', -1, vimwiki#vars#get_bufferlocal('wiki_nr')) Execute (Generate Links): VimwikiGenerateLinks @@ -73,6 +75,7 @@ Expect (Links with margin == 1): Execute (Set syntax markdown): call SetSyntax('markdown') + " list margin should default to 0 for markdown Execute (Generate Links): VimwikiGenerateLinks