diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-21 00:44:51 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-05-21 00:44:51 +1200 |
commit | e97d3268b8974285084190cfb65e4ec5742b479a (patch) | |
tree | 7253aec579c36c0df261eb6d6446a35bfbf87918 | |
parent | Merge branch 'release/v4.37.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-4.38.0.tar.gz (sig) dotfiles-4.38.0.zip |
Merge branch 'release/v4.38.0'v4.38.0
* release/v4.38.0:
Bump VERSION
Add comments to Markdown heading mapping
End heading mapping on first column
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/autoload/markdown.vim | 13 |
2 files changed, 15 insertions, 2 deletions
@@ -1,2 +1,2 @@ -tejr dotfiles v4.37.0 -Mon May 20 12:40:54 UTC 2019 +tejr dotfiles v4.38.0 +Mon May 20 12:44:50 UTC 2019 diff --git a/vim/autoload/markdown.vim b/vim/autoload/markdown.vim index 9bedbb68..c0818246 100644 --- a/vim/autoload/markdown.vim +++ b/vim/autoload/markdown.vim @@ -1,9 +1,22 @@ " Add an underline under a heading function! markdown#Heading(char) abort + + " Get current position let pos = getpos('.') + + " Get heading text from current line let heading = getline(pos[1]) + + " Build underline string by repeating character by the string length of the + " heading text let underline = repeat(a:char, strlen(heading)) + + " Append the heading text to the buffer on a new line after the heading call append(pos[1], underline) + + " Move to the first column of the underline we just inserted let pos[1] += 1 + let pos[2] = 1 call setpos('.', pos) + endfunction |