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