nvim - further migration to pure fennel from aniseed

This commit is contained in:
2025-04-30 09:59:35 -05:00
parent 07eb5d3b94
commit 5174167c99
25 changed files with 444 additions and 482 deletions

View File

@@ -1,28 +1,23 @@
(module dotfiles.core (local a (require :aniseed.core))
{autoload {a aniseed.core}
require {anenv aniseed.env nvim aniseed.nvim}})
(local u (require :dotfiles.util)) (local u (require :dotfiles.util))
(nvim.ex.set :shortmess+=c) (vim.cmd.set :shortmess+=c)
; don't give |ins-completion-menu| messages. ; don't give |ins-completion-menu| messages.
(nvim.ex.set :path+=**) (vim.cmd.set :path+=**)
(nvim.ex.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*") (vim.cmd.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*")
(defn- safe-source (fn safe-source [filename]
[filename] (let [glob (vim.fn.glob filename)]
(let [glob (nvim.fn.glob filename)]
(if (not (a.empty? glob)) (if (not (a.empty? glob))
(nvim.ex.source filename)))) (vim.fn.source filename))))
; (a.map safe-source ["~/.vimrc" "~/.vimrc.local"]) ; (a.map safe-source ["~/.vimrc" "~/.vimrc.local"])
(def- backup-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup)) (local backup-dir (.. (vim.fn.glob :$HOME) :/.vim/backup))
(def- undo-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup)) (local undo-dir (.. (vim.fn.glob :$HOME) :/.vim/backup))
(def- on-opts (local on-opts [:autoindent
[:autoindent
:autoread :autoread
:expandtab :expandtab
:exrc :exrc
@@ -46,8 +41,7 @@
:undofile :undofile
:wildmenu]) :wildmenu])
(def- val-based-opts (local val-based-opts {; :t_Co 256
{; :t_Co 256
:laststatus 2 :laststatus 2
:encoding :utf-8 :encoding :utf-8
:history 500 :history 500
@@ -86,16 +80,15 @@
:wildmode "list:longest,list:full" :wildmode "list:longest,list:full"
:wrap false}) :wrap false})
(def- append-val-opts {:diffopt "algorithm:patience"}) (local append-val-opts {:diffopt "algorithm:patience"})
(defn- set-opt [[opt val]] (tset vim.opt (a.str opt) val)) (fn set-opt [[opt val]] (tset vim.opt (a.str opt) val))
(defn- set-opt+ (fn set-opt+ [[opt val]]
[[opt val]] (let [existing-opt-val (a.get vim.o opt)]
(let [existing-opt-val (a.get nvim.o opt)]
(tset vim.opt (a.str opt) (a.str existing-opt-val "," val)))) (tset vim.opt (a.str opt) (a.str existing-opt-val "," val))))
(defn- set-opt-on [opt] (set-opt [opt true])) (fn set-opt-on [opt] (set-opt [opt true]))
(a.map set-opt-on on-opts) (a.map set-opt-on on-opts)
@@ -103,12 +96,17 @@
(a.map-indexed set-opt+ append-val-opts) (a.map-indexed set-opt+ append-val-opts)
(nvim.ex.syntax :on) (vim.cmd.syntax :on)
;; (nvim.ex.colorscheme :soluarized) ;; (nvim.ex.colorscheme :soluarized)
(nvim.ex.colorscheme :solarized8) (vim.cmd.colorscheme :solarized8)
;; (nvim.ex.autocmd "vimenter" "*" "++nested" "colorscheme" "soluarized") ;; (nvim.ex.autocmd "vimenter" "*" "++nested" "colorscheme" "soluarized")
(nvim.ex.autocmd :vimenter "*" :++nested :colorscheme :solarized8)
(vim.api.nvim_create_autocmd [:vimenter]
{:pattern "*"
:command "colorscheme solarized8"
:nested true})
;(nvim.ex.autocmd "vimenter" "*" "luafile" "treesitter.lua") ;(nvim.ex.autocmd "vimenter" "*" "luafile" "treesitter.lua")
; ;
; (nvim.fn.glob "~/.vimrc.local") ; (nvim.fn.glob "~/.vimrc.local")
@@ -120,7 +118,7 @@
(u.nnoremap :<leader>fsb ":call FennelScratchBuffer ()<CR>") (u.nnoremap :<leader>fsb ":call FennelScratchBuffer ()<CR>")
(fn compile-fnl [] (print :recompiling) ;; (fn compile-fnl [] (print :recompiling)
(anenv.init {:force true :init :dotfiles.init})) ;; (anenv.init {:force true :init :dotfiles.init}))
;;
(vim.api.nvim_create_user_command :AniseedCompile compile-fnl {}) ;; (vim.api.nvim_create_user_command :AniseedCompile compile-fnl {})

