From 85100995dfb3964ea7c4e44c2de198afb4bcfaa6 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 20 May 2019 17:13:38 +0200 Subject: [PATCH] unify vim prose functionality under one function --- .config/nvim/init.vim | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 2100709..8d5d1d6 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -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