Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " vim-texaround: Small plugin for wrapping text in a LaTeX command or environment
- function! TexWrapCommand(vt)
- let c = input("")
- if c ==# "\<Esc>" || c ==# "\<C-c>"
- return
- endif
- if a:vt == 'line' || a:vt == 'V'
- normal! '>A}
- execute "normal! '<i\\".c."{"
- else
- normal! `>a}
- execute "normal! `<i\\".c."{"
- endif
- echo "success"
- endfunction
- function! TexWrapEnv(arg)
- let c = input("")
- if c ==# "\<Esc>" || c ==# "\<C-c>"
- return
- endif
- execute "normal! '>o\\end{".c."}"
- execute "normal! '<O\\begin{".c."}"
- normal! ='>$F{
- echo "success"
- endfunction
- vnoremap \tc <ESC>:call TexWrapCommand(visualmode())
- vnoremap \te <ESC>:call TexWrapEnv(visualmode())
- nnoremap \tc <ESC>:set opfunc=TexWrapCommand<CR>g@
- nnoremap \te <ESC>:set opfunc=TexWrapEnv<CR>g@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement