A bunch of changes
This commit is contained in:
@ -33,15 +33,8 @@
|
||||
:pattern ,pattern_table
|
||||
:callback ,callback })))
|
||||
;; Nicer macro for use
|
||||
;; (lambda use! [repo ...]
|
||||
;; (local output [ repo ])
|
||||
;; (var last_key nil)
|
||||
;; (each [_ val (ipairs [...])]
|
||||
;; (if last_key
|
||||
;; (do (tset output last_key val)
|
||||
;; (set last_key nil))
|
||||
;; (set last_key val)))
|
||||
;; `(use ,output))
|
||||
;; :config acts like use-package's :init and :config options,
|
||||
;; taking in the following lisp expressions as its arguments
|
||||
(lambda use! [repo ...]
|
||||
(local output [ repo ])
|
||||
(var last_key nil)
|
||||
@ -64,8 +57,7 @@
|
||||
(tset output :config config_entries))
|
||||
`(use ,output))
|
||||
|
||||
;; Can be passed to :config of `use!'
|
||||
;; to call a plugin's `setup' function
|
||||
;; Call a plugin's `setup function'
|
||||
(lambda setup! [pkg ...] (local output [ ])
|
||||
(var last_key nil)
|
||||
(each [_ val (ipairs [...])]
|
||||
@ -79,13 +71,25 @@
|
||||
(lambda module-call! [mod func ...]
|
||||
`((. (require ,mod) ,func) ,...))
|
||||
|
||||
;; Return module function
|
||||
;; Return module function
|
||||
(lambda module-fn! [mod func]
|
||||
`(. (require ,mod) ,func))
|
||||
|
||||
;; Basically does what the Emacs function of the same name does.
|
||||
;; Wraps the code inside with a `winsaveview' and `winrestview'
|
||||
(lambda save-excursion! [...]
|
||||
(let [args [...]
|
||||
len (# args)]
|
||||
(tset args len `(let [retvar# ,(. args len)]
|
||||
(vim.fn.winrestview save#)
|
||||
retvar#))
|
||||
`(let [save# (vim.fn.winsaveview)]
|
||||
,(unpack args))))
|
||||
|
||||
{: bind!
|
||||
: hook!
|
||||
: use!
|
||||
: setup!
|
||||
: module-call!
|
||||
: module-fn!}
|
||||
: module-fn!
|
||||
: save-excursion!}
|
||||
|
Reference in New Issue
Block a user