helm/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl

36 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

; Kitaab is why I'm so tied to vim.
; If only I could find a nice notes editor...
2024-08-25 23:44:07 -07:00
(local nvim (require :lib/nvim))
(import-macros {: do-req } :lib/macros)
2024-08-25 23:44:07 -07:00
(nvim.g :vimwiki_list [{:path "~/kitaab/vimwiki"
:auto_tags 1
:auto_diary_index 1
:auto_generate_links 0
:nested_syntaxes {:python "python"
:c++ "cpp"
:nix "nix"
:bash "sh"}}])
(nvim.g :zettel_format "%y%m%d-%H%M")
; Custom functions
(fn update_date []
(var written false)
(let [time (os.date "%Y-%m-%d %H:%M")
message (.. "%update " time)
lines (vim.api.nvim_buf_get_lines 0 0 4 false)]
(each [index line (ipairs lines)]
(if (and (= (length line) 0) (not written))
(do
(vim.api.nvim_buf_set_lines 0 (- index 1) index false [message ""])
(set written true)))
(if (and (= index 4) (not written))
(vim.api.nvim_buf_set_lines 0 3 index false [message])))))
(vim.api.nvim_create_autocmd "BufWritePre" {:pattern ["*.wiki"]
:callback update_date})
(do-req :hologram :setup {:auto_display false})