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,101 +1,94 @@
(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 ; allow project level (neo)vim files
; allow project level (neo)vim files :hlsearch
:hlsearch :ignorecase
:ignorecase :incsearch
:incsearch :number
:number :ruler
:ruler :secure
:secure :shiftround
:shiftround ; When at 3 spaces and I hit >>, go to 4, not 5.
; When at 3 spaces and I hit >>, go to 4, not 5. :showcmd
:showcmd ; shows (parital) command in the status line
; shows (parital) command in the status line :showmatch
:showmatch :smartcase
:smartcase :splitbelow
:splitbelow :splitright
:splitright :termguicolors
:termguicolors :title
:title :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 :redrawtime 5000
:redrawtime 5000 :scrolloff 3
:scrolloff 3 :guifont :Hasklig
:guifont :Hasklig :guifontwide :Hasklig
:guifontwide :Hasklig :background :dark
:background :dark :backupdir backup-dir
:backupdir backup-dir :directory backup-dir
:directory backup-dir ;Don't clutter my dirs up with swp and tmp files
;Don't clutter my dirs up with swp and tmp files :grepprg "ag --vimgrep"
:grepprg "ag --vimgrep" ; Use Silver Searcher instead of grep
; Use Silver Searcher instead of grep :tags :tags
:tags :tags :updatetime 300
:updatetime 300 ; per coc.vim for diagnostic messages
; per coc.vim for diagnostic messages :signcolumn "auto:1-3"
:signcolumn "auto:1-3" :colorcolumn [81 100]
:colorcolumn [81 100] :cmdheight 2
:cmdheight 2 ; Better display for messages
; Better display for messages :undodir undo-dir
:undodir undo-dir :undolevels 1000
:undolevels 1000 :undoreload 10000
:undoreload 10000 :foldmethod :expr
:foldmethod :expr :foldexpr "nvim_treesitter#foldexpr()"
:foldexpr "nvim_treesitter#foldexpr()" :foldlevelstart 100
:foldlevelstart 100 :foldlevel 99
:foldlevel 99 :tabstop 2
:tabstop 2 :shiftwidth 2
:shiftwidth 2 :softtabstop 2
:softtabstop 2 :mouse ""
:mouse "" :list true
:list true :listchars "tab:➥\\ ,trail:·,nbsp:■"
:listchars "tab:➥\\ ,trail:·,nbsp:■" :backspace "indent,eol,start"
:backspace "indent,eol,start" ;allow backspacing over everything in insert mode
;allow backspacing over everything in insert mode :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,17 +1,16 @@
(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}
{:name :nvim_lua}
(def- cmp-srcs [{:name :nvim_lsp} {:name :luasnip}
{:name :nvim_lua} {:name :vsnip}
{:name :luasnip} {:name :conjure}
{:name :vsnip} {:name :buffer}
{:name :conjure} {:name :orgmode}
{:name :buffer} {:name :emoji :max_item_count 8}])
{:name :orgmode}
{:name :emoji :max_item_count 8}])
;; Setup cmp with desired settings ;; Setup cmp with desired settings
(let [cmp (require :cmp)] (let [cmp (require :cmp)]

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,33 +1,31 @@
(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 :max_abbr_width 100
:max_abbr_width 100 :max_kind_width 100
:max_kind_width 100 :max_menu_width 100
:max_menu_width 100 :documentation true
:documentation true :source {:path true
:source {:path true :buffer true
:buffer true :calc true
:calc true :emoji true
:emoji true :nvim_lsp true
:nvim_lsp true :nvim_lua true
:nvim_lua true :conjure true
:conjure true :orgmode true
:orgmode true :vsnip true
:vsnip true :vim_dadbod_completion true}})))
:vim_dadbod_completion true}})))
(nvim.ex.inoremap "<silent><expr> <C-Space> compe#complete()") (nvim.ex.inoremap "<silent><expr> <C-Space> compe#complete()")
(nvim.ex.inoremap "<silent><expr> <CR> compe#confirm('<CR>')") (nvim.ex.inoremap "<silent><expr> <CR> compe#confirm('<CR>')")

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)))
(luasnip.expand_or_jump))) {:silent true}) {: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>
(fn []
(vim.keymap.set :i :<C-l> (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)]
(when mason
(mason.setup {:ui {:icons {:package_installed "✓"}}})
(when mason-lspconf
(mason-lspconf.setup {:ensure_installed [:lua_ls]})
(mason-lspconf.setup_handlers {1 lspconfig.default-server-handler})))))
(defn setup [] (setup)
(when mason
(mason.setup {:ui {:icons {:package_installed "✓"}}})
(when mason-lspconf
(mason-lspconf.setup {:ensure_installed [:lua_ls]})
(mason-lspconf.setup_handlers {1 default-server-handler}))))

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 {:sources [null-ls.builtins.formatting.stylua
lspconfig dotfiles.plugin.lspconfig}}) null-ls.builtins.formatting.fnlfmt]
:on_attach lspconfig.on_attach})
(def null-ls-server-options (null-ls.setup null-ls-server-options)))
{:sources [null-ls.builtins.formatting.stylua
null-ls.builtins.formatting.fnlfmt]
:on_attach lspconfig.on_attach})
(null-ls.setup null-ls-server-options)

