]> gitweb.fluxo.info Git - rhatto/dotfiles/vim.git/commitdiff
Fix: markdown updates
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 28 Jul 2024 17:11:28 +0000 (14:11 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 28 Jul 2024 17:11:28 +0000 (14:11 -0300)
vim.dot.link/filetype.vim
vim.dot.link/plugin/session_workarounds.vim

index 9204987ad4205cd279ff293d59c25a38abf241d0..26e7eeaf148df3ec00ad045b1f0b859c80e9fe1a 100644 (file)
@@ -6,13 +6,6 @@ endif
 
 " Markdown
 augroup markdown
-  " File extensions
-  autocmd!
-  autocmd BufRead,BufNewFile *.md   setfiletype markdown
-  autocmd BufRead,BufNewFile *.mkd  setfiletype markdown
-  autocmd BufRead,BufNewFile *.md   setfiletype markdown
-  autocmd BufRead,BufNewFile *.mdwn setfiletype ikiwiki
-
   " Markdown configuration
   "
   " Include folding setup:
@@ -20,8 +13,12 @@ augroup markdown
   "
   " Alternative folding method:
   " https://codereview.stackexchange.com/questions/202620/vim-plugin-for-folding-markdown-lists
-  autocmd FileType markdown set foldexpr=NestedMarkdownFolds()
-  autocmd FileType markdown set autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:>
+  "
+  " Seem like this things should be set during BufRead or BufNewFile; they're
+  " not working when set during the FileType event.
+  autocmd!
+  autocmd BufRead,BufNewFile *.md   set filetype=markdown foldexpr=NestedMarkdownFolds() autoindent smartindent tabstop=2 softtabstop=2 shiftwidth=2 expandtab formatoptions=tcroqn2 comments=n:>
+  autocmd BufRead,BufNewFile *.mdwn set filetype=ikiwiki  foldexpr=NestedMarkdownFolds()
 augroup END
 
 " Python
@@ -65,6 +62,9 @@ augroup mail
 augroup END
 
 " Other filetypes
+"
+" According to ":help BufRead", this augroup is also evaluated also on
+" ":filetype detect".
 augroup filetypedetect
   autocmd!
   autocmd BufRead,BufNewFile kvmxfile    setfiletype sh
index ec891a8bbbf48e298787e69fc47398e5f55f7e1e..af11f3da312f4482156ff9a42cd76b9133d0d377 100644 (file)
@@ -55,6 +55,7 @@ endfunction
 "
 " https://superuser.com/questions/140419/how-to-start-gvim-maximized
 " https://vim.fandom.com/wiki/Maximize_or_set_initial_window_size
+" https://vi.stackexchange.com/questions/8926/is-it-possible-to-obtain-the-displayable-area-width-and-height-of-current-buffe
 "let lines_initial=&l:lines
 function FixWindowHeights()
     " Set the maximum available height
@@ -62,6 +63,9 @@ function FixWindowHeights()
 
     " Set the lines depending on the LINES environment variable
     " or through tput.
+    "
+    " This is not always inherited by vim:
+    " https://github.com/vim/vim/issues/12160
     if $LINES != ""
         execute ':set lines=' . $LINES
     else