]> gitweb.fluxo.info Git - rhatto/dotfiles/vim.git/commitdiff
Feat: folding markers
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 28 Jul 2024 23:31:25 +0000 (20:31 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 28 Jul 2024 23:31:25 +0000 (20:31 -0300)
vim.dot.link/filetype.vim
vim.dot.link/plugin/auto_file.vim
vim.dot.link/plugin/key_mappings.vim
vim.dot.link/plugin/session_workarounds.vim

index 5513aa17a8a28ded4ba96f7986fa18f34d722b32..f3c90bb5145894a191bc453c71778b2719ab76b9 100644 (file)
@@ -4,6 +4,12 @@ if exists("did_load_filetypes")
   finish
 endif
 
+" VIM filetype
+augroup filetype_vim
+  autocmd!
+  autocmd FileType vim setlocal foldmethod=marker
+augroup END
+
 " Filetype detection
 "
 " According to ":help BufRead", this augroup is also evaluated also on
@@ -26,7 +32,7 @@ augroup END
 
 " Drupal *.module and *.install files.
 if has("autocmd")
-  augroup module
+  augroup filetype_drupal
     autocmd!
     autocmd BufRead,BufNewFile *.profile setfiletype php
     autocmd BufRead,BufNewFile *.module  setfiletype php
index dc19ad3b13cb17a356a9234d6e3db43e1829c007..72e782fd538bf1169f17b45075caa1684e5f889b 100644 (file)
@@ -1,18 +1,20 @@
 " auto_file.vim - Automatically file reading, saving; directory changer.
 
-" Autoread
+" Autoread {{{
 "
 " http://vim.wikia.com/wiki/Have_Vim_check_automatically_if_the_file_has_changed_externally
 " http://stackoverflow.com/questions/2490227/how-does-vims-autoread-work
 " http://stackoverflow.com/questions/2490227/how-does-vims-autoread-work
 "au FocusGained,BufEnter * :silent! !
 "au FocusLost,WinLeave * :silent! w
+" }}}
 
-" Autosave
+" Autosave {{{
 " See https://github.com/vim-scripts/vim-auto-save
 "let g:auto_save = 1
+" }}}
 
-" Auto change dir
+" Auto change dir {{{
 "
 " Automatically set the current working directory to the current buffer file's
 " directory
@@ -23,3 +25,4 @@ augroup changedir
   autocmd!
   autocmd BufEnter * silent! lcd %:p:h
 augroup END
+" }}}
index 026f503647d85b6ab6d360f8a6bc479a81efeed9..2b0f2e792a088e6a70aec5da41dba270b8279e4b 100644 (file)
 "
 " The sollution is to decrease ESC timeout.
 "
+
+" Decrease ESC delays {{{
 " See https://www.johnhawthorn.com/2012/09/vi-escape-delays/
 "set timeoutlen=1000 ttimeoutlen=0
 set timeoutlen=0 ttimeoutlen=0
+" }}}
 
+" ESC-based shortcuts {{{
 " Write, quit and close shortcuts using Esc <key> notation (works also with <Alt-key>)
 nnoremap <ESC>n :tabnew<CR>
 nnoremap <ESC>t :NERDTree 
@@ -74,7 +78,9 @@ inoremap <ESC>c <ESC>:tabclose<CR>
 " We're closing the buffer instead of just the window to avoid slowness due to too many opened buffers
 inoremap <ESC>m <ESC>:bd<CR>
 inoremap <ESC>w <ESC>:w<CR>
+" }}}
 
+" Alt-based shortcuts {{{
 " Write, quit and close shortcuts using Alt-key combo notation
 "noremap \en :tabnew<CR>
 "noremap \et :OpenNERDTree<CR>
@@ -98,7 +104,9 @@ inoremap <ESC>w <ESC>:w<CR>
 "inoremap \ee <ESC>:tabclose<CR>
 "inoremap \em <ESC>:q!<CR>
 "inoremap \ew <ESC>:w<CR>
+" }}}
 
+" Crtl-based shortcuts {{{
 " Write, quit and close shortcuts using Ctrl-key combos
 " We're using these due to a conflict with wyrd(1)
 "nnoremap <C-n> :tabnew<CR>
@@ -122,16 +130,18 @@ inoremap <ESC>w <ESC>:w<CR>
 "inoremap <C-e> <ESC>:tabclose<CR>
 "inoremap <C-m> <ESC>:q!<CR>
 "inoremap <C-w> <ESC>:w<CR>
+" }}}
 
-" Write, quit and close shortcuts
+" Write, quit and close shortcuts {{{
 noremap q :Wipeout<CR>:wqa <CR>
 "noremap f :wq <CR>
 "noremap t :tabclose <CR>
 "noremap m :q! <CR>
 "noremap w :w <CR>
 noremap h :tabnew<CR>
+" }}}
 
-" Tab navigation
+" Tab navigation {{{
 " See http://vim.wikia.com/wiki/Alternative_tab_navigation
 "     http://comments.gmane.org/gmane.os.cygwin.xfree/16419
 nnoremap    <ESC>[5^    <C-PageUp>
@@ -148,12 +158,14 @@ nnoremap \e7 7gt
 nnoremap \e8 8gt
 nnoremap \e9 9gt
 nnoremap \e0 10gt
+" }}}
 
-" Buffer navigation: Alt-{Up,Down}
+" Buffer navigation: Alt-{Up,Down} {{{
 noremap \eOd :bprevious<CR>
 noremap \eOc :bnext<CR>
+" }}}
 
-" Window navigation
+" Window navigation {{{
 "noremap <C-Left> <C-w><Left>
 "noremap <C-Right> <C-w><Right>
 "noremap <C-Down> <C-w><Down>
@@ -178,21 +190,29 @@ inoremap <ESC><Left> <ESC><C-w><Left>
 inoremap <ESC><Right> <ESC><C-w><Right>
 inoremap <ESC><Down> <ESC><C-w><Down>
 inoremap <ESC><Up> <ESC><C-w><Up>
+" }}}
 
-" Recording
+" Recording {{{
 nnoremap Q q
+" }}}
 
+" Copy and paste {{{
+"
 " See http://superuser.com/questions/10588/how-to-make-cut-copy-paste-in-gvim-on-ubuntu-work-with-ctrlx-ctrlc-ctrlv
 "imap <C-v> <C-r><C-o>+
 "vmap <C-v> c<ESC>"+p
 vnoremap <C-c> "+yi
 vnoremap <C-x> "+c
+" }}}
 
-" For email: unfold and delete to your signature
+" Email {{{
+"
+" Unfold and delete to your signature
 " See https://hroy.eu/tips/vim/email-delete-til-signature/
 noremap ,dd zi:.;/^-- $/d<CR>O-- <UP><End><CR><CR><UP><CR><C-O>zi
+" }}}
 
-" Simple TODO lists
+" Task lists {{{
 " https://github.com/vitalk/vim-simple-todo/
 let g:simple_todo_map_keys = 0
 let g:simple_todo_list_symbol = '*'
@@ -215,11 +235,13 @@ vmap <Leader>s <Plug>(simple-todo-mark-switch)
 
 " From lib.vim
 "nnoremap <Leader>c :call ToggleCheckbox()<CR>
+" }}}
 
-" Insert the current date in ISO format
+" Insert the current date in ISO format {{{
 "
 " Thanks https://vimtricks.com/p/insert-the-current-date-or-time/
 "map <leader>d :0put =strftime('%Y-%m-%d')<CR>
 nnoremap <leader>d i<C-R>=strftime('%Y-%m-%d')<CR>
 inoremap <leader>d <C-R>=strftime('%Y-%m-%d')<CR>
 map <leader>e :put =strftime('## %Y-%m-%d')<CR>
+" }}}
index 3b43b5bd4e7216a183a5f6d8c74b981768b51460..31dec9f2dcc479d08073d6341850208fde7b273e 100644 (file)
@@ -3,7 +3,7 @@
 " Author: Silvio Rhatto <rhatto@riseup.net>
 "
 
-" Fix NERDTree width
+" Fix NERDTree width {{{
 "
 " Useful after restoring sessions between screen size changes (such
 " as when you share sessions between different computers).
@@ -20,8 +20,9 @@ endfunction
 
 " In case you want to invoke FixWindowWidths explicitly
 command! -bang FixWindowWidths :call FixWindowWidths()
+" }}}
 
-" Fix window widths on all tabs
+" Fix window widths on all tabs {{{
 function FixAllWindowWidths()
   " Make sure to run this only once
   if exists("did_fixed_window_widths")
@@ -41,8 +42,9 @@ function FixAllWindowWidths()
 
   let did_fixed_window_widths=1
 endfunction
+" }}}
 
-" Ensure the window has maximized height
+" Ensure the window has maximized height {{{
 "
 " This helps restoring the window size after reopening sessions after
 " switching monitors (like from laptop screen to external HDMI monitor).
@@ -78,14 +80,16 @@ function FixWindowHeights()
     "    execute ':set lines=' . winheight(0) - 3
   endif
 endfunction
+" }}}
 
-" Restore all window sizes
+" Restore all window sizes {{{
 function RestoreWindowSizes()
   call FixWindowHeights()
   call FixAllWindowWidths()
 endfunction
+" }}}
 
-" Fix all window sizes
+" Fix all window sizes {{{
 augroup workaround
   autocmd!
   " This tends to fire for every buffer
@@ -95,3 +99,4 @@ augroup workaround
   " restored.
   "autocmd workaround VimEnter * call FixAllWindowWidths()
 augroup END
+" }}}