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