aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-05-21 00:40:38 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-05-21 00:40:38 +1200
commitb8faa3bb6069132c8dd58eeba1796a733dbf1f0e (patch)
tree38c341be5ed2820ecfddc91c1b3762a0ff823cc3 /vim
parent76e77b87e79b294ed46209f40cded629b6aab0b9 (diff)
downloaddotfiles-b8faa3bb6069132c8dd58eeba1796a733dbf1f0e.tar.gz
Improve Markdown heading mapping
Leave me on the same row as the underline, and use getpos()/setpos()
Diffstat (limited to 'vim')
-rw-r--r--vim/autoload/markdown.vim7
1 files changed, 5 insertions, 2 deletions
diff --git a/vim/autoload/markdown.vim b/vim/autoload/markdown.vim
index 34c7bda7..9bedbb68 100644
--- a/vim/autoload/markdown.vim
+++ b/vim/autoload/markdown.vim
@@ -1,6 +1,9 @@
" Add an underline under a heading
function! markdown#Heading(char) abort
- let heading = getline('.')
+ let pos = getpos('.')
+ let heading = getline(pos[1])
let underline = repeat(a:char, strlen(heading))
- call append(line('.'), underline)
+ call append(pos[1], underline)
+ let pos[1] += 1
+ call setpos('.', pos)
endfunction