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
{autoload {a aniseed.core}
require {anenv aniseed.env nvim aniseed.nvim}})
(local a (require :aniseed.core))
(local u (require :dotfiles.util))
(nvim.ex.set :shortmess+=c)
(vim.cmd.set :shortmess+=c)
; don't give |ins-completion-menu| messages.
(nvim.ex.set :path+=**)
(nvim.ex.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*")
(vim.cmd.set :path+=**)
(vim.cmd.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*")
(defn- safe-source
[filename]
(let [glob (nvim.fn.glob filename)]
(fn safe-source [filename]
(let [glob (vim.fn.glob filename)]
(if (not (a.empty? glob))
(nvim.ex.source filename))))
(vim.fn.source filename))))
; (a.map safe-source ["~/.vimrc" "~/.vimrc.local"])
(def- backup-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup))
(def- undo-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup))
(local backup-dir (.. (vim.fn.glob :$HOME) :/.vim/backup))
(local undo-dir (.. (vim.fn.glob :$HOME) :/.vim/backup))
(def- on-opts
[:autoindent
:autoread
:expandtab
:exrc
; allow project level (neo)vim files
:hlsearch
:ignorecase
:incsearch
:number
:ruler
:secure
:shiftround
; When at 3 spaces and I hit >>, go to 4, not 5.
:showcmd
; shows (parital) command in the status line
:showmatch
:smartcase
:splitbelow
:splitright
:termguicolors
:title
:undofile
:wildmenu])
(local on-opts [:autoindent
:autoread
:expandtab
:exrc
; allow project level (neo)vim files
:hlsearch
:ignorecase
:incsearch
:number
:ruler
:secure
:shiftround
; When at 3 spaces and I hit >>, go to 4, not 5.
:showcmd
; shows (parital) command in the status line
:showmatch
:smartcase
:splitbelow
:splitright
:termguicolors
:title
:undofile
:wildmenu])
(def- val-based-opts
{; :t_Co 256
:laststatus 2
:encoding :utf-8
:history 500
:redrawtime 5000
:scrolloff 3
:guifont :Hasklig
:guifontwide :Hasklig
:background :dark
:backupdir backup-dir
:directory backup-dir
;Don't clutter my dirs up with swp and tmp files
:grepprg "ag --vimgrep"
; Use Silver Searcher instead of grep
:tags :tags
:updatetime 300
; per coc.vim for diagnostic messages
:signcolumn "auto:1-3"
:colorcolumn [81 100]
:cmdheight 2
; Better display for messages
:undodir undo-dir
:undolevels 1000
:undoreload 10000
:foldmethod :expr
:foldexpr "nvim_treesitter#foldexpr()"
:foldlevelstart 100
:foldlevel 99
:tabstop 2
:shiftwidth 2
:softtabstop 2
:mouse ""
:list true
:listchars "tab:➥\\ ,trail:·,nbsp:■"
:backspace "indent,eol,start"
;allow backspacing over everything in insert mode
:wildmode "list:longest,list:full"
:wrap false})
(local val-based-opts {; :t_Co 256
:laststatus 2
:encoding :utf-8
:history 500
:redrawtime 5000
:scrolloff 3
:guifont :Hasklig
:guifontwide :Hasklig
:background :dark
:backupdir backup-dir
:directory backup-dir
;Don't clutter my dirs up with swp and tmp files
:grepprg "ag --vimgrep"
; Use Silver Searcher instead of grep
:tags :tags
:updatetime 300
; per coc.vim for diagnostic messages
:signcolumn "auto:1-3"
:colorcolumn [81 100]
:cmdheight 2
; Better display for messages
:undodir undo-dir
:undolevels 1000
:undoreload 10000
:foldmethod :expr
:foldexpr "nvim_treesitter#foldexpr()"
:foldlevelstart 100
:foldlevel 99
:tabstop 2
:shiftwidth 2
:softtabstop 2
:mouse ""
:list true
:listchars "tab:➥\\ ,trail:·,nbsp:■"
:backspace "indent,eol,start"
;allow backspacing over everything in insert mode
:wildmode "list:longest,list:full"
: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+
[[opt val]]
(let [existing-opt-val (a.get nvim.o opt)]
(fn set-opt+ [[opt val]]
(let [existing-opt-val (a.get vim.o opt)]
(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)
@@ -103,12 +96,17 @@
(a.map-indexed set-opt+ append-val-opts)
(nvim.ex.syntax :on)
(vim.cmd.syntax :on)
;; (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 :solarized8)
(vim.api.nvim_create_autocmd [:vimenter]
{:pattern "*"
:command "colorscheme solarized8"
:nested true})
;(nvim.ex.autocmd "vimenter" "*" "luafile" "treesitter.lua")
;
; (nvim.fn.glob "~/.vimrc.local")
@@ -120,7 +118,7 @@
(u.nnoremap :<leader>fsb ":call FennelScratchBuffer ()<CR>")
(fn compile-fnl [] (print :recompiling)
(anenv.init {:force true :init :dotfiles.init}))
(vim.api.nvim_create_user_command :AniseedCompile compile-fnl {})
;; (fn compile-fnl [] (print :recompiling)
;; (anenv.init {:force true :init :dotfiles.init}))
;;
;; (vim.api.nvim_create_user_command :AniseedCompile compile-fnl {})

View File

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

View File

@@ -1,20 +1,17 @@
(module dotfiles.mapping
{autoload {nvim aniseed.nvim
nu aniseed.nvim.util
core aniseed.core
util dotfiles.util}})
(local util (require :dotfiles.util))
(defn- noremap [mode from to] "Sets a mapping with {:noremap true}."
(nvim.set_keymap mode from to {:noremap true}))
(fn noremap [mode from to]
"Sets a mapping with {:noremap true}."
(vim.keymap.set mode from to {:noremap true}))
; (set nvim.g.mapleader "\\")
(defn aniseed-reload []
(each [k _ (ipairs package.loaded)]
(when (string.match k "^dotfiles%..+")
(tset package.loaded k nil)))
((. (require :aniseed.env) :init) {:module :dotfiles.init :compile true})
(core.println "aniseed reloaded!"))
(fn aniseed-reload []
(each [k _ (ipairs package.loaded)]
(when (string.match k "^dotfiles%..+")
(tset package.loaded k nil)))
((. (require :aniseed.env) :init) {:module :dotfiles.init :compile true})
(print "aniseed reloaded!"))
(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>")
; 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>")
@@ -81,10 +81,11 @@
; Trim trailing Whitespace in current line
(util.lnnoremap :tw "<C-U>.s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
;; <Leader><C-l> in terminal to clear scrollback buffer
;; 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
(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})
(def- cmp-srcs [{:name :nvim_lsp}
{:name :nvim_lua}
{:name :luasnip}
{:name :vsnip}
{:name :conjure}
{:name :buffer}
{:name :orgmode}
{:name :emoji :max_item_count 8}])
(local cmp-srcs [{:name :nvim_lsp}
{:name :nvim_lua}
{:name :luasnip}
{:name :vsnip}
{:name :conjure}
{:name :buffer}
{:name :orgmode}
{:name :emoji :max_item_count 8}])
;; Setup cmp with desired settings
(let [cmp (require :cmp)]

View File

@@ -1,13 +1,18 @@
(module dotfiles.plugin.colorizer
{autoload {colorizer colorizer}})
(colorizer.setup [:*]
{:RGB true ; #RGB hex codes, like #F00
:RRGGBB true ; #RRGGBB hex codes, like #00FF00
:names true ; "Name" codes like Blue
:RRGGBBAA true ; #RRGGBBAA hex codes
:rgb_fn true ; CSS rgb() and rgba() functions
: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
})
(let [colorizer (require :colorizer)]
(colorizer.setup ["*"] {:RGB true
; #RGB hex codes, like #F00
:RRGGBB true
; #RRGGBB hex codes, like #00FF00
:names true
; "Name" codes like Blue
:RRGGBBAA true
; #RRGGBBAA hex codes
:rgb_fn true
; CSS rgb() and rgba() functions
: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
{autoload {nvim aniseed.nvim}})
(module dotfiles.plugin.compe {autoload {nvim aniseed.nvim}})
(set nvim.o.completeopt "menuone,noselect")
(set vim.o.completeopt "menuone,noselect")
(let [compe (require :compe)]
(when compe
(compe.setup
{:enabled true
:autocomplete true
:debug false
:min_length 1
:preselect "enable"
:throttle_time 80
:source_timeout 200
:incomplete_delay 400
:max_abbr_width 100
:max_kind_width 100
:max_menu_width 100
:documentation true
:source {:path true
:buffer true
:calc true
:emoji true
:nvim_lsp true
:nvim_lua true
:conjure true
:orgmode true
:vsnip true
:vim_dadbod_completion true}})))
(compe.setup {:enabled true
:autocomplete true
:debug false
:min_length 1
:preselect :enable
:throttle_time 80
:source_timeout 200
:incomplete_delay 400
:max_abbr_width 100
:max_kind_width 100
:max_menu_width 100
:documentation true
:source {:path true
:buffer true
:calc true
:emoji true
:nvim_lsp true
:nvim_lua true
:conjure true
:orgmode true
:vsnip true
:vim_dadbod_completion true}})))
(nvim.ex.inoremap "<silent><expr> <C-Space> compe#complete()")
(nvim.ex.inoremap "<silent><expr> <CR> compe#confirm('<CR>')")

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,11 @@
(module dotfiles.plugin.mason
{autoload {a aniseed.core
nvim aniseed.nvim mason mason mason-lspconf mason-lspconfig}})
(fn setup []
(let [mason (require :mason)
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 []
(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}))))
(setup)

View File

@@ -1,13 +1,8 @@
(module dotfiles.plugin.null-ls
{autoload {nvim aniseed.nvim
a aniseed.core
nu aniseed.nvim.util
null-ls null-ls
lspconfig dotfiles.plugin.lspconfig}})
(def 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)
(let [null-ls (require :null-ls)
lspconfig (require :dotfiles.plugin.lspconfig)]
(when null-ls
(local 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
{autoload {nvim aniseed.nvim a aniseed.core ts-utils dotfiles.ts-utils}})
(module dotfiles.plugin.orgbullets {autoload {nvim aniseed.nvim}})
(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]
(let [star-count (a.count stars)
idx (math.fmod heading-level star-count)]
(if (< 0 idx)
idx
star-count)))
(fn star-index [heading-level]
(let [star-count (core.count stars)
idx (math.fmod heading-level star-count)]
(if (< 0 idx)
idx
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 []
(when (= :org vim.bo.filetype)
(let [bufnr (vim.api.nvim_get_current_buf)
star-count (a.count stars)]
(vim.api.nvim_buf_clear_namespace bufnr extmark-namespace 0 -1)
(each [id node metadata (star-captures bufnr)]
(let [[start-line start-col end-row end-col] [(node:range)]
heading-level (if (= start-line end-row)
(- end-col start-col))
star (a.get stars (star-index heading-level))
replacement (string.format (a.str "%" (+ 2 heading-level) :s)
star)]
(vim.api.nvim_buf_set_extmark bufnr extmark-namespace start-line
start-col
{:end_col end-col
:end_row end-row
:virt_text [[replacement []]]
:virt_text_pos :overlay
:hl_mode :combine}))))))
(fn gen-star-extmarks []
(when (= :org vim.bo.filetype)
(let [bufnr (vim.api.nvim_get_current_buf)
star-count (core.count stars)]
(vim.api.nvim_buf_clear_namespace bufnr extmark-namespace 0 -1)
(each [id node metadata (star-captures bufnr)]
(let [[start-line start-col end-row end-col] [(node:range)]
heading-level (if (= start-line end-row)
(- end-col start-col))
star (core.get stars (star-index heading-level))
replacement (string.format (core.str "%" (+ 2 heading-level) :s)
star)]
(vim.api.nvim_buf_set_extmark bufnr extmark-namespace start-line
start-col
{:end_col end-col
:end_row end-row
:virt_text [[replacement []]]
:virt_text_pos :overlay
:hl_mode :combine}))))))
(let [group (nvim.create_augroup :HeaderStars {:clear true})]
(nvim.create_autocmd [:FileChangedShellPost

View File

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

View File

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

View File

@@ -1,69 +1,76 @@
(module dotfiles.plugin.paredit
{autoload {nvim aniseed.nvim
a aniseed.core
nu aniseed.nvim.util
paredit paredit
ts-parsers nvim-treesitter.parsers
ts-utils nvim-treesitter.ts_utils
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)
(int->bool)
(not)
(bool->int)
(tset nvim.g x)))
(fn int->bool [x] (if (= 0 x) false true))
(defn language-at-cursor [] (let [parser (ts-parsers.get_parser)
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))))
(fn toggle-global! [x]
(->> (a.get vim.g x)
(int->bool)
(not)
(bool->int)
(tset vim.g x)))
(defn parser-language [] (let [parser (ts-parsers.get_parser)]
(when parser
(parser:lang))))
(fn language-at-cursor []
(let [parser (ts-parsers.get_parser)
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
:fennel
:hy
:janet
:julia
:lfe
:lisp
:racket
:scheme
:shen])
(fn parser-language []
(let [parser (ts-parsers.get_parser)]
(when parser
(parser:lang))))
(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 []
(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 paredit-lang? [lang] (list-member? paredit-langs lang))
(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 :javascript :call "PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :terraform :call "PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :ruby :call
"PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :javascript :call
"PareditInitBalancingAllBracketsBuffer()")
(nvim.ex.autocmd :FileType :terraform :call
"PareditInitBalancingAllBracketsBuffer()")
; (nvim.del_augroup_by_name "BabeliteParedit")
; (nvim.get_autocmds {:group "BabeliteParedit"})
@@ -75,14 +82,14 @@
;; :callback TreeSitterLangParedit}))
;;
;; (defn paredit-toggle! [] (toggle-global :paredit_mode)
;; (fn paredit-toggle! [] (toggle-global :paredit_mode)
;; (nvim.fn.PareditInitBuffer)
;; nvim.g.paredit_mode
;; )
;;
;; \
;; (int->bool 0)
;; (defn test [x] (a.get nvim.g x))
;; (fn test [x] (a.get nvim.g x))
;;
;; (test :pareditmode)
;; (a.get nvim.g :paredit_mode)

View File

@@ -1,27 +1,19 @@
(module dotfiles.plugin.smartsplits
{autoload {nvim aniseed.nvim
a aniseed.core
smart-splits smart-splits
;; util dotfiles.util
}})
(smart-splits.setup)
;; recommended mappings
;; resizing splits
;; these keymaps will also accept a range,
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
(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-k> smart-splits.resize_up)
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right)
;; moving between splits
(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-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)
(let [smart-splits (require :smart-splits)]
(when smart-splits
(smart-splits.setup)
;; recommended mappings
;; resizing splits
;; these keymaps will also accept a range,
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
(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-k> smart-splits.resize_up)
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right) ; ; moving between splits
(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-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
project-nvim project_nvim}})
(def vimgrep_arguments [:ag
:--nocolor
:--noheading
:--number
:--column
:--nobreak
:--smart-case
:--hidden
; "--skip-vcs-ignores"
; "-g" "!.git/"
:--ignore
:.git
:--follow])
(local vimgrep_arguments [:ag
:--nocolor
:--noheading
:--number
:--column
:--nobreak
:--smart-case
:--hidden
; "--skip-vcs-ignores"
; "-g" "!.git/"
:--ignore
:.git
:--follow])
(telescope.load_extension :projects)
(telescope.load_extension :yank_history)

View File

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

View File

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

View File

@@ -1,104 +1,101 @@
(module dotfiles.plugins {autoload {nvim aniseed.nvim
a aniseed.core
;; util dotfiles.util
packer packer}
;; require {minpac minpac}
})
(local packer (require :packer))
(local core (require :aniseed.core))
(defn safe-require-plugin-config [name]
(let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))]
(when (not ok?)
(print (.. "dotfiles error: " val-or-err)))))
(fn safe-require-plugin-config [name]
(let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))]
(when (not ok?)
(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
tables as well."
(packer.startup (fn [use]
(each [name opts (pairs pkgs)]
(-?> (. opts :mod) (safe-require-plugin-config))
(use (a.assoc opts 1 name))))))
(packer.startup (fn [use]
(each [name opts (pairs pkgs)]
(-?> (. opts :mod) (safe-require-plugin-config))
(use (core.assoc opts 1 name))))))
(def- packages {:Olical/aniseed {}
:Olical/conjure {:mod :conjure}
:Olical/fennel.vim {}
:ahmedkhalf/project.nvim {}
:airblade/vim-gitgutter {}
:akinsho/toggleterm.nvim {:mod :toggleterm}
:clojure-vim/vim-jack-in {}
:christianrondeau/vim-base64 {}
:dhruvasagar/vim-table-mode {}
:folke/lsp-colors.nvim {}
:folke/which-key.nvim {:mod :whichkey}
:gbprod/yanky.nvim {:mod :yanky}
:hashivim/vim-terraform {}
:HiPhish/rainbow-delimiters.nvim {}
:hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer
:hrsh7th/cmp-emoji
:hrsh7th/cmp-nvim-lsp
:hrsh7th/cmp-nvim-lua
:hrsh7th/cmp-path
:hrsh7th/cmp-vsnip
:hrsh7th/vim-vsnip-integ
:L3MON4D3/LuaSnip
:PaterJason/cmp-conjure
:saadparwaiz1/cmp_luasnip]
:mod :cmp}
:hrsh7th/vim-vsnip {}
:hrsh7th/vim-vsnip-integ {}
:Iron-E/nvim-soluarized {}
:jiangmiao/auto-pairs {}
:nvimtools/none-ls.nvim {:mod :null-ls
:requires [:nvim-lua/plenary.nvim]}
:junegunn/vim-easy-align {:mod :easyalign}
:kovisoft/paredit {:mod :paredit}
:kristijanhusak/vim-dadbod-completion {}
:kristijanhusak/vim-dadbod-ui {}
:L3MON4D3/LuaSnip {:mod :luasnip}
:lifepillar/vim-solarized8 {}
:lukas-reineke/headlines.nvim {:mod :headlines}
; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
:mrjones2014/smart-splits.nvim {:mod :smartsplits}
:mechatroner/rainbow_csv {}
:neovim/nvim-lspconfig {:mod :lspconfig}
:norcalli/nvim-colorizer.lua {:mod :colorizer}
:nvim-orgmode/orgmode {:mod :orgmode}
:nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim]
[:nvim-lua/plenary.nvim]]
:mod :telescope}
:nvim-treesitter/nvim-treesitter {:run ":TSUpdate"
:mod :treesitter}
:nvim-treesitter/playground {}
:radenling/vim-dispatch-neovim {}
:RaafatTurki/hex.nvim { :mod :hex }
:rafamadriz/friendly-snippets {}
:skywind3000/asyncrun.vim {}
;; :tjdevries/sg.nvim {:run "cargo build --workspace"
;; :dependencies [:nvim-lua/plenary.nvim]}
;; :tpope/vim-classpath {}
:tpope/vim-dadbod {}
:tpope/vim-dispatch {}
:tpope/vim-fugitive {:mod :fugitive}
:tpope/vim-git {}
:tpope/vim-pathogen {}
:tpope/vim-rails {}
:tpope/vim-repeat {}
:tpope/vim-rhubarb {}
:tpope/vim-surround {}
:tpope/vim-unimpaired {}
:tpope/vim-vinegar {}
:wbthomason/packer.nvim {:mod :packer}
;; :williamboman/nvim-lsp-installbuilder {}
:williamboman/mason.nvim {:mod :mason
:requires [:williamboman/mason-lspconfig.nvim]}
; NeoVim lsp server installs
; :p00f/nvim-ts-rainbow {}
; :luochen1990/rainbow {}
; :thecontinium/asyncomplete-conjure.vim {}
; :jose-elias-alvarez/null-ls.nvim {:mod :null-ls
; :requires [:nvim-lua/plenary.nvim]}
} ; :tpope/vim-fireplace {} ; Clojure
; :tpope/vim-sexp-mappings-for-regular-people {}
)
(local packages {:Olical/aniseed {}
:Olical/conjure {:mod :conjure}
:Olical/fennel.vim {}
:ahmedkhalf/project.nvim {}
:airblade/vim-gitgutter {}
:akinsho/toggleterm.nvim {:mod :toggleterm}
:clojure-vim/vim-jack-in {}
:christianrondeau/vim-base64 {}
:dhruvasagar/vim-table-mode {}
:folke/lsp-colors.nvim {}
:folke/which-key.nvim {:mod :whichkey}
:gbprod/yanky.nvim {:mod :yanky}
:hashivim/vim-terraform {}
:HiPhish/rainbow-delimiters.nvim {}
:hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer
:hrsh7th/cmp-emoji
:hrsh7th/cmp-nvim-lsp
:hrsh7th/cmp-nvim-lua
:hrsh7th/cmp-path
:hrsh7th/cmp-vsnip
:hrsh7th/vim-vsnip-integ
:L3MON4D3/LuaSnip
:PaterJason/cmp-conjure
:saadparwaiz1/cmp_luasnip]
:mod :cmp}
:hrsh7th/vim-vsnip {}
:hrsh7th/vim-vsnip-integ {}
:Iron-E/nvim-soluarized {}
:jiangmiao/auto-pairs {}
:nvimtools/none-ls.nvim {:mod :null-ls
:requires [:nvim-lua/plenary.nvim]}
:junegunn/vim-easy-align {:mod :easyalign}
:kovisoft/paredit {:mod :paredit}
:kristijanhusak/vim-dadbod-completion {}
:kristijanhusak/vim-dadbod-ui {}
:L3MON4D3/LuaSnip {:mod :luasnip}
:lifepillar/vim-solarized8 {}
:lukas-reineke/headlines.nvim {:mod :headlines}
; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
:mrjones2014/smart-splits.nvim {:mod :smartsplits}
:mechatroner/rainbow_csv {}
:neovim/nvim-lspconfig {:mod :lspconfig}
:norcalli/nvim-colorizer.lua {:mod :colorizer}
:nvim-orgmode/orgmode {:mod :orgmode}
:nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim]
[:nvim-lua/plenary.nvim]]
:mod :telescope}
:nvim-treesitter/nvim-treesitter {:run ":TSUpdate"
:mod :treesitter}
:nvim-treesitter/playground {}
:radenling/vim-dispatch-neovim {}
:RaafatTurki/hex.nvim {:mod :hex}
:rafamadriz/friendly-snippets {}
:skywind3000/asyncrun.vim {}
;; :tjdevries/sg.nvim {:run "cargo build --workspace"
;; :dependencies [:nvim-lua/plenary.nvim]}
;; :tpope/vim-classpath {}
:tpope/vim-dadbod {}
:tpope/vim-dispatch {}
:tpope/vim-fugitive {:mod :fugitive}
:tpope/vim-git {}
:tpope/vim-pathogen {}
:tpope/vim-rails {}
:tpope/vim-repeat {}
:tpope/vim-rhubarb {}
:tpope/vim-surround {}
:tpope/vim-unimpaired {}
:tpope/vim-vinegar {}
:wbthomason/packer.nvim {:mod :packer}
;; :williamboman/nvim-lsp-installbuilder {}
:williamboman/mason.nvim {:mod :mason
:requires [:williamboman/mason-lspconfig.nvim]}
; NeoVim lsp server installs
; :p00f/nvim-ts-rainbow {}
; :luochen1990/rainbow {}
; :thecontinium/asyncomplete-conjure.vim {}
; :jose-elias-alvarez/null-ls.nvim {:mod :null-ls
; :requires [:nvim-lua/plenary.nvim]}
}
; :tpope/vim-fireplace {} ; Clojure ; :tpope/vim-sexp-mappings-for-regular-people {}
)
(use packages)

View File

@@ -1,6 +1,4 @@
(module dotfiles.terraform-helpers
{autoload {a aniseed.core}
require {anenv aniseed.env nvim aniseed.nvim u dotfiles.util}})
(module dotfiles.terraform-helpers {require {nvim aniseed.nvim}})
(fn append-to-buf [bufno 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 {})
tree (a.first (: parser :parse))]
(: tree :root)))
(fn root [bufnr lang]
(let [parser (vim.treesitter.get_parser bufnr lang {})
tree (core.first (: parser :parse))]
(: tree :root)))
(defn make-query [lang query-string]
(let [query (vim.treesitter.query.parse lang "(headline (stars) @stars)")]
(fn [bufnr]
(let [root-node (root bufnr lang)
iter-captures (query.iter_captures query root-node bufnr 0 -1)]
iter-captures))))
(fn make-query [lang query-string]
(let [query (vim.treesitter.query.parse lang "(headline (stars) @stars)")]
(fn [bufnr]
(let [root-node (root bufnr lang)
iter-captures (query.iter_captures query root-node bufnr 0 -1)]
iter-captures))))
{: root : make-query}