A bunch of changes

This commit is contained in:
2022-12-31 18:18:49 -08:00
parent 5d67fcbb0c
commit 271319297d
2 changed files with 22 additions and 16 deletions
+5 -3
View File
@@ -1,6 +1,7 @@
;;; init.fnl - primary init file
(import-macros {: bind! : module-call! : hook!} :macros)
(import-macros {: bind! : module-call! : hook!
: save-excursion! } :macros)
;; Make space leader
(set vim.g.mapleader " ")
@@ -61,8 +62,9 @@
;; Remove trailing whitespace
(fn remove-trailing-whitespace []
"Remove trailing whitespace from the whole file."
(pcall vim.cmd "%s/ \\+$//")
(vim.cmd.nohlsearch))
(save-excursion!
(vim.api.nvim_exec "keepjumps keeppatterns silent! %s/ \\+$//" false)
(vim.api.nvim_exec "keepjumps keeppatterns silent! 0;/^\\%(\\n*.\\)\\@!/,$d_" false)))
(vim.api.nvim_create_user_command :RemoveTrailingWhitespace
remove-trailing-whitespace {})
(hook! [ :BufWritePre ] "*" remove-trailing-whitespace)