View File

@@ -1,9 +1,4 @@
(module dotfiles.init (local a (require :aniseed.core))
{autoload
{a aniseed.core}
require
{nvim aniseed.nvim}})
(require :dotfiles.core) (require :dotfiles.core)
(require :dotfiles.plugins) (require :dotfiles.plugins)
@@ -12,5 +7,4 @@
(require :dotfiles.zoom-toggle) (require :dotfiles.zoom-toggle)
;(nvim.ex.source "~/.vimrc") ;(nvim.ex.source "~/.vimrc")
(a.println "(re)loaded") (a.println "(re)loaded")

View File

@@ -1,20 +1,17 @@
(module dotfiles.mapping (local util (require :dotfiles.util))
{autoload {nvim aniseed.nvim
nu aniseed.nvim.util
core aniseed.core
util dotfiles.util}})
(defn- noremap [mode from to] "Sets a mapping with {:noremap true}." (fn noremap [mode from to]
(nvim.set_keymap mode from to {:noremap true})) "Sets a mapping with {:noremap true}."
(vim.keymap.set mode from to {:noremap true}))
; (set nvim.g.mapleader "\\") ; (set nvim.g.mapleader "\\")
(defn aniseed-reload [] (fn aniseed-reload []
(each [k _ (ipairs package.loaded)] (each [k _ (ipairs package.loaded)]
(when (string.match k "^dotfiles%..+") (when (string.match k "^dotfiles%..+")
(tset package.loaded k nil))) (tset package.loaded k nil)))
((. (require :aniseed.env) :init) {:module :dotfiles.init :compile true}) ((. (require :aniseed.env) :init) {:module :dotfiles.init :compile true})
(core.println "aniseed reloaded!")) (print "aniseed reloaded!"))
(vim.keymap.set :n "<leader>`" aniseed-reload) (vim.keymap.set :n "<leader>`" aniseed-reload)
@@ -67,7 +64,10 @@
(noremap :n :<leader>mv ":AsyncRun -mode=bang open -a Marked\\ 2.app '%:p'<cr>") (noremap :n :<leader>mv ":AsyncRun -mode=bang open -a Marked\\ 2.app '%:p'<cr>")
; Run current statement in DadBod-UI ; Run current statement in DadBod-UI
(nvim.ex.autocmd :FileType :sql :nmap :<leader>s :vap<leader>S) ;; (nvim.ex.autocmd :FileType :sql :nmap :<leader>s :vap<leader>S)
(vim.api.nvim_create_autocmd [:FileType]
{:pattern :sql
:command "nmap <leader>s vap<leader>S"})
(noremap :n :Q ":.!bash <CR>") (noremap :n :Q ":.!bash <CR>")
@@ -81,10 +81,11 @@
; Trim trailing Whitespace in current line ; Trim trailing Whitespace in current line
(util.lnnoremap :tw "<C-U>.s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>") (util.lnnoremap :tw "<C-U>.s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
;; <Leader><C-l> in terminal to clear scrollback buffer ;; <Leader><C-l> in terminal to clear scrollback buffer
;; nmap <silent> <leader><C-l> :set scrollback=1 \| set scrollback=100000<cr> ;; nmap <silent> <leader><C-l> :set scrollback=1 \| set scrollback=100000<cr>
(util.lnnoremap :<C-k> ":set scrollback=1 | :set scrollback 100000<cr>" {:silent true}) (util.lnnoremap :<C-k> ":set scrollback=1 | :set scrollback 100000<cr>"
{:silent true})
;; tmap <silent> <leader><C-l> <C-\><C-n><leader><C-l>i ;; tmap <silent> <leader><C-l> <C-\><C-n><leader><C-l>i
(util.ltnoremap :<C-k> "<C-\\><C-n><leader><C-l>i" {:silent true}) (util.ltnoremap :<C-k> "<C-\\><C-n><leader><C-l>i" {:silent true})

View File

@@ -1,10 +1,9 @@
(module dotfiles.plugin.cmp {autoload {nvim aniseed.nvim luasnip luasnip}}) (local cmp (require :cmp))
(local luasnip (require :luasnip))
(module config.plugin.cmp {autoload {nvim aniseed.nvim cmp cmp}}) (local cmp-src-menu-items {:buffer :buff :conjure :conj :nvim_lsp :lsp})
(def- cmp-src-menu-items {:buffer :buff :conjure :conj :nvim_lsp :lsp}) (local cmp-srcs [{:name :nvim_lsp}
(def- cmp-srcs [{:name :nvim_lsp}
{:name :nvim_lua} {:name :nvim_lua}
{:name :luasnip} {:name :luasnip}
{:name :vsnip} {:name :vsnip}

View File

@@ -1,13 +1,18 @@
(module dotfiles.plugin.colorizer (let [colorizer (require :colorizer)]
{autoload {colorizer colorizer}}) (colorizer.setup ["*"] {:RGB true
; #RGB hex codes, like #F00
(colorizer.setup [:*] :RRGGBB true
{:RGB true ; #RGB hex codes, like #F00 ; #RRGGBB hex codes, like #00FF00
:RRGGBB true ; #RRGGBB hex codes, like #00FF00 :names true
:names true ; "Name" codes like Blue ; "Name" codes like Blue
:RRGGBBAA true ; #RRGGBBAA hex codes :RRGGBBAA true
:rgb_fn true ; CSS rgb() and rgba() functions ; #RRGGBBAA hex codes
:hsl_fn true ; CSS hsl() and hsla() functions :rgb_fn true
:css true ; Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB ; CSS rgb() and rgba() functions
:css_fn true ; Enable all CSS *functions*: rgb_fn, hsl_fn :hsl_fn true
}) ; CSS hsl() and hsla() functions
:css true
; Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
:css_fn true
; Enable all CSS *functions*: rgb_fn, hsl_fn
}))

View File

@@ -1,16 +1,14 @@
(module dotfiles.plugin.compe (module dotfiles.plugin.compe {autoload {nvim aniseed.nvim}})
{autoload {nvim aniseed.nvim}})
(set nvim.o.completeopt "menuone,noselect") (set vim.o.completeopt "menuone,noselect")
(let [compe (require :compe)] (let [compe (require :compe)]
(when compe (when compe
(compe.setup (compe.setup {:enabled true
{:enabled true
:autocomplete true :autocomplete true
:debug false :debug false
:min_length 1 :min_length 1
:preselect "enable" :preselect :enable
:throttle_time 80 :throttle_time 80
:source_timeout 200 :source_timeout 200
:incomplete_delay 400 :incomplete_delay 400

View File

@@ -1,13 +1,12 @@
(module dotfiles.plugin.conjure (local core (require :aniseed.core))
{autoload {a aniseed.core
conjure-config conjure.config
nvim aniseed.nvim}})
; (set nvim.g.conjure#eval#result_register "*") ; (set nvim.g.conjure#eval#result_register "*")
; (set nvim.g.conjure#log#botright true) ; (set nvim.g.conjure#log#botright true)
(set nvim.g.conjure#mapping#doc_word "gk") (set vim.g.conjure#mapping#doc_word :gk)
(set nvim.g.conjure#client#clojure#nrepl#mapping#session_clone :sC) (set vim.g.conjure#client#clojure#nrepl#mapping#session_clone :sC)
(set nvim.g.conjure#extract#tree_sitter#enabled true) (set vim.g.conjure#extract#tree_sitter#enabled true)
(conjure-config.assoc-in [:filetypes] (a.concat (conjure-config.filetypes) [:markdown] )) (let [conjure-config (require :conjure.config)]
(conjure-config.assoc-in [:filetype :markdown] "conjure.client.clojure.nrepl") (conjure-config.assoc-in [:filetypes]
(core.concat (conjure-config.filetypes) [:markdown]))
(conjure-config.assoc-in [:filetype :markdown] :conjure.client.clojure.nrepl))

View File

@@ -1,4 +0,0 @@
(module dotfiles.plugin.dadbodui
{autoload { nvim aniseed.nvim }})

View File

@@ -1,5 +1,2 @@
(module dotfiles.plugin.easyalign (let [util (require :dotfiles.util)]
{autoload {nvim aniseed.nvim (util.noremap :v :<leader><bslash> :EasyAlign*<Bar>))
util dotfiles.util }})
(util.noremap :v :<leader><bslash> "EasyAlign*<Bar>")

View File

@@ -1,2 +1 @@
(module dotfiles.plugin.headlines (local headlines (require :headlines))
{autoload {headlines headlines}})

View File

@@ -1,3 +1,3 @@
(module dotfiles.plugin.hex {autoload {nvim aniseed.nvim hex hex}}) (let [hex (require :hex)]
(when hex
(hex.setup) (hex.setup)))

View File

@@ -1,19 +1,17 @@
(module dotfiles.plugin.luasnip (let [luasnip (require :luasnip)
{autoload {nvim aniseed.nvim util dotfiles.util luasnip luasnip} select_choice (require :luasnip.extras.select_choice)]
require {select_choice luasnip.extras.select_choice}}) (when luasnip
(vim.keymap.set [:i :s] :<C-k> (vim.keymap.set [:i :s] :<C-k>
(fn [] (fn []
(if (luasnip.expand_or_jumpable) (if (luasnip.expand_or_jumpable)
(luasnip.expand_or_jump))) {:silent true}) (luasnip.expand_or_jump)))
{:silent true})
(vim.keymap.set [:i :s] :<C-j> (vim.keymap.set [:i :s] :<C-j>
(fn [] (fn []
(if (luasnip.jumpable -1) (if (luasnip.jumpable -1)
(luasnip.jump -1))) {:silent true}) (luasnip.jump -1))) {:silent true})
(vim.keymap.set :i :<C-l>
(vim.keymap.set :i :<C-l> (fn [] (fn []
(if (luasnip.choice_active) (if (luasnip.choice_active)
(luasnip.choice 1)))) (luasnip.choice 1))))
(vim.keymap.set :i :<C-u> select_choice)))
(vim.keymap.set :i :<C-u> select_choice)

View File

@@ -1,10 +1,11 @@
(module dotfiles.plugin.mason (fn setup []
{autoload {a aniseed.core (let [mason (require :mason)
nvim aniseed.nvim mason mason mason-lspconf mason-lspconfig}}) mason-lspconf (require :mason-lspconfig)
lspconfig (require :dotfiles.plugin.lspconfig)]
(defn setup []
(when mason (when mason
(mason.setup {:ui {:icons {:package_installed "✓"}}}) (mason.setup {:ui {:icons {:package_installed "✓"}}})
(when mason-lspconf (when mason-lspconf
(mason-lspconf.setup {:ensure_installed [:lua_ls]}) (mason-lspconf.setup {:ensure_installed [:lua_ls]})
(mason-lspconf.setup_handlers {1 default-server-handler})))) (mason-lspconf.setup_handlers {1 lspconfig.default-server-handler})))))
(setup)

View File

@@ -1,13 +1,8 @@
(module dotfiles.plugin.null-ls (let [null-ls (require :null-ls)
{autoload {nvim aniseed.nvim lspconfig (require :dotfiles.plugin.lspconfig)]
a aniseed.core (when null-ls
nu aniseed.nvim.util (local null-ls-server-options
null-ls null-ls
lspconfig dotfiles.plugin.lspconfig}})
(def null-ls-server-options
{:sources [null-ls.builtins.formatting.stylua {:sources [null-ls.builtins.formatting.stylua
null-ls.builtins.formatting.fnlfmt] null-ls.builtins.formatting.fnlfmt]
:on_attach lspconfig.on_attach}) :on_attach lspconfig.on_attach})
(null-ls.setup null-ls-server-options)))
(null-ls.setup null-ls-server-options)

View File

@@ -1,32 +1,33 @@
(module dotfiles.plugin.orgbullets (module dotfiles.plugin.orgbullets {autoload {nvim aniseed.nvim}})
{autoload {nvim aniseed.nvim a aniseed.core ts-utils dotfiles.ts-utils}})
(def stars ["◉" "⦾" "○" "✸" "✿" "✶" "•" "‣"]) (local core (require :aniseed.core))
(local ts-utils (require :dotfiles.ts-utils))
(local stars ["◉" "⦾" "○" "✸" "✿" "✶" "•" "‣"])
(def stars-query "(headline (stars) @stars)") (local stars-query "(headline (stars) @stars)")
(defn star-index [heading-level] (fn star-index [heading-level]
(let [star-count (a.count stars) (let [star-count (core.count stars)
idx (math.fmod heading-level star-count)] idx (math.fmod heading-level star-count)]
(if (< 0 idx) (if (< 0 idx)
idx idx
star-count))) star-count)))
(defonce extmark-namespace (vim.api.nvim_create_namespace :HeaderStars)) (local extmark-namespace (vim.api.nvim_create_namespace :HeaderStars))
(def star-captures (ts-utils.make-query :org stars-query)) (local star-captures (ts-utils.make-query :org stars-query))
(defn gen-star-extmarks [] (fn gen-star-extmarks []
(when (= :org vim.bo.filetype) (when (= :org vim.bo.filetype)
(let [bufnr (vim.api.nvim_get_current_buf) (let [bufnr (vim.api.nvim_get_current_buf)
star-count (a.count stars)] star-count (core.count stars)]
(vim.api.nvim_buf_clear_namespace bufnr extmark-namespace 0 -1) (vim.api.nvim_buf_clear_namespace bufnr extmark-namespace 0 -1)
(each [id node metadata (star-captures bufnr)] (each [id node metadata (star-captures bufnr)]
(let [[start-line start-col end-row end-col] [(node:range)] (let [[start-line start-col end-row end-col] [(node:range)]
heading-level (if (= start-line end-row) heading-level (if (= start-line end-row)
(- end-col start-col)) (- end-col start-col))
star (a.get stars (star-index heading-level)) star (core.get stars (star-index heading-level))
replacement (string.format (a.str "%" (+ 2 heading-level) :s) replacement (string.format (core.str "%" (+ 2 heading-level) :s)
star)] star)]
(vim.api.nvim_buf_set_extmark bufnr extmark-namespace start-line (vim.api.nvim_buf_set_extmark bufnr extmark-namespace start-line
start-col start-col

View File

@@ -1,11 +1,6 @@
(module dotfiles.plugin.orgmode {autoload {orgmode orgmode}}) (let [orgmode (require :orgmode)]
;;(orgmode.setup_ts_grammar) ;;(orgmode.setup_ts_grammar)
(orgmode.setup {:org_agenda_files ["~/Dropbox/org/*" "~/my-orgs/**/*"] (orgmode.setup {:org_agenda_files ["~/Dropbox/org/*" "~/my-orgs/**/*"]
:org_default_notes_file "~/Dropbox/org/refile.org" :org_default_notes_file "~/Dropbox/org/refile.org"
:mappings { :mappings {:org {:org_toggle_checkbox :<C-.>}}})
:org { (require :dotfiles.plugin.orgbullets))
:org_toggle_checkbox :<C-.>}}})
(require :dotfiles.plugin.orgbullets)

View File

@@ -1,8 +1,4 @@
(module dotfiles.plugin.packer (local u (require :dotfiles.util))
{autoload
{u dotfiles.util}
require
{nvim aniseed.nvim}})
(u.nnoremap :<leader>pi :PackerInstall) (u.nnoremap :<leader>pi :PackerInstall)
(u.nnoremap :<leader>pu :PackerUpdate) (u.nnoremap :<leader>pu :PackerUpdate)

View File

@@ -1,40 +1,43 @@
(module dotfiles.plugin.paredit (module dotfiles.plugin.paredit
{autoload {nvim aniseed.nvim {autoload {nvim aniseed.nvim
a aniseed.core
nu aniseed.nvim.util
paredit paredit paredit paredit
ts-parsers nvim-treesitter.parsers ts-parsers nvim-treesitter.parsers
ts-utils nvim-treesitter.ts_utils ts-utils nvim-treesitter.ts_utils
languagetree vim.treesitter.languagetree}}) languagetree vim.treesitter.languagetree}})
(set nvim.g.paredit_smartjump 1) (local a (require :aniseed.core))
(defn list-member? [xs x] (a.some #(= x $1) (a.vals xs))) (set vim.g.paredit_smartjump 1)
(defn bool->int [bool] (if bool 1 0)) (fn list-member? [xs x]
(a.some #(= x $1) (a.vals xs)))
(defn int->bool [x] (if (= 0 x) false true)) (fn bool->int [bool] (if bool 1 0))
(defn toggle-global! [x] (->> (a.get nvim.g x) (fn int->bool [x] (if (= 0 x) false true))
(fn toggle-global! [x]
(->> (a.get vim.g x)
(int->bool) (int->bool)
(not) (not)
(bool->int) (bool->int)
(tset nvim.g x))) (tset vim.g x)))
(defn language-at-cursor [] (let [parser (ts-parsers.get_parser) (fn language-at-cursor []
(let [parser (ts-parsers.get_parser)
current-node (ts-utils.get_node_at_cursor) current-node (ts-utils.get_node_at_cursor)
range (if current-node [(current-node:range)]) range (if current-node [(current-node:range)])
lang (if range lang (if range
(languagetree.language_for_range parser (languagetree.language_for_range parser range))]
range))]
(if lang (if lang
(lang:lang)))) (lang:lang))))
(defn parser-language [] (let [parser (ts-parsers.get_parser)] (fn parser-language []
(let [parser (ts-parsers.get_parser)]
(when parser (when parser
(parser:lang)))) (parser:lang))))
(def- paredit-langs [:clojure (local paredit-langs [:clojure
:fennel :fennel
:hy :hy
:janet :janet
@@ -45,13 +48,13 @@
:scheme :scheme
:shen]) :shen])
(def- paredit-host-langs [:org :markdown :asciidoc]) (local paredit-host-langs [:org :markdown :asciidoc])
(defn- host-lang-in? [langs] (list-member? langs (parser-language))) (fn host-lang-in? [langs] (list-member? langs (parser-language)))
(defn paredit-lang? [lang] (list-member? paredit-langs lang)) (fn paredit-lang? [lang] (list-member? paredit-langs lang))
(defn TreeSitterLangParedit [] (fn TreeSitterLangParedit []
(when (host-lang-in? paredit-host-langs) (when (host-lang-in? paredit-host-langs)
(when-let [cursor-lang (language-at-cursor)] (when-let [cursor-lang (language-at-cursor)]
(->> cursor-lang (->> cursor-lang
@@ -60,10 +63,14 @@
(set nvim.g.paredit_mode)) (set nvim.g.paredit_mode))
(nvim.fn.PareditInitBuffer)))) (nvim.fn.PareditInitBuffer))))
(nvim.ex.autocmd :FileType :ruby :call
"PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :ruby :call "PareditInitBalancingAllBracketsBuffer()") (nvim.ex.autocmd :FileType :javascript :call
(nvim.ex.autocmd :FileType :javascript :call "PareditInitBalancingAllBracketsBuffer()") "PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :terraform :call "PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :terraform :call
"PareditInitBalancingAllBracketsBuffer()")
; (nvim.del_augroup_by_name "BabeliteParedit") ; (nvim.del_augroup_by_name "BabeliteParedit")
; (nvim.get_autocmds {:group "BabeliteParedit"}) ; (nvim.get_autocmds {:group "BabeliteParedit"})
@@ -75,14 +82,14 @@
;; :callback TreeSitterLangParedit})) ;; :callback TreeSitterLangParedit}))
;; ;;
;; (defn paredit-toggle! [] (toggle-global :paredit_mode) ;; (fn paredit-toggle! [] (toggle-global :paredit_mode)
;; (nvim.fn.PareditInitBuffer) ;; (nvim.fn.PareditInitBuffer)
;; nvim.g.paredit_mode ;; nvim.g.paredit_mode
;; ) ;; )
;; ;;
;; \ ;; \
;; (int->bool 0) ;; (int->bool 0)
;; (defn test [x] (a.get nvim.g x)) ;; (fn test [x] (a.get nvim.g x))
;; ;;
;; (test :pareditmode) ;; (test :pareditmode)
;; (a.get nvim.g :paredit_mode) ;; (a.get nvim.g :paredit_mode)

View File

@@ -1,12 +1,6 @@
(module dotfiles.plugin.smartsplits (let [smart-splits (require :smart-splits)]
{autoload {nvim aniseed.nvim (when smart-splits
a aniseed.core
smart-splits smart-splits
;; util dotfiles.util
}})
(smart-splits.setup) (smart-splits.setup)
;; recommended mappings ;; recommended mappings
;; resizing splits ;; resizing splits
;; these keymaps will also accept a range, ;; these keymaps will also accept a range,
@@ -14,14 +8,12 @@
(vim.keymap.set :n :<M-S-h> smart-splits.resize_left) (vim.keymap.set :n :<M-S-h> smart-splits.resize_left)
(vim.keymap.set :n :<M-S-j> smart-splits.resize_down) (vim.keymap.set :n :<M-S-j> smart-splits.resize_down)
(vim.keymap.set :n :<M-S-k> smart-splits.resize_up) (vim.keymap.set :n :<M-S-k> smart-splits.resize_up)
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right) (vim.keymap.set :n :<M-S-l> smart-splits.resize_right) ; ; moving between splits
;; moving between splits
(vim.keymap.set :n :<M-h> smart-splits.move_cursor_left) (vim.keymap.set :n :<M-h> smart-splits.move_cursor_left)
(vim.keymap.set :n :<M-j> smart-splits.move_cursor_down) (vim.keymap.set :n :<M-j> smart-splits.move_cursor_down)
(vim.keymap.set :n :<M-k> smart-splits.move_cursor_up) (vim.keymap.set :n :<M-k> smart-splits.move_cursor_up)
(vim.keymap.set :n :<M-l> smart-splits.move_cursor_right) (vim.keymap.set :n :<M-l> smart-splits.move_cursor_right) ; ; swapping buffers between windows
;; swapping buffers between windows
(vim.keymap.set :n :<leader><leader>h smart-splits.swap_buf_left) (vim.keymap.set :n :<leader><leader>h smart-splits.swap_buf_left)
(vim.keymap.set :n :<leader><leader>j smart-splits.swap_buf_down) (vim.keymap.set :n :<leader><leader>j smart-splits.swap_buf_down)
(vim.keymap.set :n :<leader><leader>k smart-splits.swap_buf_up) (vim.keymap.set :n :<leader><leader>k smart-splits.swap_buf_up)
(vim.keymap.set :n :<leader><leader>l smart-splits.swap_buf_right) (vim.keymap.set :n :<leader><leader>l smart-splits.swap_buf_right)))

View File

@@ -4,7 +4,7 @@
telescope telescope telescope telescope
project-nvim project_nvim}}) project-nvim project_nvim}})
(def vimgrep_arguments [:ag (local vimgrep_arguments [:ag
:--nocolor :--nocolor
:--noheading :--noheading
:--number :--number

View File

@@ -1,5 +1,3 @@
(module dotfiles.plugin.whichkey (let [which-key (require :which-key)]
{autoload {which-key which-key}}) (when which-key
(which-key.setup {})))
(which-key.setup {})

View File

@@ -1,9 +1,4 @@
(module dotfiles.plugin.yanky {autoload {nvim aniseed.nvim (local yanky (require :yanky))
a aniseed.core
;; util dotfiles.util
yanky yanky}
;; require {minpac minpac}
})
(yanky.setup {:ring {:history_length 100 (yanky.setup {:ring {:history_length 100
:storage :shada :storage :shada

View File

@@ -1,24 +1,21 @@
(module dotfiles.plugins {autoload {nvim aniseed.nvim (local packer (require :packer))
a aniseed.core (local core (require :aniseed.core))
;; util dotfiles.util
packer packer}
;; require {minpac minpac}
})
(defn safe-require-plugin-config [name] (fn safe-require-plugin-config [name]
(let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))] (let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))]
(when (not ok?) (when (not ok?)
(print (.. "dotfiles error: " val-or-err))))) (print (.. "dotfiles error: " val-or-err)))))
(defn- use [pkgs] "Iterates through the arguments as pairs and calls packer's use function for (fn use [pkgs]
"Iterates through the arguments as pairs and calls packer's use function for
each of them. Works around Fennel not liking mixed associative and sequential each of them. Works around Fennel not liking mixed associative and sequential
tables as well." tables as well."
(packer.startup (fn [use] (packer.startup (fn [use]
(each [name opts (pairs pkgs)] (each [name opts (pairs pkgs)]
(-?> (. opts :mod) (safe-require-plugin-config)) (-?> (. opts :mod) (safe-require-plugin-config))
(use (a.assoc opts 1 name)))))) (use (core.assoc opts 1 name))))))
(def- packages {:Olical/aniseed {} (local packages {:Olical/aniseed {}
:Olical/conjure {:mod :conjure} :Olical/conjure {:mod :conjure}
:Olical/fennel.vim {} :Olical/fennel.vim {}
:ahmedkhalf/project.nvim {} :ahmedkhalf/project.nvim {}
@@ -96,8 +93,8 @@
; :thecontinium/asyncomplete-conjure.vim {} ; :thecontinium/asyncomplete-conjure.vim {}
; :jose-elias-alvarez/null-ls.nvim {:mod :null-ls ; :jose-elias-alvarez/null-ls.nvim {:mod :null-ls
; :requires [:nvim-lua/plenary.nvim]} ; :requires [:nvim-lua/plenary.nvim]}
} ; :tpope/vim-fireplace {} ; Clojure }
; :tpope/vim-sexp-mappings-for-regular-people {} ; :tpope/vim-fireplace {} ; Clojure ; :tpope/vim-sexp-mappings-for-regular-people {}
) )
(use packages) (use packages)

View File

@@ -1,6 +1,4 @@
(module dotfiles.terraform-helpers (module dotfiles.terraform-helpers {require {nvim aniseed.nvim}})
{autoload {a aniseed.core}
require {anenv aniseed.env nvim aniseed.nvim u dotfiles.util}})
(fn append-to-buf [bufno lines] (fn append-to-buf [bufno lines]
(when lines (when lines

View File

@@ -1,12 +1,15 @@
(module dotfiles.ts-utils {autoload {nvim aniseed.nvim a aniseed.core}}) (local core (require :aniseed.core))
(defn root [bufnr lang] (let [parser (vim.treesitter.get_parser bufnr lang {}) (fn root [bufnr lang]
tree (a.first (: parser :parse))] (let [parser (vim.treesitter.get_parser bufnr lang {})
tree (core.first (: parser :parse))]
(: tree :root))) (: tree :root)))
(defn make-query [lang query-string] (fn make-query [lang query-string]
(let [query (vim.treesitter.query.parse lang "(headline (stars) @stars)")] (let [query (vim.treesitter.query.parse lang "(headline (stars) @stars)")]
(fn [bufnr] (fn [bufnr]
(let [root-node (root bufnr lang) (let [root-node (root bufnr lang)
iter-captures (query.iter_captures query root-node bufnr 0 -1)] iter-captures (query.iter_captures query root-node bufnr 0 -1)]
iter-captures)))) iter-captures))))
{: root : make-query}