diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index c3aaa38..5d6d7e0 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -1467,7 +1467,11 @@ that the > syntax allow empty lines to signal multiple paragraphs. A line that starts with %% is a comment. E.g.: > %% this text would not be in HTML -< + +The default commentstring can be changed or disabled with +|g:vimwiki_commentstring| so an alternative commentstring can be set, e.g.: + + ------------------------------------------------------------------------------ 5.11. Horizontal line *vimwiki-syntax-hr* @@ -3548,6 +3552,23 @@ take care when using it. Any plugin that uses a set filetype will be enabled. The default is `[ ]` + +------------------------------------------------------------------------------ +*g:vimwiki_commentstring* + +An option to change the default commentstring. Use + + let g:vimwiki_commentstring = '' + +for html-style comments. Use + + let g:vimwiki_commentstring = "" + +to not set commentstring by vimwiki. + +The default is %%%s. + + ============================================================================== 13. Getting help *vimwiki-help* @@ -3676,7 +3697,7 @@ Contributors and their Github usernames in roughly chronological order: - Rafael Castillo (@eltrufas) - Reiner Herrmann (@reinerh) - Ryan Winograd - + - Birger Niklas (@BirgerNi) ============================================================================== 16. Changelog *vimwiki-changelog* @@ -3688,6 +3709,7 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from https://github.com/vimwiki-backup/vimwiki/issues. New:~ + * PR #946: Add option |g:vimwiki_commentstring| to customize commentstring * Issue #940: Render table header inside thead element and rest under tbody element if table header specified in wiki * PR #811: Feature: Added handling of absolute path to vimwiki (with //) diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 5ed15e6..7c7cc74 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -9,8 +9,12 @@ if exists('b:did_ftplugin') endif let b:did_ftplugin = 1 " Don't load another plugin for this buffer - -setlocal commentstring=%%%s +" Enable/disable commentstring %%%s +if !exists('g:vimwiki_commentstring') + setlocal commentstring=%%%s +elseif g:vimwiki_commentstring != "" + let &l:commentstring=g:vimwiki_commentstring +endif if vimwiki#vars#get_global('conceallevel') && exists('+conceallevel') let &l:conceallevel = vimwiki#vars#get_global('conceallevel') diff --git a/test/commentstring.vader b/test/commentstring.vader new file mode 100644 index 0000000..9d8ccc9 --- /dev/null +++ b/test/commentstring.vader @@ -0,0 +1,29 @@ +Include: vader_includes/vader_setup.vader + +After (clean up): + if exists('g:vimwiki_commentstring') + unlet g:vimwiki_commentstring + endif + if exists('b:did_ftplugin') + unlet b:did_ftplugin + endif + +Execute (default commentstring): + AssertEqual '/*%s*/', &commentstring + +Execute (default commenstring, ft vimwiki): + let g:vimwiki_commentstring="" + set ft=vimwiki + AssertEqual '/*%s*/', &commentstring + +Execute (default vimwiki commentstring): + set ft=vimwiki + AssertEqual '%%%s', &commentstring + +Execute (html commentstring): + let g:vimwiki_commentstring='' + set ft=vimwiki + AssertEqual '', &commentstring + +Include: vader_includes/vader_teardown.vader +