ref(nvim): made everything a tiny module

This commit is contained in:
Léana 江 2024-02-03 17:02:38 +01:00 committed by Léana 江
parent f0fd9699cc
commit 7a5e1537e8
4 changed files with 1 additions and 1 deletions

View file

@ -0,0 +1,44 @@
(import-macros {: set!} :hibiscus.vim)
(let [opts {;; search
:hlsearch false
:incsearch true
:ignorecase true
:smartcase true
;; line number
:number true
:relativenumber true
:signcolumn :yes
:cursorline true
;; spacing
:tabstop 4
:expandtab true
:shiftwidth 4
:autoindent true
:smartindent true
;; line breaking
:wrap false
:linebreak true
:breakindent true
;; no ~swp nonsense
:filetype :on
:swapfile false
:backup false
:undofile true
;; terminal
:termguicolors true
:mouse :a
:scrolloff 3
:colorcolumn :80
;; folding
:foldlevel 99
:foldlevelstart 99
:foldenable true
;; winbar
:winbar "%{%v:lua.require'opts.winbar'.eval()%}"
:showmode false
;; listing
:listchars {:tab "│ " :trail "␣"}
:list true}]
(each [k v (pairs opts)]
(set! k v)))

View file

@ -0,0 +1,19 @@
(local M {})
(local api vim.api)
(api.nvim_set_hl 0 :WinBar {:fg "#dedede"})
(api.nvim_set_hl 0 :WinBarPath {:bg "#dedede"})
(api.nvim_set_hl 0 :WinBarModified {:bg "#dedede" :bold true})
(fn M.eval []
(let [buffer (api.nvim_win_get_buf 0)]
(var bufname (vim.fn.bufname buffer))
(var modified "")
(var readonly "")
(when (. (. vim.bo buffer) :readonly) (set readonly "[RO] "))
(when (. (. vim.bo buffer) :modified) (set modified "[+] "))
(set bufname (vim.fn.fnamemodify bufname ":p:~"))
(.. "%=" "%#WinBarModified#" readonly modified "%*" "%#WinBarPath#" bufname
"%*")))
M