Add limelight and goyo for better markdown editing
diff --git a/modules/neovim/markdown/default.nix b/modules/neovim/markdown/default.nix
index 214796b..4836eca 100644
--- a/modules/neovim/markdown/default.nix
+++ b/modules/neovim/markdown/default.nix
@@ -6,7 +6,12 @@
markdown-preview-nvim
vim-table-mode
vim-pandoc
+ goyo-vim
+ limelight-vim
];
- extraConfig = builtins.readFile ./markdown.vim;
+ extraConfig = ''
+ ${builtins.readFile ./markdown.vim}
+ ${builtins.readFile ./limelight.vim}
+ '';
};
}
diff --git a/modules/neovim/markdown/limelight.vim b/modules/neovim/markdown/limelight.vim
new file mode 100644
index 0000000..2abd4cf
--- /dev/null
+++ b/modules/neovim/markdown/limelight.vim
@@ -0,0 +1,21 @@
+autocmd User GoyoEnter Limelight
+autocmd User GoyoLeave Limelight!
+
+function s:loadListChars()
+ if exists("b:savedListChars")
+ let &listchars = g:savedListChars
+ endif
+endfunction
+
+function s:saveListchars()
+ let g:savedListChars = &listchars
+ let &listchars=""
+endfunction
+
+autocmd User GoyoLeave call s:loadListChars()
+autocmd User GoyoEnter call s:saveListchars()
+
+let g:limelight_conceal_ctermfg = g:lightgrey.cterm
+let g:limelight_conceal_guifg = g:lightgrey.gui
+let g:limelight_paragraph_span = 1
+let g:limelight_priority = -1
diff --git a/modules/neovim/markdown/markdown.vim b/modules/neovim/markdown/markdown.vim
index b4014c0..c6bd8f1 100644
--- a/modules/neovim/markdown/markdown.vim
+++ b/modules/neovim/markdown/markdown.vim
@@ -12,3 +12,17 @@
let g:mkdp_auto_close = 0
autocmd FileType markdown call tablemode#Enable()
+
+call g:SetupCommandAlias("goyo", "Goyo")
+nnoremap <silent> <leader>wm :Goyo<CR>
+let g:goyo_width = 83
+
+function s:DisableTextwidthOnTable()
+ if tablemode#table#IsTable(".")
+ setlocal textwidth=0
+ else
+ let &l:textwidth=&g:textwidth
+ endif
+endfunction
+
+autocmd CursorMovedI,CursorMoved,BufEnter *.md call s:DisableTextwidthOnTable()