aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-30 09:57:59 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-30 09:57:59 -0300
commitef4d8da354c539dfd6a40e4c2ba08cec5e753d8b (patch)
treee3c6945dfda43b7db648478a591a6faba51d8a9d
parent6da0eb60ce8435917e126006b9506cbcd31b6ff0 (diff)
downloadvim-ef4d8da354c539dfd6a40e4c2ba08cec5e753d8b.tar.gz
vim-ef4d8da354c539dfd6a40e4c2ba08cec5e753d8b.tar.bz2
Feat: buffer cleansing
-rw-r--r--vim.dot.link/plugin/key_mappings.vim9
-rw-r--r--vim.dot.link/plugin/lib.vim11
2 files changed, 16 insertions, 4 deletions
diff --git a/vim.dot.link/plugin/key_mappings.vim b/vim.dot.link/plugin/key_mappings.vim
index ceb1a51..03a3b51 100644
--- a/vim.dot.link/plugin/key_mappings.vim
+++ b/vim.dot.link/plugin/key_mappings.vim
@@ -237,6 +237,11 @@ vmap <Leader>s <Plug>(simple-todo-mark-switch)
"nnoremap <Leader>c :call ToggleCheckbox()<CR>
" }}}
+"" Leader behavior {{{
+" Cleanup the buffer {{{
+noremap <leader>c :call BufferCleansing()<CR>
+" }}}
+
" Insert the current date in ISO format {{{
"
" Thanks https://vimtricks.com/p/insert-the-current-date-or-time/
@@ -245,8 +250,4 @@ 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>
" }}}
-
-" Remove trailing whitespaces {{{
-noremap <leader>w :call TrimWhitespace()<CR>
" }}}
-"
diff --git a/vim.dot.link/plugin/lib.vim b/vim.dot.link/plugin/lib.vim
index f1b2a30..1c3212e 100644
--- a/vim.dot.link/plugin/lib.vim
+++ b/vim.dot.link/plugin/lib.vim
@@ -32,3 +32,14 @@ endfun
command! TrimWhitespace call TrimWhitespace()
" }}}
+
+" Cleanup the buffer {{{
+"
+" Implement miscelaneous buffer cleansing procedures
+function BufferCleansing()
+ " Trim white spaces
+ call TrimWhitespace()
+endfunction
+
+command! BufferCleansing call BufferCleansing()
+" }}}