Skip to content

Instantly share code, notes, and snippets.

@wheelsandmetal
Last active July 14, 2020 08:24
Show Gist options
  • Save wheelsandmetal/64968a35001dea0782146f04c6aef5eb to your computer and use it in GitHub Desktop.
Save wheelsandmetal/64968a35001dea0782146f04c6aef5eb to your computer and use it in GitHub Desktop.
Creating a custom begin command in latex and have the matching end command auto inserted. All pure vim script
function! FindAndReplaceInputWordInNext3Lines()
call inputsave()
let word = input("> ")
call inputrestore()
execute printf(":.,.+3s/THISISAWORD/%s/g", word)
endfunction
au! FileType tex inoremap ,beg \begin{THISISAWORD}<Enter><Enter>\end{THISISAWORD}<Enter><Enter><++><Esc>4k0fR:call FindAndReplaceInputWordInNext3Lines()<cr>ka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment