Add prose module to vim
This commit is contained in:
parent
0963825c61
commit
ae1a477301
4 changed files with 60 additions and 3 deletions
|
@ -290,7 +290,7 @@ onelight: &one-light
|
||||||
cyan: '0x3E999F'
|
cyan: '0x3E999F'
|
||||||
white: '0xF5F5F5'
|
white: '0xF5F5F5'
|
||||||
|
|
||||||
colors: *one-light
|
colors: *gruvbox-dark
|
||||||
|
|
||||||
# Visual Bell
|
# Visual Bell
|
||||||
#
|
#
|
||||||
|
|
|
@ -40,7 +40,7 @@ runtime! pluglist/**/*.vim
|
||||||
call plug#end()
|
call plug#end()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
colo one
|
colo gruvbox
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
" VIM SETTINGS {{{
|
" VIM SETTINGS {{{
|
||||||
|
|
|
@ -33,4 +33,4 @@ let g:one_allow_italics=1
|
||||||
let g:pencil_terminal_italics=1
|
let g:pencil_terminal_italics=1
|
||||||
|
|
||||||
" per this discussion: https://github.com/junegunn/vim-plug/issues/300
|
" per this discussion: https://github.com/junegunn/vim-plug/issues/300
|
||||||
autocmd VimEnter * colorscheme one
|
autocmd VimEnter * colorscheme gruvbox
|
||||||
|
|
57
.config/nvim/pluglist/prose.vim
Normal file
57
.config/nvim/pluglist/prose.vim
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
" Prose Workflow
|
||||||
|
Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins
|
||||||
|
Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection
|
||||||
|
" and allows you to jump to the *end* of this <g)> or last <g(> sentence.
|
||||||
|
|
||||||
|
Plug 'reedes/vim-pencil', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap
|
||||||
|
" PLUGIN: vim-pencil
|
||||||
|
" set default wrap mode to hard - TODO test which mode works better for
|
||||||
|
" me, it seems hardmode has trouble with markdown lists (see issue #31)
|
||||||
|
let g:pencil#wrapModeDefault = 'soft' " default is 'hard'
|
||||||
|
|
||||||
|
Plug 'junegunn/goyo.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
|
||||||
|
" 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
|
||||||
|
" disable line highlighting, we really don't need it for prose
|
||||||
|
set nocursorline
|
||||||
|
" 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
|
||||||
|
set cursorline
|
||||||
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
Plug 'junegunn/limelight.vim', { 'for': ['markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
|
||||||
|
|
||||||
|
" PROSE: function to automatically enables markdown plugins for md & txt files
|
||||||
|
function! Prose()
|
||||||
|
call plug#load('vim-pencil')
|
||||||
|
call plug#load('goyo.vim')
|
||||||
|
call plug#load('limelight.vim')
|
||||||
|
call pencil#init()
|
||||||
|
" PLUGIN: vim-textobj-sentence
|
||||||
|
" enable extended sentence textobject use on md and plaintext files
|
||||||
|
call textobj#sentence#init()
|
||||||
|
" hide the markdown cruft
|
||||||
|
setlocal conceallevel=2
|
||||||
|
setlocal foldlevel=2
|
||||||
|
endfunction
|
||||||
|
" enable syntax highlighting for codeblocks WITHIN markdown
|
||||||
|
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'javascipt', 'go']
|
||||||
|
|
||||||
|
" call the prose function defined above for any md files
|
||||||
|
au FileType pandoc,markdown,md,mkd call Prose()
|
||||||
|
" or invoke it manually by writing :Prose
|
||||||
|
command! -nargs=0 Prose call Prose()
|
Loading…
Reference in a new issue