mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-01-28 11:29:56 -06:00
nvim - start of moving modules to pure fennel
This commit is contained in:
@@ -1,65 +1,58 @@
|
|||||||
(module dotfiles.conceal
|
(local u (require :dotfiles.util))
|
||||||
{autoload {nvim aniseed.nvim
|
|
||||||
nu aniseed.nvim.util
|
|
||||||
u dotfiles.util}})
|
|
||||||
|
|
||||||
|
(local conceals {:defn "𝑓"
|
||||||
(def conceals {:defn :𝑓
|
|
||||||
;; :defn- :
|
;; :defn- :
|
||||||
:fn :λ
|
:fn "λ"
|
||||||
:lambda :λ
|
:lambda "λ"
|
||||||
:and :∧
|
:and "∧"
|
||||||
:&& :∧
|
:&& "∧"
|
||||||
:or :∨
|
:or "∨"
|
||||||
:|| :∨
|
:|| "∨"
|
||||||
:not :¬
|
:not "¬"
|
||||||
:! :¬
|
:! "¬"
|
||||||
:for :∀
|
:for "∀"
|
||||||
:in :∈
|
:in "∈"
|
||||||
; "\\<not\\> \\<in\\>" :∉
|
; "\\<not\\> \\<in\\>" :∉
|
||||||
:true :⊤
|
:true "⊤"
|
||||||
:false :⊥
|
:false "⊥"
|
||||||
;; and
|
;; and
|
||||||
;; or
|
;; or
|
||||||
;; if-not
|
;; if-not
|
||||||
;; when-not
|
;; when-not
|
||||||
;; (not
|
;; (not
|
||||||
;; None | ∅
|
;; None | ∅
|
||||||
;; true, false | ⊤, ⊥ (top and bottom from logic)
|
;; true, false | ⊤, ⊥ (top and bottom from logic)
|
||||||
;;
|
;;
|
||||||
;; for | ∀
|
;; for | ∀
|
||||||
;; in | ∈
|
;; in | ∈
|
||||||
;; not in | ∉
|
;; not in | ∉
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(fn setup-conceals []
|
||||||
(defn setup-conceals []
|
(vim.fn.clearmatches)
|
||||||
(nvim.fn.clearmatches)
|
|
||||||
(each [the-match replacement (pairs conceals)]
|
(each [the-match replacement (pairs conceals)]
|
||||||
(let [the-match (.. "\\<" the-match "\\>" )]
|
(let [the-match (.. "\\<" the-match "\\>")]
|
||||||
(nvim.fn.matchadd :Conceal the-match 0 -1 {:conceal replacement})))
|
(vim.fn.matchadd :Conceal the-match 0 -1 {:conceal replacement})))
|
||||||
|
(set vim.wo.conceallevel 2)
|
||||||
|
(set vim.wo.concealcursor :nvc))
|
||||||
|
|
||||||
(set nvim.wo.conceallevel 2)
|
(fn toggle-conceal []
|
||||||
(set nvim.wo.concealcursor :nvc))
|
(if (= 0 vim.wo.conceallevel)
|
||||||
|
(set vim.wo.conceallevel 2)
|
||||||
|
(set vim.wo.conceallevel 0)))
|
||||||
(defn toggle-conceal []
|
|
||||||
( if (= 0 nvim.wo.conceallevel)
|
|
||||||
(set nvim.wo.conceallevel 2)
|
|
||||||
(set nvim.wo.conceallevel 0)))
|
|
||||||
|
|
||||||
;(setup-conceals)
|
;(setup-conceals)
|
||||||
;(toggle-conceal)
|
;(toggle-conceal)
|
||||||
;(if true true false)
|
;(if true true false)
|
||||||
|
|
||||||
|
(vim.api.nvim_create_user_command :ToggleConceal toggle-conceal {})
|
||||||
(nu.fn-bridge :ToggleConceal :dotfiles.conceal :toggle-conceal {:return false})
|
(vim.api.nvim_create_user_command :SetupConceals setup-conceals {})
|
||||||
(nu.fn-bridge :SetupConceals :dotfiles.conceal :setup-conceals {:return false})
|
|
||||||
(u.nnoremap :<leader>ts "call ToggleConceal()")
|
(u.nnoremap :<leader>ts "call ToggleConceal()")
|
||||||
|
|
||||||
(def pretty-filetypes [:fennel
|
(local pretty-filetypes [:fennel :clojure])
|
||||||
:clojure])
|
|
||||||
|
|
||||||
(each [_ ftype (pairs pretty-filetypes)]
|
(each [_ ftype (pairs pretty-filetypes)]
|
||||||
(nvim.ex.autocmd :FileType ftype :call "SetupConceals()"))
|
(vim.api.nvim_create_autocmd [:FileType]
|
||||||
|
{:pattern ftype :callback setup-conceals}))
|
||||||
|
|
||||||
|
{}
|
||||||
|
|||||||
@@ -1,23 +1,32 @@
|
|||||||
(module dotfiles.util {autoload {a aniseed.core} require {nvim aniseed.nvim}})
|
(local a (require :aniseed.core))
|
||||||
|
|
||||||
(defn noremap [mode from to opts]
|
(fn noremap [mode from to opts]
|
||||||
(let [map-opts {:noremap true :silent true}
|
(let [map-opts {:noremap true :silent true}
|
||||||
to (.. ":" to :<cr>)
|
to (.. ":" to :<cr>)
|
||||||
buff-num (a.get opts :buff-num)]
|
buff-num (a.get opts :buff-num)]
|
||||||
(if (or (a.get opts :local?) buff-num)
|
(if (or (a.get opts :local?) buff-num)
|
||||||
(nvim.buf_set_keymap (or buff-num 0) mode from to map-opts)
|
(vim.api.nvim_buf_set_keymap (or buff-num 0) mode from to map-opts)
|
||||||
(nvim.set_keymap mode from to map-opts))))
|
(vim.api.nvim_set_keymap mode from to map-opts))))
|
||||||
|
|
||||||
(defn nnoremap [from to opts] (noremap :n from to opts))
|
(fn nnoremap [from to opts] (noremap :n from to opts))
|
||||||
|
|
||||||
(defn tnoremap [from to opts] (noremap :t from to opts))
|
(fn tnoremap [from to opts] (noremap :t from to opts))
|
||||||
|
|
||||||
(defn inoremap [from to opts] (noremap :i from to opts))
|
(fn inoremap [from to opts] (noremap :i from to opts))
|
||||||
|
|
||||||
(defn vnoremap [from to opts] (noremap :v from to opts))
|
(fn vnoremap [from to opts] (noremap :v from to opts))
|
||||||
|
|
||||||
(defn lnnoremap [from to] (nnoremap (.. :<leader> from) to))
|
(fn lnnoremap [from to] (nnoremap (.. :<leader> from) to))
|
||||||
|
|
||||||
(defn ltnoremap [from to opts] (noremap :v (.. :<leader> from) to opts))
|
(fn ltnoremap [from to opts] (noremap :v (.. :<leader> from) to opts))
|
||||||
|
|
||||||
(defn lvnoremap [from to opts] (noremap :t (.. :<leader> from) to opts))
|
(fn lvnoremap [from to opts] (noremap :t (.. :<leader> from) to opts))
|
||||||
|
|
||||||
|
{: noremap
|
||||||
|
: nnoremap
|
||||||
|
: tnoremap
|
||||||
|
: inoremap
|
||||||
|
: vnoremap
|
||||||
|
: lnnoremap
|
||||||
|
: ltnoremap
|
||||||
|
: lvnoremap}
|
||||||
|
|||||||
Reference in New Issue
Block a user