this repo has no description
1
fork

Configure Feed

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

ft: further cleanups

+118 -88
+13 -5
vim/.config/nvim/fnl/langclient.fnl
··· 8 8 9 9 (fn on_attach [client] 10 10 (cmd.packadd! :fidget.nvim) 11 + ((. (require :fidget) :setup) {}) 11 12 (logger.inspect client) 12 13 (local capable? 13 14 (fn [capability] ··· 32 33 33 34 (vim.diagnostic.config {:virtual_text false}) 34 35 35 - (lspconfig.rust_analyzer.setup {:settings {:rust-analyzer {:files {:excludeDirs [".direnv"]}}}}) 36 + (fn setup [name opts] 37 + ((. (. lspconfig name) :setup) opts)) 38 + 39 + (setup :rust_analyzer 40 + {:settings {:rust-analyzer {:files {:excludeDirs [".direnv"]}}}}) 36 41 37 - (lspconfig.elixirls.setup {:cmd [:elixir-ls] 38 - :settings {:elixirLS {:dialyzerEnabled false}}}) 42 + (setup :elixirls 43 + {:cmd [:elixir-ls] 44 + :settings {:elixirLS {:dialyzerEnabled false}}}) 39 45 40 - (lspconfig.erlangls.setup {:cmd [:erlang_ls]}) 46 + (setup :erlangls 47 + {:cmd [:erlang_ls]}) 41 48 42 - (lspconfig.rnix.setup {:autostart true}) 49 + (setup :rnix 50 + {:autostart true}) 43 51 44 52 (augroup lsp-direnv (on User :DirenvLoaded (cmd.LspStart)))
+2 -2
vim/.config/nvim/fnl/nvim/init.fnl
··· 72 72 (set-opt scope key value)))})) 73 73 74 74 (local opt (build-opts {:global (build-opts {} vim.go) 75 - :window (build-opts {} vim.wo) 76 - :buffer (build-opts {} vim.bo)} 75 + :window (build-opts {} vim.wo) 76 + :buffer (build-opts {} vim.bo)} 77 77 vim.o)) 78 78 79 79 ;; Exports
+12 -14
vim/.config/nvim/fnl/nvim/macro-init.fnl
··· 16 16 ,... 17 17 au-id)) 18 18 19 + ; TODO: Make argument passing more explicit and find another way to pass 20 + ; options. Example idea may be to parse argument list and translate them to the 21 + ; options passed to the `nvim_create_user_command`. For example `arg` will be 22 + ; for single argument `?arg` for optional argument, etc. The main problem would 23 + ; be how to pass extra options to the command. 19 24 (fn command-func [body] 20 - (let [q-args (sym :q-args) 21 - f-args (sym :f-args) 25 + (let [args (sym :args) 22 26 bang (sym :bang) 23 27 lines (sym :lines) 24 28 count (sym :count) 25 29 reg (sym :reg) 26 - mods (sym :mods) 27 - smods (sym :smods)] 30 + mods (sym :mods)] 28 31 `(lambda [arg#] 29 - (let [{:args ,q-args 30 - :fargs ,f-args 31 - :bang ,bang 32 - :line1 line1# 33 - :line2 line2# 34 - :range range# 32 + (let [{:bang ,bang 35 33 :count ,count 36 - :reg ,reg 37 - :mods ,mods 38 - :smods ,smods} arg# 39 - ,lines {:from line1# :to line2# :range range#}] 34 + :reg ,reg} arg# 35 + ,lines {:from arg#.line1 :to arg#.line2 :range arg#.range} 36 + ,args (setmetatable arg#.fargs {:__tostring (fn [] arg#.args)}) 37 + ,mods (setmetatable arg#.smods {:__tostring (fn [] arg#.mods)})] 40 38 ,body)))) 41 39 42 40 (fn defcommand [name opts ...]
+11 -6
vim/.config/nvim/fnl/plugins.fnl
··· 32 32 33 33 ; Git 34 34 (pkg :tpope/vim-fugitive) 35 - (pkg :pwntester/octo.nvim 36 - {:cmd [:Octo]}) 37 35 38 36 ; Languages 39 37 (pkg :elixir-editors/vim-elixir ··· 43 41 ; Language Protocol 44 42 (pkg :neovim/nvim-lspconfig) 45 43 (pkg :nvim-treesitter/playground 46 - {:cmd [:TSPlaygroundToggle]}) 44 + {:cmd [:TSPlaygroundToggle 45 + :TSHighlightCaputresUnderCursor]}) 47 46 (pkg :j-hui/fidget.nvim {:opt true}) 48 47 49 48 ; Code manipulation ··· 54 53 55 54 ; Task running 56 55 (pkg :hauleth/asyncdo.vim) 57 - (pkg :romainl/vim-qf) 58 - (pkg :romainl/vim-qlist) 59 - (pkg :Olical/vim-enmasse) 56 + (pkg :romainl/vim-qf 57 + {:ft [:qf] 58 + :event [:QuickFixCmdPre]}) 59 + (pkg :romainl/vim-qlist 60 + {:ft [:qf] 61 + :event [:QuickFixCmdPre]}) 62 + (pkg :Olical/vim-enmasse 63 + {:cmd [:EnMasse] 64 + :ft [:qf]}) 60 65 (pkg :igemnace/vim-makery) 61 66 62 67 ; Windows
+12 -1
vim/.config/nvim/fnl/relude.fnl
··· 6 6 matcher (if (= names nil) (sym last) names)] 7 7 `(local ,matcher (require ,mod-name)))) 8 8 9 - {: use} 9 + (fn reuse [mod names] 10 + (assert-compile (sym? mod) "expected symbol" mod) 11 + (let [mod-name (view mod) 12 + splitted (vim.split mod-name "." {:plain true}) 13 + last (. splitted (length splitted)) 14 + matcher (if (= names nil) (sym last) names)] 15 + `(local ,matcher 16 + (do 17 + (tset _G.reloadable (+ (length _G.reloadable)) ,mod-name) 18 + (require ,mod-name))))) 19 + 20 + {: use : reuse}
+62 -60
vim/.config/nvim/init.fnl
··· 1 - (import-macros {: use} :relude) 1 + (import-macros {: use : reuse} :relude) 2 2 3 3 (use nvim {: map : fun : api : opt : cmd}) 4 4 5 - (require :plugins) 5 + (reuse plugins) 6 6 7 7 (use picker) 8 8 (import-macros {: augroup : defcommand} :nvim) ··· 18 18 (do ; Colors 19 19 (cmd.colorscheme :blame) 20 20 (opt {:termguicolors true 21 - :guicursor ["n-v-c-sm:block-Cursor" 22 - "i-ci-ve:ver25-Cursor" 23 - "r-cr-o:hor20-Cursor"]})) 21 + :guicursor ["n-v-c-sm:block-Cursor" 22 + "i-ci-ve:ver25-Cursor" 23 + "r-cr-o:hor20-Cursor"]})) 24 24 25 25 (do ; Indentation 26 26 (opt {:shiftwidth 2 27 - :expandtab true 28 - :textwidth 80 29 - :wrap false 30 - :linebreak true 31 - :formatoptions :tcqjl})) 27 + :expandtab true 28 + :textwidth 80 29 + :wrap false 30 + :linebreak true 31 + :formatoptions :tcqjl})) 32 32 33 33 (do ; UI 34 34 (opt {:lazyredraw true :updatetime 500 :title true :showmode true})) 35 35 36 36 (do ; Display tabs and trailing spaces visually 37 37 (opt {:fillchars ["vert:┃" "fold:·"] 38 - :list true 39 - :listchars ["tab:→ " 40 - "trail:·" 41 - "nbsp:␣" 42 - "extends:↦" 43 - "precedes:↤"] 44 - :conceallevel 2 45 - :concealcursor :nc})) 38 + :list true 39 + :listchars ["tab:→ " 40 + "trail:·" 41 + "nbsp:␣" 42 + "extends:↦" 43 + "precedes:↤"] 44 + :conceallevel 2 45 + :concealcursor :nc})) 46 46 47 47 (do ; Ignore case. 48 48 ; If your code uses different casing to differentiate files, then you need ··· 62 62 :*.lock]})) 63 63 64 64 (opt {:diffopt+ [:indent-heuristic "algorithm:patience"] 65 - :tags^ [:./**/tags] 66 - :iskeyword+ ["-"]}) 65 + :iskeyword+ ["-"]}) 67 66 68 67 (do ; Autowrite file whenever possible 69 68 (opt {:hidden false :autowriteall true})) ··· 90 89 91 90 (do ; Save only meaningfull data to sessions 92 91 (set opt.sessionoptions [:blank 93 - :buffers 94 - :curdir 95 - :folds 96 - :tabpages 97 - :winsize 98 - :terminal])) 92 + :buffers 93 + :curdir 94 + :folds 95 + :tabpages 96 + :winsize 97 + :terminal])) 99 98 100 99 (do ; Folding 101 100 (opt {:foldmethod :expr ··· 105 104 106 105 (do ; Completion 107 106 (opt {:complete ["." :w :b :t :k :kspell] 108 - :completeopt [:menuone :noselect :noinsert]})) 107 + :completeopt [:menuone :noselect :noinsert]})) 109 108 110 109 (do ; Clap 111 110 (map :n :<Space><Space> #(picker.find-files))) ··· 150 149 {:expr true})) 151 150 152 151 (do ; Help viewing and opening URLs 152 + (defcommand Dash {:nargs "?"} (fun.dash#open (tostring args))) 153 153 (map :n :gK ":Dash") 154 - (map :n :gq (fn [] 155 - (let [name (fun.expand :<cfile>)] 156 - (fun.jobstart [:open name] {:detach true}) 157 - (print :Open name))))) 154 + (map :n :gq #(let [name (fun.expand :<cfile>)] 155 + (fun.jobstart [:open name] {:detach true}) 156 + (print :Open name)))) 158 157 159 158 (do ; Text object for whole file 160 159 (map :o :aG ":normal! ggVG")) ··· 163 162 (map :n "<Space>," ":nohlsearch")) 164 163 165 164 (do ; Terminal mappings 166 - (map :n :<C-q> :<Nop>) 167 - (map :n :<C-q>c ":term") 168 - (map :n :<C-q>s ":split +term") 169 - (map :n :<C-q>v ":vsplit +term") 170 - (map :n :<C-q>t ":tabnew +term") 165 + ; (map :n :<C-q>c ":term") 166 + (map :n :<C-q>s ":Start") 167 + (map :n :<C-q>v ":vert Start") 168 + (map :n :<C-q>t ":tab Start") 171 169 (map :t :<C-q> "<C-\\><C-n>") 172 170 (map :i :<C-q> :<ESC>) 173 171 (map :n :<C-q> :<ESC>) ··· 189 187 (git-map :g :log))) 190 188 191 189 (do ; Split management 192 - (map :n :<C-w><C-w> "<plug>(choosewin)" {:noremap false}) 193 - (map :n :<C-_> "<plug>(choosewin)" {:noremap false})) 190 + (map :n :<C-w><C-w> "<plug>(choosewin)") 191 + (map :n :<C-_> "<plug>(choosewin)")) 194 192 195 193 (do ; Search 196 194 (when (fun.executable :rg) 197 195 (opt {:grepprg "rg --vimgrep --no-heading --smart-case" 198 - :grepformat "%f:%l:%c:%m,%f:%l%m,%f %l%m"}))) 196 + :grepformat "%f:%l:%c:%m,%f:%l%m,%f %l%m"}))) 199 197 200 198 (do ; Matchparen 201 199 (set vim.g.matchup_matchparen_offscreen {:method :popup}) ··· 207 205 (do ; Autoreload Direnv after writing the .envrc 208 206 (when (fun.executable :direnv) 209 207 (augroup autoreload-envrc 210 - (on BufWritePost :.envrc (fun.system ["direnv" "allow" (fun.expand "%")]))))) 208 + (on BufWritePost :.envrc 209 + (fun.system ["direnv" "allow" (fun.expand "%")]) 210 + (cmd.DirenvExport))))) 211 211 212 212 (do ; Setup Lua extensions 213 213 (let [setup (fn [package config] ··· 217 217 :nil {} 218 218 :function (config lib) 219 219 :table config)] 220 - (f opts)))] 220 + (f opts) 221 + lib))] 221 222 (setup :mini.starter (fn [starter] 222 223 {:items [(starter.sections.sessions 10 true) 223 224 (starter.sections.builtin_actions)]})) 224 - (setup :mini.sessions {:directory "~/.local/share/nvim/site/sessions/"}) 225 + (setup :mini.sessions {:directory (.. (fun.stdpath :data) "/site/sessions/")}) 225 226 (setup :mini.align {:mappings {:start :gl 226 227 :start_with_preview :gL}}) 228 + (setup :mini.bufremove (fn [bufremove] 229 + (defcommand Bd (bufremove.delete)) 230 + (defcommand BClean 231 + (->> (fun.getbufinfo {:buflisted true}) 232 + (vim.tbl_filter #(= (next $1.windows) nil)) 233 + (#(each [_ v (ipairs $1)] 234 + (bufremove.delete v.bufnr))))) 235 + {:set_vim_settings false})) 227 236 (setup :mini.comment) 228 237 (setup :mini.ai) 229 238 (setup :mini.jump {:mappings {:repeat_jump ":"}}) 230 239 (setup :mini.surround 231 - {:mappings {:add :ys 232 - :delete :ds 233 - :find "" 240 + {:mappings {:add :gsa 241 + :delete :gsdw 242 + :find :gsf 234 243 :find_left "" 235 244 :highlight "" 236 - :replace :cs 245 + :replace :gss 237 246 :update_n_lines ""}}) 238 247 (setup :nvim-treesitter.configs 239 248 {:highlight {:enable true 240 249 ; Currently disable as it do not work as expected 241 250 :disable [:erlang :make]} 242 251 :matchup {:enable true} 243 - :indent {:enable true}}))) 244 - ; (setup :fidget {}))) 245 - 246 - (defcommand Bd "b#|bd#") 247 - (defcommand BClean (->> (fun.getbufinfo {:buflisted true}) 248 - (vim.tbl_filter #(= (next $1.windows) nil)) 249 - (#(each [_ v (ipairs $1)] 250 - (api.buf-delete v.bufnr {}))))) 252 + :indent {:enable true} 253 + :incremental_selection {:enable true}}))) 251 254 252 255 (defcommand Clean "keeppatterns %s/\\s\\+$//e | set nohlsearch") 253 256 ··· 255 258 (let [run (fn [args f-args] 256 259 (api.call-function "asyncdo#run" (vim.list_extend args f-args)))] 257 260 (defcommand Make {:bang true :nargs "*" :complete :file} 258 - (run [bang opt.makeprg] f-args)) 261 + (run [bang opt.makeprg] args)) 259 262 (defcommand Grep {:bang true :nargs "+" :complete :dir} 260 263 (run [bang {:job opt.grepprg :errorformat opt.grepformat}] 261 - f-args)))) 264 + args)))) 262 265 263 266 (defcommand Ctags (cmd.AsyncDo "ctags -R .")) 264 267 265 268 (defcommand Start {:nargs "*"} 266 - (let [command (fun.expand q-args)] 267 - (cmd.new {:mods smods}) 269 + (let [args (if (= (length args) 0) (fun.split opt.shell) args) 270 + command (icollect [_ v (pairs args)] (fun.expand v))] 271 + (cmd.new {:mods mods}) 268 272 (fun.termopen command) 269 273 (cmd.startinsert))) 270 - 271 - (defcommand Dash {:nargs "?"} (fun.dash#open q-args)) 272 274 273 275 (require :langclient)
+6
vim/.config/nvim/lua/basic.lua
··· 38 38 vim.api.nvim_create_user_command('Fnl', function(arg) fennel.eval(arg.args) end, {nargs = '*'}) 39 39 vim.api.nvim_create_user_command('FnlFile', function(arg) print(fennel.view(arg.args)) end, {nargs = 1}) 40 40 41 + _G.reloadable = {} 42 + 41 43 local function reload_init() 44 + for _, name in pairs(_G.reloadable) do 45 + package.loaded[name] = nil 46 + end 47 + 42 48 for _, init in pairs(vim.api.nvim_get_runtime_file("init.fnl", false)) do 43 49 fennel.dofile(init, {compilerEnv = _G}) 44 50 end