unify vim prose functionality under one function

This commit is contained in:
Marty Oehme 2019-05-20 17:13:38 +02:00
parent 9000b8b873
commit 85100995df

View file

@ -74,13 +74,13 @@ augroup load_html_utils
augroup END
" Markdown & Prose Workflow
Plug 'reedes/vim-pencil', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap
Plug 'junegunn/goyo.vim', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " provide distraction free writing
Plug 'junegunn/limelight.vim', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
Plug 'rhysd/vim-grammarous', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " integrate vim with languagetool for grammar checking (needs java8)
Plug 'reedes/vim-pencil', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap
Plug 'junegunn/goyo.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
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)
" Note-Taking Workflow
Plug 'vimwiki/vimwiki'
Plug 'fcpg/vim-waikiki'
Plug 'michal-h21/vim-zettel'
" For async completion
@ -133,26 +133,25 @@ augroup nerd_loader
augroup END
" PLUGIN: markdown-group
" set .markdown, .md to both use the default mkd filetype which vim-markdown
" uses as its syntax
au! BufRead,BufNewFile *.markdown set filetype=mkd
au! BufRead,BufNewFile *.md set filetype=mkd
" automatically enables markdown plugins for md files, as well as plaintext
augroup markdown
autocmd!
autocmd FileType mkd call pencil#init()
autocmd FileType txt call pencil#init()
augroup END
" unify markdown extensions to all use markdown filetype
au! BufRead,BufNewFile *.markdown set filetype=markdown
au! BufRead,BufNewFile *.md set filetype=markdown
au! BufRead,BufNewFile *.mkd set filetype=markdown
" automatically enables markdown plugins for md & txt files
function! Prose()
call pencil#init()
" PLUGIN: vim-textobj-sentence
" enable extended sentence textobject use on md and plaintext files
call textobj#sentence#init()
set conceallevel=3
endfunction
" enable syntax highlighting for codeblocks WITHIN markdown
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go']
" PLUGIN: vim-textobj-sentence
" enable extended sentence textobject use on md and plaintext files
augroup textobj_sentence
autocmd!
autocmd FileType mkd call textobj#sentence#init()
autocmd FileType txt call textobj#sentence#init()
augroup END
" call the prose function defined above for any md files
autocmd FileType markdown,txt call Prose()
" or invoke it manually by writing :Prose
command! -nargs=0 Prose call Prose()
" PLUGIN: vim-pencil
" set default wrap mode to hard - TODO test which mode works better for