View File

@@ -1,40 +1,41 @@
(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
{:end_col end-col {:end_col end-col
:end_row end-row :end_row end-row
:virt_text [[replacement []]] :virt_text [[replacement []]]
:virt_text_pos :overlay :virt_text_pos :overlay
:hl_mode :combine})))))) :hl_mode :combine}))))))
(let [group (nvim.create_augroup :HeaderStars {:clear true})] (let [group (nvim.create_augroup :HeaderStars {:clear true})]
(nvim.create_autocmd [:FileChangedShellPost (nvim.create_autocmd [:FileChangedShellPost

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/**/*"]
:org_default_notes_file "~/Dropbox/org/refile.org"
(orgmode.setup {:org_agenda_files ["~/Dropbox/org/*" "~/my-orgs/**/*"] :mappings {:org {:org_toggle_checkbox :<C-.>}}})
:org_default_notes_file "~/Dropbox/org/refile.org" (require :dotfiles.plugin.orgbullets))
:mappings {
:org {
: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,69 +1,76 @@
(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))
(int->bool)
(not)
(bool->int)
(tset nvim.g x)))
(defn language-at-cursor [] (let [parser (ts-parsers.get_parser) (fn toggle-global! [x]
current-node (ts-utils.get_node_at_cursor) (->> (a.get vim.g x)
range (if current-node [(current-node:range)]) (int->bool)
lang (if range (not)
(languagetree.language_for_range parser (bool->int)
range))] (tset vim.g x)))
(if lang
(lang:lang))))
(defn parser-language [] (let [parser (ts-parsers.get_parser)] (fn language-at-cursor []
(when parser (let [parser (ts-parsers.get_parser)
(parser:lang)))) current-node (ts-utils.get_node_at_cursor)
range (if current-node [(current-node:range)])
lang (if range
(languagetree.language_for_range parser range))]
(if lang
(lang:lang))))
(def- paredit-langs [:clojure (fn parser-language []
:fennel (let [parser (ts-parsers.get_parser)]
:hy (when parser
:janet (parser:lang))))
:julia
:lfe
:lisp
:racket
:scheme
:shen])
(def- paredit-host-langs [:org :markdown :asciidoc]) (local paredit-langs [:clojure
:fennel
:hy
:janet
:julia
:lfe
:lisp
:racket
:scheme
:shen])
(defn- host-lang-in? [langs] (list-member? langs (parser-language))) (local paredit-host-langs [:org :markdown :asciidoc])
(defn paredit-lang? [lang] (list-member? paredit-langs lang)) (fn host-lang-in? [langs] (list-member? langs (parser-language)))
(defn TreeSitterLangParedit [] (fn paredit-lang? [lang] (list-member? paredit-langs lang))
(when (host-lang-in? paredit-host-langs)
(when-let [cursor-lang (language-at-cursor)]
(->> cursor-lang
(paredit-lang?)
(bool->int)
(set nvim.g.paredit_mode))
(nvim.fn.PareditInitBuffer))))
(fn TreeSitterLangParedit []
(when (host-lang-in? paredit-host-langs)
(when-let [cursor-lang (language-at-cursor)]
(->> cursor-lang
(paredit-lang?)
(bool->int)
(set nvim.g.paredit_mode))
(nvim.fn.PareditInitBuffer))))
(nvim.ex.autocmd :FileType :ruby :call "PareditInitBalancingAllBracketsBuffer()") (nvim.ex.autocmd :FileType :ruby :call
(nvim.ex.autocmd :FileType :javascript :call "PareditInitBalancingAllBracketsBuffer()") "PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :terraform :call "PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :javascript :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,27 +1,19 @@
(module dotfiles.plugin.smartsplits (let [smart-splits (require :smart-splits)]
{autoload {nvim aniseed.nvim (when smart-splits
a aniseed.core (smart-splits.setup)
smart-splits smart-splits ;; recommended mappings
;; util dotfiles.util ;; resizing splits
}}) ;; these keymaps will also accept a range,
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
(smart-splits.setup) (vim.keymap.set :n :<M-S-h> smart-splits.resize_left)
(vim.keymap.set :n :<M-S-j> smart-splits.resize_down)
;; recommended mappings (vim.keymap.set :n :<M-S-k> smart-splits.resize_up)
;; resizing splits (vim.keymap.set :n :<M-S-l> smart-splits.resize_right) ; ; moving between splits
;; these keymaps will also accept a range, (vim.keymap.set :n :<M-h> smart-splits.move_cursor_left)
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)` (vim.keymap.set :n :<M-j> smart-splits.move_cursor_down)
(vim.keymap.set :n :<M-S-h> smart-splits.resize_left) (vim.keymap.set :n :<M-k> smart-splits.move_cursor_up)
(vim.keymap.set :n :<M-S-j> smart-splits.resize_down) (vim.keymap.set :n :<M-l> smart-splits.move_cursor_right) ; ; swapping buffers between windows
(vim.keymap.set :n :<M-S-k> smart-splits.resize_up) (vim.keymap.set :n :<leader><leader>h smart-splits.swap_buf_left)
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right) (vim.keymap.set :n :<leader><leader>j smart-splits.swap_buf_down)
;; moving between splits (vim.keymap.set :n :<leader><leader>k smart-splits.swap_buf_up)
(vim.keymap.set :n :<M-h> smart-splits.move_cursor_left) (vim.keymap.set :n :<leader><leader>l smart-splits.swap_buf_right)))
(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-l> smart-splits.move_cursor_right)
;; swapping buffers between windows
(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>k smart-splits.swap_buf_up)
(vim.keymap.set :n :<leader><leader>l smart-splits.swap_buf_right)

View File

@@ -4,19 +4,19 @@
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
:--column :--column
:--nobreak :--nobreak
:--smart-case :--smart-case
:--hidden :--hidden
; "--skip-vcs-ignores" ; "--skip-vcs-ignores"
; "-g" "!.git/" ; "-g" "!.git/"
:--ignore :--ignore
:.git :.git
:--follow]) :--follow])
(telescope.load_extension :projects) (telescope.load_extension :projects)
(telescope.load_extension :yank_history) (telescope.load_extension :yank_history)

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,104 +1,101 @@
(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 {}
:airblade/vim-gitgutter {} :airblade/vim-gitgutter {}
:akinsho/toggleterm.nvim {:mod :toggleterm} :akinsho/toggleterm.nvim {:mod :toggleterm}
:clojure-vim/vim-jack-in {} :clojure-vim/vim-jack-in {}
:christianrondeau/vim-base64 {} :christianrondeau/vim-base64 {}
:dhruvasagar/vim-table-mode {} :dhruvasagar/vim-table-mode {}
:folke/lsp-colors.nvim {} :folke/lsp-colors.nvim {}
:folke/which-key.nvim {:mod :whichkey} :folke/which-key.nvim {:mod :whichkey}
:gbprod/yanky.nvim {:mod :yanky} :gbprod/yanky.nvim {:mod :yanky}
:hashivim/vim-terraform {} :hashivim/vim-terraform {}
:HiPhish/rainbow-delimiters.nvim {} :HiPhish/rainbow-delimiters.nvim {}
:hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer :hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer
:hrsh7th/cmp-emoji :hrsh7th/cmp-emoji
:hrsh7th/cmp-nvim-lsp :hrsh7th/cmp-nvim-lsp
:hrsh7th/cmp-nvim-lua :hrsh7th/cmp-nvim-lua
:hrsh7th/cmp-path :hrsh7th/cmp-path
:hrsh7th/cmp-vsnip :hrsh7th/cmp-vsnip
:hrsh7th/vim-vsnip-integ :hrsh7th/vim-vsnip-integ
:L3MON4D3/LuaSnip :L3MON4D3/LuaSnip
:PaterJason/cmp-conjure :PaterJason/cmp-conjure
:saadparwaiz1/cmp_luasnip] :saadparwaiz1/cmp_luasnip]
:mod :cmp} :mod :cmp}
:hrsh7th/vim-vsnip {} :hrsh7th/vim-vsnip {}
:hrsh7th/vim-vsnip-integ {} :hrsh7th/vim-vsnip-integ {}
:Iron-E/nvim-soluarized {} :Iron-E/nvim-soluarized {}
:jiangmiao/auto-pairs {} :jiangmiao/auto-pairs {}
:nvimtools/none-ls.nvim {:mod :null-ls :nvimtools/none-ls.nvim {:mod :null-ls
:requires [:nvim-lua/plenary.nvim]} :requires [:nvim-lua/plenary.nvim]}
:junegunn/vim-easy-align {:mod :easyalign} :junegunn/vim-easy-align {:mod :easyalign}
:kovisoft/paredit {:mod :paredit} :kovisoft/paredit {:mod :paredit}
:kristijanhusak/vim-dadbod-completion {} :kristijanhusak/vim-dadbod-completion {}
:kristijanhusak/vim-dadbod-ui {} :kristijanhusak/vim-dadbod-ui {}
:L3MON4D3/LuaSnip {:mod :luasnip} :L3MON4D3/LuaSnip {:mod :luasnip}
:lifepillar/vim-solarized8 {} :lifepillar/vim-solarized8 {}
:lukas-reineke/headlines.nvim {:mod :headlines} :lukas-reineke/headlines.nvim {:mod :headlines}
; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun} ; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
:mrjones2014/smart-splits.nvim {:mod :smartsplits} :mrjones2014/smart-splits.nvim {:mod :smartsplits}
:mechatroner/rainbow_csv {} :mechatroner/rainbow_csv {}
:neovim/nvim-lspconfig {:mod :lspconfig} :neovim/nvim-lspconfig {:mod :lspconfig}
:norcalli/nvim-colorizer.lua {:mod :colorizer} :norcalli/nvim-colorizer.lua {:mod :colorizer}
:nvim-orgmode/orgmode {:mod :orgmode} :nvim-orgmode/orgmode {:mod :orgmode}
:nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim] :nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim]
[:nvim-lua/plenary.nvim]] [:nvim-lua/plenary.nvim]]
:mod :telescope} :mod :telescope}
:nvim-treesitter/nvim-treesitter {:run ":TSUpdate" :nvim-treesitter/nvim-treesitter {:run ":TSUpdate"
:mod :treesitter} :mod :treesitter}
:nvim-treesitter/playground {} :nvim-treesitter/playground {}
:radenling/vim-dispatch-neovim {} :radenling/vim-dispatch-neovim {}
:RaafatTurki/hex.nvim { :mod :hex } :RaafatTurki/hex.nvim {:mod :hex}
:rafamadriz/friendly-snippets {} :rafamadriz/friendly-snippets {}
:skywind3000/asyncrun.vim {} :skywind3000/asyncrun.vim {}
;; :tjdevries/sg.nvim {:run "cargo build --workspace" ;; :tjdevries/sg.nvim {:run "cargo build --workspace"
;; :dependencies [:nvim-lua/plenary.nvim]} ;; :dependencies [:nvim-lua/plenary.nvim]}
;; :tpope/vim-classpath {} ;; :tpope/vim-classpath {}
:tpope/vim-dadbod {} :tpope/vim-dadbod {}
:tpope/vim-dispatch {} :tpope/vim-dispatch {}
:tpope/vim-fugitive {:mod :fugitive} :tpope/vim-fugitive {:mod :fugitive}
:tpope/vim-git {} :tpope/vim-git {}
:tpope/vim-pathogen {} :tpope/vim-pathogen {}
:tpope/vim-rails {} :tpope/vim-rails {}
:tpope/vim-repeat {} :tpope/vim-repeat {}
:tpope/vim-rhubarb {} :tpope/vim-rhubarb {}
:tpope/vim-surround {} :tpope/vim-surround {}
:tpope/vim-unimpaired {} :tpope/vim-unimpaired {}
:tpope/vim-vinegar {} :tpope/vim-vinegar {}
:wbthomason/packer.nvim {:mod :packer} :wbthomason/packer.nvim {:mod :packer}
;; :williamboman/nvim-lsp-installbuilder {} ;; :williamboman/nvim-lsp-installbuilder {}
:williamboman/mason.nvim {:mod :mason :williamboman/mason.nvim {:mod :mason
:requires [:williamboman/mason-lspconfig.nvim]} :requires [:williamboman/mason-lspconfig.nvim]}
; NeoVim lsp server installs ; NeoVim lsp server installs
; :p00f/nvim-ts-rainbow {} ; :p00f/nvim-ts-rainbow {}
; :luochen1990/rainbow {} ; :luochen1990/rainbow {}
; :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 :root))) tree (core.first (: parser :parse))]
(: 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}