From: Ciro Santilli Date: Tue, 3 Jun 2014 15:07:09 +0000 (+0200) Subject: Correct minor points in last pull request. X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/2a58c2fa2c9a0ef3d475c71fe016a02fc10f0ad0 Correct minor points in last pull request. --- diff --git a/ftplugin/mkd.vim b/ftplugin/mkd.vim index a1ab150..b18f3be 100644 --- a/ftplugin/mkd.vim +++ b/ftplugin/mkd.vim @@ -304,7 +304,7 @@ function! s:Markdown_Toc(...) try silent vimgrep /\(^\S.*\(\n[=-]\+\)\@=\|^#\+\)/ % catch /E480/ - echom "Toc: No headers." + echom "Toc: No headers." return endtry @@ -326,8 +326,9 @@ function! s:Markdown_Toc(...) " atx headers if match(d.text, "^#") > -1 let l:level = len(matchstr(d.text, '#*', 'g'))-1 - let d.text = d.text[l:level+2:] - " setex headers + let d.text = substitute(d.text, '\v^#*[ ]*', '', '') + let d.text = substitute(d.text, '\v[ ]*#*$', '', '') + " setex headers else let l:next_line = getbufline(bufname(d.bufnr), d.lnum+1) if match(l:next_line, "=") > -1