(import-macros {: ag! : au!} :nvrc.macro.event) (import-macros {: set! : setl!} :nvrc.macro.set) (local {: echo!} (require :nvrc.lib.io)) (local {: line : mode} vim.fn) (fn cmd! [...] (vim.cmd ...)) (fn bufexists? [...] (= (vim.fn.bufexists ...) 1)) ; Restore cursor style to beam on exit (ag! restore-cursor (au! VimLeave * (set! guicursor ["a:ver75-blinkon0"]))) ; Restore the last cursor line (ag! restore-last-cursor-line (au! BufReadPost * (if (and (> (line "'\"") 1) (<= (line "'\"") (line "$"))) (cmd! "normal! g'\"")))) ; Resize splits on window resize (ag! resize-splits-on-resize (au! VimResized * "wincmd =")) ;; Read file when it changes on disk (ag! read-file-on-disk-change (au! [FocusGained BufEnter CursorHold CursorHoldI] * (if (and (not= :c (mode)) (not (bufexists? "[Command Line]"))) (cmd! "checktime"))) (au! FileChangedShellPost * (echo! "File changed on disk. Buffer reloaded."))) (ag! terminal-options ;; Enter Terminal-mode (insert) agtomatically (au! TermOpen * "startinsert") ;; Disables line number on terminal buffers (au! TermOpen * (do (setl! nonumber) (setl! norelativenumber))) ;; Disables spell on terminal buffers (au! TermOpen * (setl! nospell)) ;; Disables sign column on terminal buffers (au! TermOpen * (setl! signcolumn :no)) ;; Disables colorcolumn on terminal buffers (au! TermOpen * (setl! colorcolumn [])))