[nvim] Add rmarkdown, pandoc plugins and bindings
PDFs can be compiled using rmarkdown by invoking <leader>c, or C to open the file (which pauses vim however). The best workflow is to open the pdf manually in something like zathura, which will auto-update when the document is newly compiled.
This commit is contained in:
parent
a84c18f7ab
commit
5f57994570
1 changed files with 32 additions and 1 deletions
|
@ -82,6 +82,11 @@ Plug 'junegunn/goyo.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide
|
|||
Plug 'junegunn/limelight.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
|
||||
Plug 'rhysd/vim-grammarous', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " integrate vim with languagetool for grammar checking (needs java8)
|
||||
|
||||
" RMarkdown & LaTeX workflow
|
||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
Plug 'vim-pandoc/vim-pandoc'
|
||||
Plug 'vim-pandoc/vim-rmarkdown'
|
||||
|
||||
" Note-Taking Workflow
|
||||
Plug 'lervag/wiki.vim'
|
||||
|
||||
|
@ -139,8 +144,11 @@ augroup END
|
|||
au! BufRead,BufNewFile *.markdown set filetype=markdown
|
||||
au! BufRead,BufNewFile *.md set filetype=markdown
|
||||
au! BufRead,BufNewFile *.mkd set filetype=markdown
|
||||
au! BufRead,BufNewFile *.rmd set filetype=markdown
|
||||
au! BufRead,BufNewFile *.Rmd set filetype=markdown
|
||||
" automatically enables markdown plugins for md & txt files
|
||||
function! Prose()
|
||||
call plug#load('vim-pencil')
|
||||
call pencil#init()
|
||||
" PLUGIN: vim-textobj-sentence
|
||||
" enable extended sentence textobject use on md and plaintext files
|
||||
|
@ -152,10 +160,25 @@ endfunction
|
|||
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go']
|
||||
|
||||
" call the prose function defined above for any md files
|
||||
autocmd FileType markdown,txt call Prose()
|
||||
autocmd FileType markdown,txt,rmarkdown call Prose()
|
||||
" or invoke it manually by writing :Prose
|
||||
command! -nargs=0 Prose call Prose()
|
||||
|
||||
" PLUGIN: vim-pandoc
|
||||
let g:pandoc#modules#enabled=["metadata", "toc", "hypertext", "command"]
|
||||
let g:pandoc#command#prefer_pdf=1
|
||||
let g:pandoc#biblio#bibs=["~/Nextcloud/Library/academia/academia.bib"]
|
||||
let g:pandoc#completion#bib#mode='citeproc'
|
||||
let g:pandoc#keyboard#use_default_mappings=0
|
||||
let g:pandoc#folding#level=2
|
||||
let g:pandoc#folding#fold_yaml=1
|
||||
let g:pandoc#folding#fastfolds=1
|
||||
let g:pandoc#spell#default_langs=["en_us", "de_de"]
|
||||
let g:pandoc#hypertext#ausosave_on_edit_open_link=1
|
||||
let g:pandoc#hypertext#create_if_no_alternates_exists=1
|
||||
" configuration for vim-pandoc and vim-rmarkdown
|
||||
let g:pandoc#syntax#conceal#use = 0
|
||||
|
||||
" PLUGIN: wiki.vim
|
||||
if $WIKIROOT ==? ""
|
||||
let g:wiki_root = '~/Nextcloud/Notes/'
|
||||
|
@ -465,6 +488,14 @@ au FileType go nnoremap <F9> :GoCoverageToggle -short<cr>
|
|||
" go to the definition of whatever you hover over
|
||||
au FileType go nnoremap <F12> <Plug>(go-def)
|
||||
|
||||
" Markdown & Pandoc compilation group
|
||||
" the commented out command can be used if vim-rmarkdown plugin is not
|
||||
" installed (it is a bit more brittle)
|
||||
" autocmd FileType rmd noremap <F10> :!echo<space>"require(rmarkdown);<space>render('<c-r>%')"<space>\|<space>R<space>--vanilla<enter>
|
||||
" Compile with rmarkdown
|
||||
autocmd FileType markdown noremap <leader>c :RMarkdown pdf<cr>
|
||||
autocmd FileType markdown noremap <leader>C :RMarkdown! pdf<cr>
|
||||
|
||||
" Call leaderf with <leader-f> (necessary to enable leaderf lazyloading)
|
||||
nnoremap <leader>F :LeaderfFile<cr>
|
||||
nnoremap <leader>f :LeaderfBuffer<cr>
|
||||
|
|
Loading…
Reference in a new issue