From 2a58c2fa2c9a0ef3d475c71fe016a02fc10f0ad0 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 3 Jun 2014 17:07:09 +0200 Subject: [PATCH 1/1] Correct minor points in last pull request. --- ftplugin/mkd.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.39.5