this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: cleanup Fennel NVim API wrapper

+133 -141
+23 -18
nix/environment.nix
··· 1 - { 2 - config, 3 - pkgs, 4 - inputs, 5 - ... 1 + { config 2 + , pkgs 3 + , inputs 4 + , ... 6 5 }: { 7 - nixpkgs.overlays = let 8 - flaked-nix-direnv = final: prev: { 9 - nix-direnv = prev.nix-direnv.override {enableFlakes = true;}; 10 - }; 11 - in [ 12 - inputs.agnoster.overlay 13 - flaked-nix-direnv 14 - ]; 6 + nixpkgs.overlays = 7 + let 8 + flaked-nix-direnv = final: prev: { 9 + nix-direnv = prev.nix-direnv.override { enableFlakes = true; }; 10 + }; 11 + in 12 + [ 13 + inputs.agnoster.overlay 14 + flaked-nix-direnv 15 + ]; 15 16 16 17 documentation.enable = false; 17 18 ··· 21 22 fswatch = pkgs.writeShellApplication { 22 23 name = "fswatch"; 23 24 24 - runtimeInputs = [pkgs.entr pkgs.ripgrep]; 25 + runtimeInputs = [ pkgs.entr pkgs.ripgrep ]; 25 26 26 27 text = '' 27 28 rg -l -t "$1" "" | entr -p echo /_ ··· 38 39 (nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)) 39 40 ]; 40 41 41 - opt = []; 42 + opt = [ ]; 42 43 }; 43 44 }; 44 45 }; 45 - in [ 46 + in 47 + [ 46 48 _1password 47 49 age 48 50 alejandra 51 + asciinema 49 52 bat 50 53 comby 51 54 coreutils 52 - # curlie 55 + curlie 53 56 difftastic 54 57 direnv 55 58 entr ··· 81 84 pinentry_mac 82 85 # qmk 83 86 ripgrep 87 + rnix-lsp 84 88 universal-ctags 85 89 # w3m 86 90 # watchman 87 91 weechat 92 + 88 93 ]; 89 94 90 - environment.shells = [pkgs.fish pkgs.zsh]; 95 + environment.shells = [ pkgs.fish pkgs.zsh ]; 91 96 92 97 environment.variables = { 93 98 EDITOR = "nvim";
+11
vim/.config/nvim/after/queries/elixir/highlights.scm
··· 1 + ;; extends 2 + 3 + (call target: ((identifier) @_test (#any-of? @_test 4 + "assert" "test" "describe" 5 + ))) 6 + 7 + (sigil 8 + "~" 9 + (sigil_name) @_sigil_name 10 + (quoted_content) @string.special 11 + (#any-of? @_sigil_name "w" "W" "c" "C"))
+11
vim/.config/nvim/after/queries/haskell/highlights.scm
··· 1 + ;; extends 2 + 3 + (((type) @type) (#eq? @type "Integer") (#set! conceal "ℤ")) 4 + (((type) @type) (#eq? @type "Rational") (#set! conceal "ℚ")) 5 + 6 + ("\\" @operator (#set! conceal "λ")) 7 + ("forall" @repeat (#set! conceal "∀")) 8 + ((where) @keyword (#set! conceal "∵")) 9 + 10 + ((exp_infix (variable) @operator) (#eq? @operator "in") (#set! conceal "∈")) 11 + (((operator) @operator) (#eq? @operator ".") (#set! conceal "∘"))
-2
vim/.config/nvim/after/syntax/css.vim
··· 1 - syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators 2 - syn match cssColor contained "#\x\{4\}\>" contains=cssUnitDecorators
vim/.config/nvim/after/syntax/elixir.vim

This is a binary file and will not be displayed.

+6 -8
vim/.config/nvim/fnl/langclient.fnl
··· 1 1 (import-macros {: use} :relude) 2 2 3 - (use nvim {: command : opts :buf-map bmap}) 3 + (use nvim {: cmd : opt :buf-map bmap}) 4 4 (use picker) 5 5 (use lspconfig) 6 6 (import-macros logger :nvim.logger) ··· 16 16 (bmap :n :K #(vim.lsp.buf.hover))) 17 17 (when (capable? :declarationProvider) 18 18 (bmap :n :gD #(vim.lsp.buf.declaration))) 19 - (when (capable? :definitionProvider) 20 - (bmap :n :gd #(vim.lsp.buf.definition))) 21 19 (when (capable? :referencesProvider) 22 20 (bmap :n :gr #(picker.lsp_references))) 23 21 (when (capable? :documentFormattingProvider) 24 - (bmap :n :Q #(vim.lsp.buf.formatting_sync))) 22 + (bmap :n :Q #(vim.lsp.buf.format))) 25 23 (when (capable? :documentSymbolProvider) 26 - (bmap :n :gO #(picker.lsp_document_symbols))) 27 - (when (capable? :completionProvider) 28 - (set opts.buffer.omnifunc "v:lua.vim.lsp.omnifunc"))) 24 + (bmap :n :gO #(picker.lsp_document_symbols)))) 29 25 30 26 (set lspconfig.util.default_config 31 27 (vim.tbl_extend :force lspconfig.util.default_config ··· 40 36 41 37 (lspconfig.erlangls.setup {:cmd [:erlang_ls]}) 42 38 43 - (augroup lsp-direnv (on User :DirenvLoaded (command :LspStart))) 39 + (lspconfig.rnix.setup {:autostart true}) 40 + 41 + (augroup lsp-direnv (on User :DirenvLoaded (cmd.LspStart)))
+3 -29
vim/.config/nvim/fnl/nvim/init.fnl
··· 42 42 (let [func (.. :nvim_ (key:gsub "-" "_"))] 43 43 (. vim.api func)))})) 44 44 45 - (local ex 46 - (setmetatable {} 47 - {:__index (fn [_ key] 48 - (fn [...] 49 - (api.command (.. key " " 50 - (table.concat [...] " ")))))})) 51 - 52 - (local func 53 - (setmetatable {} 54 - {:__index (fn [_ key] 55 - (fn [...] 56 - (api.call_function key [...])))})) 57 - 58 - (local opts 59 - (setmetatable {} 60 - {:__newindex (fn [_ key val] 61 - (print (fennel.view {: key : val})))})) 62 - 63 45 (fn ?> [f ...] 64 46 (let [(ok? val) (f)] 65 47 (if (and ok? (not= val "")) val (?> ...)))) ··· 85 67 (each [key value (pairs opts)] 86 68 (set-opt scope key value)))})) 87 69 88 - ; TODO: Allow setting buffer and window local options 89 - 90 - (local opts (build-opts {:global (build-opts {} vim.go) 70 + (local opt (build-opts {:global (build-opts {} vim.go) 91 71 :window (build-opts {} vim.wo) 92 72 :buffer (build-opts {} vim.bo)} 93 73 vim.o)) 94 - 95 - (fn executable? [name] 96 - (func.executable name)) 97 74 98 75 ;; Exports 99 - 100 76 (setmetatable {:map (make-map api.set_keymap) 101 77 :buf-map (make-map #(api.buf_set_keymap 0 $...)) 102 78 : api 103 - : ex 104 - : func 105 - : opts 106 - : executable?} {:__index api}) 79 + :fun vim.fn 80 + : opt} {:__index vim})
+4 -12
vim/.config/nvim/fnl/plugins.fnl
··· 10 10 (or ?opts {}))))) 11 11 pkg (super -pkg) 12 12 pkg-rocks (super -pkg-rocks)] 13 - (cb pkg pkg-rocks))))) 13 + (cb pkg pkg-rocks))) 14 + {:options {}})) 14 15 15 16 ;; fnlfmt: skip 16 17 (config (fn [pkg pkg-rocks] 17 18 ; Color scheme 18 19 ; (pkg :hauleth/blame.vim) 19 20 21 + (pkg :echasnovski/mini.nvim) 22 + 20 23 ; Project navigation 21 24 (pkg :tpope/vim-projectionist) 22 25 (pkg :justinmk/vim-dirvish) 23 26 (pkg :tpope/vim-eunuch) 24 27 25 28 ; File picker 26 - (pkg :nvim-lua/popup.nvim) 27 29 (pkg :nvim-lua/plenary.nvim) 28 30 (pkg :nvim-telescope/telescope.nvim) 29 31 (pkg :nvim-telescope/telescope-fzy-native.nvim) ··· 32 34 (pkg :tpope/vim-fugitive) 33 35 (pkg :pwntester/octo.nvim) 34 36 35 - ; Launch screen 36 - (pkg :mhinz/vim-startify) 37 - 38 37 ; Languages 39 38 (pkg :elixir-editors/vim-elixir) 40 39 ;(pkg :nvim-orgmode/orgmode) ··· 48 47 (pkg :AndrewRadev/splitjoin.vim) 49 48 (pkg :hauleth/sad.vim) 50 49 (pkg :tommcdo/vim-exchange) 51 - (pkg :tommcdo/vim-lion) 52 - (pkg :tpope/vim-commentary) 53 - (pkg :machakann/vim-sandwich {:opt true}) 54 - 55 - ; Movements 56 - (pkg :wellle/targets.vim {:opt true}) 57 - (pkg :rhysd/clever-f.vim) 58 50 59 51 ; Task running 60 52 (pkg :hauleth/asyncdo.vim)
+65 -53
vim/.config/nvim/init.fnl
··· 1 1 (import-macros {: use} :relude) 2 2 3 - (use nvim {: map : command : executable? : func : api : opts : ex}) 3 + (use nvim {: map : fun : api : opt : cmd}) 4 4 5 5 (use picker) 6 6 (import-macros {: augroup : defcommand} :nvim) 7 7 8 8 (require :plugins) 9 9 10 - (set opts.shell :fish) 10 + (set opt.shell :fish) 11 11 12 12 (do ; MatchIt must be unloaded for MatchPair to work correctly 13 13 (set vim.g.loaded_matchit true) ··· 16 16 (set vim.g.choosewin_label :QWERTYUIOP) 17 17 18 18 (do ; Colors 19 - (ex.colorscheme :blame) 20 - (opts {:termguicolors true 19 + (cmd.colorscheme :blame) 20 + (opt {:termguicolors true 21 21 :guicursor ["n-v-c-sm:block-Cursor" 22 22 "i-ci-ve:ver25-Cursor" 23 23 "r-cr-o:hor20-Cursor"]})) 24 24 25 25 (do ; Indentation 26 - (opts {:shiftwidth 2 26 + (opt {:shiftwidth 2 27 27 :expandtab true 28 28 :textwidth 80 29 29 :wrap false ··· 31 31 :formatoptions :tcqjl})) 32 32 33 33 (do ; UI 34 - (opts {:lazyredraw true :updatetime 500 :title true :showmode true})) 34 + (opt {:lazyredraw true :updatetime 500 :title true :showmode true})) 35 35 36 36 (do ; Display tabs and trailing spaces visually 37 - (opts {:fillchars ["vert:┃" "fold:·"] 37 + (opt {:fillchars ["vert:┃" "fold:·"] 38 38 :list true 39 39 :listchars ["tab:→ " 40 40 "trail:·" 41 41 "nbsp:␣" 42 42 "extends:↦" 43 43 "precedes:↤"] 44 - :conceallevel 2})) 44 + :conceallevel 2 45 + :concealcursor :nc})) 45 46 46 47 (do ; Ignore case. 47 48 ; If your code uses different casing to differentiate files, then you need 48 49 ; mental help 49 - (opts {:wildignorecase true 50 + (opt {:wildignorecase true 50 51 :wildmode :full 51 52 :fileignorecase true 52 53 :wildignore [:*.o ··· 60 61 :**/uploads/** 61 62 :*.lock]})) 62 63 63 - (opts {:diffopt+ [:indent-heuristic "algorithm:patience"] 64 + (opt {:diffopt+ [:indent-heuristic "algorithm:patience"] 64 65 :tags^ [:./**/tags] 65 66 :iskeyword+ ["-"]}) 66 67 67 68 (do ; Autowrite file whenever possible 68 - (opts {:hidden false :autowriteall true})) 69 + (opt {:hidden false :autowriteall true})) 69 70 70 71 (do 71 72 ; Keep cursor in the middle 72 73 (let [value 9999] 73 - (set opts.scrolloff value) 74 + (set opt.scrolloff value) 74 75 (augroup terminal-scrolloff 75 - (on BufEnter "term://*" (set opts.window.scrolloff 0)) 76 - (on BufLeave "term://*" (set opts.window.scrolloff value))))) 76 + (on BufEnter "term://*" (set opt.window.scrolloff 0)) 77 + (on BufLeave "term://*" (set opt.window.scrolloff value))))) 77 78 78 79 (do ; XXI century - we have cursors now 79 - (set opts.mouse :a)) 80 + (set opt.mouse :a)) 80 81 81 82 (do ; Split in CORRECT places 82 - (opts {:splitright true :splitbelow true})) 83 + (opt {:splitright true :splitbelow true})) 83 84 84 85 (do ; Searching 85 - (opts {:ignorecase true :smartcase true :inccommand :nosplit})) 86 + (opt {:ignorecase true :smartcase true :inccommand :nosplit})) 86 87 87 88 (do ; Permanent undo 88 - (set opts.undofile true)) 89 + (set opt.undofile true)) 89 90 90 91 (do ; Save only meaningfull data to sessions 91 - (set opts.sessionoptions [:blank 92 + (set opt.sessionoptions [:blank 92 93 :buffers 93 94 :curdir 94 95 :folds ··· 97 98 :terminal])) 98 99 99 100 (do ; Folding 100 - (opts {:foldmethod :expr 101 + (opt {:foldmethod :expr 101 102 :foldexpr "nvim_treesitter#foldexpr()" 102 103 :foldlevel 999}) 103 104 (map :n :<CR> "foldlevel(\".\") ? \"za\" : \"\\<CR>\"" {:expr true})) 104 105 105 106 (do ; Completion 106 - (opts {:complete ["." :w :b :t :k :kspell] 107 + (opt {:complete ["." :w :b :t :k :kspell] 107 108 :completeopt [:menuone :noselect :noinsert]})) 108 109 109 110 (do ; Clap ··· 151 152 (do ; Help viewing and opening URLs 152 153 (map :n :gK ":Dash") 153 154 (map :n :gq (fn [] 154 - (let [name (func.expand :<cfile>)] 155 - (func.jobstart [:open name] {:detach true}) 155 + (let [name (fun.expand :<cfile>)] 156 + (fun.jobstart [:open name] {:detach true}) 156 157 (print :Open name))))) 157 158 158 159 (do ; Text object for whole file ··· 170 171 (map :t :<C-q> "<C-\\><C-n>") 171 172 (map :i :<C-q> :<ESC>) 172 173 (map :n :<C-q> :<ESC>) 173 - (when (executable? :nvr) 174 + (when (fun.executable :nvr) 174 175 (set vim.env.EDITOR "nvr -cc split -c 'set bufhidden=delete' --remote-wait"))) 175 176 176 177 (do ; Git mappings ··· 192 193 (map :n :<C-_> "<plug>(choosewin)" {:noremap false})) 193 194 194 195 (do ; Search 195 - (when (executable? :rg) 196 - (opts {:grepprg "rg --vimgrep --no-heading --smart-case" 196 + (when (fun.executable :rg) 197 + (opt {:grepprg "rg --vimgrep --no-heading --smart-case" 197 198 :grepformat "%f:%l:%c:%m,%f:%l%m,%f %l%m"}))) 198 199 199 200 (do ; Matchparen 200 201 (set vim.g.matchup_matchparen_offscreen {:method :popup}) 201 202 (augroup matchparen 202 203 (let [term "term://*"] 203 - (on BufEnter term (ex.NoMatchParen)) 204 - (on BufLeave term (ex.DoMatchParen))))) 204 + (on BufEnter term (cmd.NoMatchParen)) 205 + (on BufLeave term (cmd.DoMatchParen))))) 205 206 206 207 (do ; Autoreload Direnv after writing the .envrc 207 - (when (executable? :direnv) 208 + (when (fun.executable :direnv) 208 209 (augroup autoreload-envrc 209 - (on BufWritePost :.envrc (ex.silent "!direnv allow %"))))) 210 + (on BufWritePost :.envrc (fun.system ["direnv" "allow" (fun.expand "%")]))))) 210 211 211 212 (do ; Setup Lua extensions 212 - (let [setup (fn [package object] 213 - ((. (require package) :setup) object))] 214 - (setup :startify {:lists [{:type :sessions :header [" Sessions"]} 215 - {:type :commands :header [" Wiki"]}] 216 - :session-dir "~/.local/share/nvim/site/sessions/" 217 - :session-autoload true 218 - :session-persistence true 219 - :change-to-dir false 220 - :change-to-vcs-root true 221 - :fortune-use-unicode true}) 213 + (let [setup (fn [package config] 214 + (let [lib (require package) 215 + f (. lib :setup) 216 + opts (match (type config) 217 + :nil {} 218 + :function (config lib) 219 + :table config)] 220 + (f opts)))] 221 + (setup :mini.starter (fn [starter] 222 + {:items [(starter.sections.sessions 10 true) 223 + (starter.sections.builtin_actions)]})) 224 + (setup :mini.sessions {:directory "~/.local/share/nvim/site/sessions/"}) 225 + (setup :mini.align {:mappings {:start :gl 226 + :start_with_preview :gL}}) 227 + (setup :mini.comment) 228 + (setup :mini.ai) 229 + (setup :mini.jump {:mappings {:repeat_jump ":"}}) 230 + (setup :mini.surround 231 + {:mappings {:add :ys 232 + :delete :ds 233 + :find "" 234 + :find_left "" 235 + :highlight "" 236 + :replace :cs 237 + :update_n_lines ""}}) 222 238 (setup :nvim-treesitter.configs 223 239 {:highlight {:enable true} 224 240 :matchup {:enable true} ··· 228 244 {:auto_update true :buttons false :blacklist [:Workspace/forte]})) 229 245 230 246 (defcommand Bd "b#|bd#") 231 - (defcommand BClean (->> (func.getbufinfo {:buflisted true}) 247 + (defcommand BClean (->> (fun.getbufinfo {:buflisted true}) 232 248 (vim.tbl_filter #(= (next $1.windows) nil)) 233 249 (#(each [_ v (ipairs $1)] 234 250 (api.buf-delete v.bufnr {}))))) ··· 239 255 (let [run (fn [args f-args] 240 256 (api.call-function "asyncdo#run" (vim.list_extend args f-args)))] 241 257 (defcommand Make {:bang true :nargs "*" :complete :file} 242 - (run [bang opts.makeprg] f-args)) 258 + (run [bang opt.makeprg] f-args)) 243 259 (defcommand Grep {:bang true :nargs "+" :complete :dir} 244 - (run [bang {:job opts.grepprg :errorformat opts.grepformat}] 260 + (run [bang {:job opt.grepprg :errorformat opt.grepformat}] 245 261 f-args)))) 246 262 247 - (defcommand Ctags (ex.AsyncDo "ctags -R .")) 263 + (defcommand Ctags (cmd.AsyncDo "ctags -R .")) 248 264 249 265 (defcommand Start {:nargs "*"} 250 - (let [cmd (func.expand q-args)] 251 - (command (.. mods " new")) 252 - (func.termopen cmd) 253 - (ex.startinsert))) 254 - 255 - (defcommand Dash {:nargs "?"} (func.dash#open q-args)) 266 + (let [command (fun.expand q-args)] 267 + (cmd.new {:mods smods}) 268 + (fun.termopen command) 269 + (cmd.startinsert))) 256 270 257 - (do ; Setup vim-sandwitch 258 - (ex.packadd! :vim-sandwich) 259 - (ex.runtime :macros/sandwich/keymap/surround.vim)) 271 + (defcommand Dash {:nargs "?"} (fun.dash#open q-args)) 260 272 261 273 (require :startify) 262 274 (require :langclient)
+10 -3
vim/.config/nvim/lua/basic.lua
··· 35 35 debug.traceback = fennel.traceback 36 36 37 37 -- Command-mode Fennel execution 38 - vim.api.nvim_create_user_command('Fennel', function(arg) fennel.eval(arg.args) end, {nargs = '*'}) 38 + vim.api.nvim_create_user_command('Fnl', function(arg) fennel.eval(arg.args) end, {nargs = '*'}) 39 + vim.api.nvim_create_user_command('FnlFile', function(arg) print(fennel.view(arg.args)) end, {nargs = 1}) 39 40 40 - for _, init in pairs(vim.api.nvim_get_runtime_file("init.fnl", false)) do 41 - fennel.dofile(init, {compilerEnv = _G}) 41 + local function reload_init() 42 + for _, init in pairs(vim.api.nvim_get_runtime_file("init.fnl", false)) do 43 + fennel.dofile(init, {compilerEnv = _G}) 44 + end 42 45 end 46 + 47 + vim.api.nvim_create_user_command('ReloadInit', reload_init, {}) 48 + 49 + reload_init()
-16
vim/.config/nvim/plugin/pack-delayed.vim
··· 1 - if exists('g:loaded_pack_delayed') 2 - finish 3 - endif 4 - let g:loaded_pack_delayed = 1 5 - 6 - func! DelayedLoad(...) " No abort as we want to continue if any plugin fails 7 - " Git 8 - packadd targets.vim 9 - 10 - autocmd! delayed_pack_load 11 - endfunc 12 - 13 - augroup delayed_pack_load 14 - autocmd! 15 - autocmd CursorHold,CursorMoved,VimEnter * call timer_start(0, function('DelayedLoad')) 16 - augroup end