[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
350158c520
commit
de0b83fb3f
1 changed files with 32 additions and 1 deletions
|
@ -85,6 +85,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 '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)
|
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
|
" Note-Taking Workflow
|
||||||
Plug 'lervag/wiki.vim'
|
Plug 'lervag/wiki.vim'
|
||||||
|
|
||||||
|
@ -142,8 +147,11 @@ augroup END
|
||||||
au! BufRead,BufNewFile *.markdown set filetype=markdown
|
au! BufRead,BufNewFile *.markdown set filetype=markdown
|
||||||
au! BufRead,BufNewFile *.md set filetype=markdown
|
au! BufRead,BufNewFile *.md set filetype=markdown
|
||||||
au! BufRead,BufNewFile *.mkd 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
|
" automatically enables markdown plugins for md & txt files
|
||||||
function! Prose()
|
function! Prose()
|
||||||
|
call plug#load('vim-pencil')
|
||||||
call pencil#init()
|
call pencil#init()
|
||||||
" PLUGIN: vim-textobj-sentence
|
" PLUGIN: vim-textobj-sentence
|
||||||
" enable extended sentence textobject use on md and plaintext files
|
" enable extended sentence textobject use on md and plaintext files
|
||||||
|
@ -155,10 +163,25 @@ endfunction
|
||||||
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go']
|
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go']
|
||||||
|
|
||||||
" call the prose function defined above for any md files
|
" 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
|
" or invoke it manually by writing :Prose
|
||||||
command! -nargs=0 Prose call 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
|
" PLUGIN: wiki.vim
|
||||||
if $WIKIROOT ==? ""
|
if $WIKIROOT ==? ""
|
||||||
let g:wiki_root = '~/Nextcloud/Notes/'
|
let g:wiki_root = '~/Nextcloud/Notes/'
|
||||||
|
@ -569,6 +592,14 @@ let g:nv_fzf_binds = [
|
||||||
\ 'ctrl-w:backward-kill-word',
|
\ 'ctrl-w:backward-kill-word',
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
|
" 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>
|
||||||
|
|
||||||
function! SearchWiki()
|
function! SearchWiki()
|
||||||
let l:curpath=getcwd()
|
let l:curpath=getcwd()
|
||||||
:execute(":cd " . g:wiki_root)
|
:execute(":cd " . g:wiki_root)
|
||||||
|
|
Loading…
Reference in a new issue