add markdown workflow plugins

This commit is contained in:
Marty Oehme 2019-03-20 18:37:04 +01:00
parent 0efb98fa30
commit 98f4ce3225

View file

@ -8,6 +8,8 @@
" Junegunn Choi
" Tim Pope
" this config does not set nocompatible - neovim does this automatically
" this config does not set filetype plugin - vim-sensible does this
" }}}
" ================================================================================
" PLUGIN INSTALLATION - handled by VIM-PLUG {{{
@ -56,6 +58,12 @@ Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
Plug 'valloric/matchtagalways'
Plug 'alvan/vim-closetag'
" Markdown Workflow
Plug 'reedes/vim-pencil' " provide md convenience functions like hard/softwrap
Plug 'junegunn/goyo.vim' " provide distraction free writing
Plug 'junegunn/limelight.vim' " provide even distraction free-er writing (lowlight paragraphs)
Plug 'rhysd/vim-grammarous' " integrate vim with languagetool for grammar checking (needs java8)
" For async completion
Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs
Plug 'w0rp/ale' " asynchronous linting - might be superseded by lsp or coc.nvim at some point
@ -97,6 +105,44 @@ augroup nerd_loader
\| endif
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
" enable syntax highlighting for codeblocks WITHIN markdown
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go']
" PLUGIN: vim-pencil
" set default wrap mode to hard - I should test which mode works better for
" me, though I would venture a guess that hard is preferable
let g:pencil#wrapModeDefault = 'hard' " default is 'hard'
" PLUGIN: goyo
" set up functions for entering/exiting distraction free mode, or leaving it
function! s:goyo_enter()
" remove the tmux status bar for actual distraction free environment
silent !tmux set status off
" maximize the tmux pane that vim is in if any (usually I have vim open as the only pane)
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
" enable limelight which highlights whatever paragraph you are in and lowlights the rest
Limelight
endfunction
function! s:goyo_leave()
silent !tmux set status on
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
Limelight!
endfunction
" actually call the functions on entering/leaving goyo
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
" PLUGIN: DEOPLETE
" enable deoplete at startup
let g:deoplete#enable_at_startup = 1
@ -241,6 +287,15 @@ nnoremap <leader><C-e> :NERDTreeVCS<CR>
" open current nerdtree with current file highlighted
nnoremap <leader>E :NERDTreeFind<CR>
" Mostly dealing with Prose writing from here on out
" Format current Paragraph (esp useful in prose writing)
nnoremap <silent> <leader>q gqap
xnoremap <silent> <leader>q gq
nnoremap <silent> <leader>Q vapJgqap
" Enter distraction free prose mode with F11
noremap <F11> :Goyo<CR>
" }}}
" ================================================================================
" END