Skip to content

Instantly share code, notes, and snippets.

@mrbalihai
Last active July 31, 2020 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrbalihai/afa9e9cf9413f2386b7f2bb726913d2d to your computer and use it in GitHub Desktop.
Save mrbalihai/afa9e9cf9413f2386b7f2bb726913d2d to your computer and use it in GitHub Desktop.
Toggle strike through in pandoc markdown
function! ToggleStrikethrough()
let line = getline('.')
if stridx(line, "~~") == -1
call setline(line('.'), substitute(line, '\(\s*-\s\)\(.*\)', '\1\~\~\2\~\~', "g"))
else
call setline(line('.'), substitute(line, '\~\~', '', "g"))
endif
endfunction
map <localleader>d :call ToggleStrikethrough()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment