From d446425f255706c66a05f93325686fc446af4eb8 Mon Sep 17 00:00:00 2001 From: Leon Kowarschick Date: Fri, 6 Oct 2023 18:26:06 +0200 Subject: [PATCH] cleanup vim --- nvim/.config/nvim/fnl/dots/help-thingy.fnl | 68 ------- nvim/.config/nvim/fnl/dots/keybinds.fnl | 58 +++--- .../nvim/fnl/dots/plugins/bufferline.fnl | 4 +- nvim/.config/nvim/fnl/dots/plugins/cmp.fnl | 25 ++- .../.config/nvim/fnl/dots/plugins/copilot.fnl | 26 +-- nvim/.config/nvim/fnl/dots/plugins/crates.fnl | 18 -- .../nvim/fnl/dots/plugins/diffview.fnl | 25 ++- nvim/.config/nvim/fnl/dots/plugins/emmet.fnl | 3 +- nvim/.config/nvim/fnl/dots/plugins/feline.fnl | 179 +++++++++--------- .../nvim/fnl/dots/plugins/gitsigns.fnl | 7 +- nvim/.config/nvim/fnl/dots/plugins/glance.fnl | 8 - .../nvim/fnl/dots/plugins/gruvbox8.fnl | 6 +- nvim/.config/nvim/fnl/dots/plugins/lsp.fnl | 9 - .../.config/nvim/fnl/dots/plugins/ltex-ls.fnl | 13 +- nvim/.config/nvim/fnl/dots/plugins/neogit.fnl | 9 - nvim/.config/nvim/fnl/dots/plugins/noice.fnl | 74 ++++---- .../nvim/fnl/dots/plugins/nvim-colorizer.fnl | 7 +- .../nvim/fnl/dots/plugins/persistence.fnl | 11 -- .../.config/nvim/fnl/dots/plugins/plugins.fnl | 49 +++-- nvim/.config/nvim/fnl/dots/plugins/sneak.fnl | 9 - .../nvim/fnl/dots/plugins/telescope.fnl | 10 +- .../nvim/fnl/dots/plugins/todo-comments.fnl | 22 +-- .../nvim/fnl/dots/plugins/treesitter.fnl | 4 +- .../.config/nvim/fnl/dots/plugins/trouble.fnl | 13 +- nvim/.config/nvim/fnl/dots/plugins/vimtex.fnl | 3 +- .../nvim/fnl/dots/smart-compe-conjure.fnl | 58 ------ nvim/.config/nvim/fnl/dots/utils.fnl | 45 +---- nvim/.config/nvim/fnl/macros.fnl | 56 +----- nvim/.config/nvim/fnl/main.fnl | 24 +-- nvim/.config/nvim/lazy-lock.json | 11 +- 30 files changed, 266 insertions(+), 588 deletions(-) delete mode 100644 nvim/.config/nvim/fnl/dots/help-thingy.fnl delete mode 100644 nvim/.config/nvim/fnl/dots/plugins/crates.fnl delete mode 100644 nvim/.config/nvim/fnl/dots/plugins/glance.fnl delete mode 100644 nvim/.config/nvim/fnl/dots/plugins/neogit.fnl delete mode 100644 nvim/.config/nvim/fnl/dots/plugins/persistence.fnl delete mode 100644 nvim/.config/nvim/fnl/dots/plugins/sneak.fnl delete mode 100644 nvim/.config/nvim/fnl/dots/smart-compe-conjure.fnl diff --git a/nvim/.config/nvim/fnl/dots/help-thingy.fnl b/nvim/.config/nvim/fnl/dots/help-thingy.fnl deleted file mode 100644 index facc0a6..0000000 --- a/nvim/.config/nvim/fnl/dots/help-thingy.fnl +++ /dev/null @@ -1,68 +0,0 @@ -(fn help-thingy-kram [] - (local {: autoload} (require :nfnl.module)) - (local utils (autoload :dots.utils)) - (local a (autoload :aniseed.core)) - (local str (autoload :aniseed.string)) - (local popup (autoload :popup)) - (local ts (autoload :nvim-treesitter)) - - (defn pop [text ft] - "Open a popup with the given text and filetype" - (var width 20) - (each [_ line (ipairs text)] - (set width (math.max width (length line)))) - (let [bufnr (vim.api.nvim_create_buf false true)] - (vim.api.nvim_buf_set_option bufnr :bufhidden "wipe") - (vim.api.nvim_buf_set_option bufnr :filetype ft) - (vim.api.nvim_buf_set_lines bufnr 0 -1 true text) - (popup.create bufnr {:padding [1 1 1 1] :width width}))) - - - (defn get-current-word [] - "Return the word the cursor is currently hovering over" - (let [col (. (vim.api.nvim_win_get_cursor 0) 2) - line (vim.api.nvim_get_current_line)] - (.. (vim.fn.matchstr (line:sub 1 (+ col 1)) "\\k*$") - (string.sub (vim.fn.matchstr (line:sub (+ col 1)) "^\\k*") - 2)))) - (def helpfiles-path (str.join "/" (a.butlast (str.split vim.o.helpfile "/")))) - - (def tags - (var entries {}) - (each [line _ (io.lines (.. helpfiles-path "/tags"))] - (let [[key file address] (str.split line "\t")] - (tset entries key {:file (.. helpfiles-path "/" file) :address address}))) - entries) - - (defn find-help-tag-for [topic] - (or (. tags topic) - (. tags (.. topic "()")) - (. tags (.. (string.gsub topic "vim%.api%." "") "()")) - (. tags (.. (string.gsub topic "vim%.fn%." "") "()")) - (. tags (.. (string.gsub topic "fn%." "") "()")) - (. tags (.. (string.gsub topic "vim%.o%." "") "()")) - (. tags (.. (string.gsub topic "vim%.b%." "") "()")) - (. tags (.. (string.gsub topic "vim%.g%." "") "()")))) - - - (defn help-for-tag [tag] - (var data nil) - (each [line _ (io.lines tag.file)] - (if (= nil data) - (when (~= -1 (vim.fn.match line (tag.address:sub 2))) - (set data [line])) - (if (or (> 2 (length data)) - (= "" line) - (= " " (line:sub 1 1)) - (= "\t" (line:sub 1 1)) - (= "<" (line:sub 1 1))) - (table.insert data line) - (lua "return data"))))) - - (fn _G.get_help [] - (if-let [help-tag (find-help-tag-for (get-current-word))] - (pop (help-for-tag help-tag) :help))) - - (utils.keymap :n :ML ":call v:lua.get_help()")) - -[] diff --git a/nvim/.config/nvim/fnl/dots/keybinds.fnl b/nvim/.config/nvim/fnl/dots/keybinds.fnl index c5fe7c7..71e3c71 100644 --- a/nvim/.config/nvim/fnl/dots/keybinds.fnl +++ b/nvim/.config/nvim/fnl/dots/keybinds.fnl @@ -1,17 +1,18 @@ -(import-macros {: al} :macros) -(al a nfnl.core) -(al str nfnl.string) -(al utils dots.utils) -(al wk which-key) -; (al treesitter-selection nvim-treesitter.incremental_selection) -(al lspactions lspactions) -(al glance glance) -(al crates crates) +(local {: autoload} (require :nfnl.module)) +(local a (autoload :nfnl.core)) +(local str (autoload :nfnl.string)) +(local utils (autoload :dots.utils)) +(local wk (autoload :which-key)) +(local glance (autoload :glance)) +(local crates (autoload :crates)) +(local dap (autoload :dap)) +(local dapui (autoload :dapui)) + + ; undo autopairs fuckup (set vim.g.AutoPairsShortcutBackInsert "") -(utils.keymap [:n] : "Telescope file_browser") (utils.keymap :n :K "") (utils.keymap :v :K "") @@ -19,9 +20,6 @@ (utils.keymap :i : "") (utils.keymap :i : "") -(utils.keymap :n :MM "lua require('nvim-gehzu').go_to_definition()" {}) -(utils.keymap :n :MN "lua require('nvim-gehzu').show_definition()" {}) - (utils.keymap :n :zt "zt") (utils.keymap :n :zb "zb") @@ -32,7 +30,6 @@ (utils.keymap :n : "lua vim.lsp.buf.definition()") (utils.keymap :n : "lua vim.lsp.buf.hover()") -(utils.keymap :n : "HopChar2") ;(utils.keymap :i : "(copilot-suggest)") ;(utils.keymap :i : "(copilot-dismiss)") @@ -44,6 +41,7 @@ (utils.keymap :n : "RustMoveItemUpk") +(utils.keymap :n : "HopChar2") ; Fix keybinds in linewrapped mode @@ -69,21 +67,19 @@ (vim.api.nvim_feedkeys (.. ":IncRename " (vim.fn.expand "")) "n" "")) (fn toggle-lsp-lines [] - (let [lsp-lines (require "lsp_lines")] - (vim.diagnostic.config {:virtual_lines (not (. (vim.diagnostic.config) :virtual_lines))}) - ; TODO: this doesn't seem to work... - (vim.diagnostic.config {:virtual_text (not (. (vim.diagnostic.config) :virtual_lines))}))) + (vim.diagnostic.config {:virtual_lines (not (. (vim.diagnostic.config) :virtual_lines))}) + ; TODO: this doesn't seem to work... + (vim.diagnostic.config {:virtual_text (not (. (vim.diagnostic.config) :virtual_lines))})) (fn toggle-lsp-lines-current [] - (let [lsp-lines (require "lsp_lines")] - (vim.diagnostic.config {:virtual_lines {:only_current_line true}}))) + (vim.diagnostic.config {:virtual_lines {:only_current_line true}})) (wk.setup {}) (wk.register {"c" {:name "+comment out"} "e" {:name "+emmet"} - "" (cmd "HopWord" "Hop to a word") + "[" (cmd "HopWord" "Hop to a word") "h" (cmd "bprevious" "previous buffer") "l" (cmd "bnext" "next buffer") "o" (cmd "Telescope live_grep" "Grep files") @@ -96,14 +92,14 @@ "n" [(. (require :persistence) :load) "Load last session"] "d" {:name "+Debugging" - "b" [#(req dap.toggle_breakpoint) "toggle breakpoint"] - "u" [#(req dapui.toggle) "toggle dapui"] - "c" [#(req dap.step_into) "continue"] - "r" [(. (require "dap") :repl :open) "open repl"] + "b" [dap.toggle_breakpoint "toggle breakpoint"] + "u" [dapui.toggle "toggle dapui"] + "c" [dap.step_into "continue"] + "r" [dap.repl.open "open repl"] "s" {:name "+Step" - "o" [#(req dap.step_over) "over"] - "u" [#(req dap.step_out) "out"] - "i" [#(req dap.step_into) "into"]}} + "o" [dap.step_over "over"] + "u" [dap.step_out "out"] + "i" [dap.step_into "into"]}} "m" {:name "+Code actions" ";" [#(set vim.o.spell (not vim.o.spell)) "Toggle spell checking"] @@ -154,9 +150,9 @@ "w" (cmd "set wrap! linebreak!" "toggle linewrapping")} "b" {:name "+buffers" - "b" (cmd "Buffers" "select open buffer") - "c" (cmd ":Bdelete!" "close open buffer") - "w" (cmd ":Bwipeout!" "wipeout open buffer")}} + "b" (cmd ":Telescope buffers" "select open buffer") + "c" (cmd ":Bdelete!" "close open buffer") + "w" (cmd ":Bwipeout!" "wipeout open buffer")}} {:prefix""}) diff --git a/nvim/.config/nvim/fnl/dots/plugins/bufferline.fnl b/nvim/.config/nvim/fnl/dots/plugins/bufferline.fnl index 5652323..895ce28 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/bufferline.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/bufferline.fnl @@ -39,7 +39,7 @@ :warning visible :warning_visible visible :warning_selected selected :error visible :error_visible visible :error_selected selected :duplicate visible :duplicate_visible visible :duplicate_selected selected - + :diagnostic (mk-visible colors.neutral_red) :diagnostic_visible (mk-visible colors.neutral_red) :diagnostic_selected (mk-active colors.faded_red) @@ -61,6 +61,8 @@ :error_diagnostic_selected (mk-active colors.red) :separator visible + :separator_visible {:bg colors.red} + :separator_selected {:bg colors.red} :indicator_selected {:bg colors.neutral_aqua :fg colors.neutral_aqua :italic false :bold false} :tab_separator {:bg colors.red} :tab_separator_selected {:bg colors.neutral_aqua :fg colors.neutral_aqua} diff --git a/nvim/.config/nvim/fnl/dots/plugins/cmp.fnl b/nvim/.config/nvim/fnl/dots/plugins/cmp.fnl index 41df439..3f374f3 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/cmp.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/cmp.fnl @@ -1,20 +1,17 @@ -(import-macros {: al} :macros) -(al a nfnl.core) -(al cmp cmp) -(al utils dots.utils) +(local {: autoload} (require :nfnl.module)) +(local utils (autoload :dots.utils)) +(local cmp (autoload :cmp)) +; check this for coloring maybe +; https://github.com/hrsh7th/nvim-cmp/blob/ada9ddeff71e82ad0e52c9a280a1e315a8810b9a/lua/cmp/entry.lua#L199 +(fn item-formatter [item vim-item] + (let [padding (string.rep " " (- 10 (vim.fn.strwidth vim-item.abbr))) + details (?. item :completion_item :detail)] + (when details + (set vim-item.abbr (.. vim-item.abbr padding " " details)))) + vim-item) (fn setup [] - ; check this for coloring maybe - ; https://github.com/hrsh7th/nvim-cmp/blob/ada9ddeff71e82ad0e52c9a280a1e315a8810b9a/lua/cmp/entry.lua#L199 - (fn item-formatter [item vim-item] - (let [padding (string.rep " " (- 10 (vim.fn.strwidth vim-item.abbr))) - details (?. item :completion_item :detail)] - (when details - (set vim-item.abbr (.. vim-item.abbr padding " " details)))) - vim-item) - - (cmp.setup {:snippet {:expand (fn [args] ((. vim.fn :vsnip#anonymous) args.body))} diff --git a/nvim/.config/nvim/fnl/dots/plugins/copilot.fnl b/nvim/.config/nvim/fnl/dots/plugins/copilot.fnl index 86e0e88..da296e0 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/copilot.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/copilot.fnl @@ -1,18 +1,12 @@ -(import-macros {: al} :macros) -(al copilot copilot) -(al utils dots.utils) - -(fn setup [] - (copilot.setup - {:panel {:enabled false} - :suggestion {:enabled true - :auto_trigger :true - :keymap {:accept "" - :next ""}}})) +(local utils (require :dots.utils)) ;:github/copilot.vim {:cmd ["Copilot"]} -;[(utils.plugin :zbirenbaum/copilot.lua -; {:cmd "Copilot" -; :event "InsertEnter" -; :config setup}})) -[] +[(utils.plugin + :zbirenbaum/copilot.lua + {:cmd "Copilot" + :event "InsertEnter" + :opts {:panel {:enabled false} + :suggestion {:enabled true + :auto_trigger :true + :keymap {:accept "" + :next ""}}}})] diff --git a/nvim/.config/nvim/fnl/dots/plugins/crates.fnl b/nvim/.config/nvim/fnl/dots/plugins/crates.fnl deleted file mode 100644 index 753761a..0000000 --- a/nvim/.config/nvim/fnl/dots/plugins/crates.fnl +++ /dev/null @@ -1,18 +0,0 @@ -(import-macros {: al} :macros) - -(al utils dots.utils) -(al crates crates) - -(fn setup [] - (crates.setup {:disable_invalid_feature_diagnostic true - :enable_update_available_warning false})) - - - -[(utils.plugin :Saecki/crates.nvim - {:dependencies ["nvim-lua/plenary.nvim"] - :dir "/Users/leon/tmp/crates.nvim" - :event ["BufRead Cargo.toml"] - :lazy true - :config setup})] - diff --git a/nvim/.config/nvim/fnl/dots/plugins/diffview.fnl b/nvim/.config/nvim/fnl/dots/plugins/diffview.fnl index c32251b..a403664 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/diffview.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/diffview.fnl @@ -1,18 +1,15 @@ -(import-macros m :macros) -(m.al diffview diffview) -(m.al cb diffview.config) -(m.al utils dots.utils) +(local {: autoload} (require :nfnl.module)) +(local utils (require :dots.utils)) +(local cb (autoload :diffview.config)) +(local diffview (autoload :diffview)) -(fn setup [] - (diffview.setup - {:diff_binaries false - :file_panel {:width 35 - :use_icons false} - :key_bindings {:view {:dn (cb.diffview_callback "select_next_entry") - :dp (cb.diffview_callback "select_prev_entry") - :dd (cb.diffview_callback "toggle_files")}}})) [(utils.plugin :sindrets/diffview.nvim {:cmd ["DiffviewOpen" "DiffviewToggleFiles"] - :config #setup})] - + :config #(diffview.setup + {:diff_binaries false + :file_panel {:width 35 + :use_icons false} + :key_bindings {:view {:dn (cb.diffview_callback "select_next_entry") + :dp (cb.diffview_callback "select_prev_entry") + :dd (cb.diffview_callback "toggle_files")}}})})] diff --git a/nvim/.config/nvim/fnl/dots/plugins/emmet.fnl b/nvim/.config/nvim/fnl/dots/plugins/emmet.fnl index 3c4f892..b9c032f 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/emmet.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/emmet.fnl @@ -1,5 +1,4 @@ -(import-macros m :macros) -(m.al utils dots.utils) +(local utils (require :dots.utils)) (fn setup [] (set vim.g.user_emmet_mode "n") diff --git a/nvim/.config/nvim/fnl/dots/plugins/feline.fnl b/nvim/.config/nvim/fnl/dots/plugins/feline.fnl index 630e3f9..1d20e21 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/feline.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/feline.fnl @@ -1,115 +1,112 @@ -(import-macros m :macros) -(m.al a nfnl.core) -(m.al utils dots.utils) -(m.al str nfnl.string) -(m.al colors dots.colors) -(m.al feline feline) -(m.al feline-git feline.providers.git) -(m.al feline-lsp feline.providers.lsp) +(local {: autoload} (require :nfnl.module)) +(local utils (autoload :dots.utils)) +(local a (autoload :nfnl.core)) +(local str (autoload :nfnl.string)) +(local colors (autoload :dots.colors)) +(local feline (autoload :feline)) -(fn setup []) -(set vim.opt.termguicolors true) -(local modes - {:n {:text "NORMAL" :color colors.neutral_aqua} - :i {:text "INSERT" :color colors.neutral_yellow} - :c {:text "CMMAND" :color colors.neutral_aqua} - :ce {:text "NORMEX" :color colors.neutral_aqua} - :cv {:text "EX" :color colors.neutral_aqua} - :ic {:text "INSCOMP" :color colors.neutral_aqua} - :no {:text "OP-PENDING" :color colors.neutral_aqua} - :r {:text "HIT-ENTER" :color colors.neutral_aqua} - :r? {:text "CONFIRM" :color colors.neutral_aqua} - :R {:text "REPLACE" :color colors.neutral_aqua} - :Rv {:text "VIRTUAL" :color colors.neutral_aqua} - :s {:text "SELECT" :color colors.neutral_aqua} - :S {:text "SELECT" :color colors.neutral_aqua} - :t {:text "TERM" :color colors.neutral_aqua} - :v {:text "VISUAL" :color colors.neutral_blue} - :V {:text "VISUAL LINE" :color colors.neutral_blue} - "" {:text "VISUAL BLOCK" :color colors.neutral_blue}}) +(fn setup [] + (set vim.opt.termguicolors true) -(local bar-bg colors.bg_main) -(local horiz-separator-color colors.light1) + (local modes + {:n {:text "NORMAL" :color colors.neutral_aqua} + :i {:text "INSERT" :color colors.neutral_yellow} + :c {:text "CMMAND" :color colors.neutral_aqua} + :ce {:text "NORMEX" :color colors.neutral_aqua} + :cv {:text "EX" :color colors.neutral_aqua} + :ic {:text "INSCOMP" :color colors.neutral_aqua} + :no {:text "OP-PENDING" :color colors.neutral_aqua} + :r {:text "HIT-ENTER" :color colors.neutral_aqua} + :r? {:text "CONFIRM" :color colors.neutral_aqua} + :R {:text "REPLACE" :color colors.neutral_aqua} + :Rv {:text "VIRTUAL" :color colors.neutral_aqua} + :s {:text "SELECT" :color colors.neutral_aqua} + :S {:text "SELECT" :color colors.neutral_aqua} + :t {:text "TERM" :color colors.neutral_aqua} + :v {:text "VISUAL" :color colors.neutral_blue} + :V {:text "VISUAL LINE" :color colors.neutral_blue} + "" {:text "VISUAL BLOCK" :color colors.neutral_blue}}) -(fn or-empty [x] (or x "")) -(fn spaces [x] (if x (.. " " x " ") "")) + (local bar-bg colors.bg_main) + (local horiz-separator-color colors.light1) -(fn get-current-filepath [] - (let [file (utils.shorten-path (vim.fn.bufname) 30 30)] - (if (a.empty? file) "" - vim.bo.readonly (.. "RO " file) - (and vim.bo.modifiable vim.bo.modified) (.. file " ●") - (.. file " ")))) + (fn or-empty [x] (or x "")) + (fn spaces [x] (if x (.. " " x " ") "")) -(fn vim-mode-hl [use-as-fg?] - (let [color (. modes (vim.fn.mode) :color)] - (if use-as-fg? {:bg bar-bg :fg color} {:bg color :fg bar-bg}))) + (fn get-current-filepath [] + (let [file (utils.shorten-path (vim.fn.bufname) 30 30)] + (if (a.empty? file) "" + vim.bo.readonly (.. "RO " file) + (and vim.bo.modifiable vim.bo.modified) (.. file " ●") + (.. file " ")))) -(fn git-status-provider [] - (or-empty (utils.keep-if #(~= "master" $1) - (?. vim.b :gitsigns_status_dict :head)))) + (fn vim-mode-hl [use-as-fg?] + (let [color (. modes (vim.fn.mode) :color)] + (if use-as-fg? {:bg bar-bg :fg color} {:bg color :fg bar-bg}))) -(fn vim-mode [] - (.. " " (or (. modes (vim.fn.mode) :text) vim.fn.mode) " ")) + (fn git-status-provider [] + (or-empty (utils.keep-if #(~= "master" $1) + (?. vim.b :gitsigns_status_dict :head)))) -(fn lsp-progress-provider [] - (let [msgs (vim.lsp.util.get_progress_messages) - s (icollect [_ msg (ipairs msgs)] - (when msg.message - (.. msg.title " " msg.message)))] - (or-empty (str.join " | " s)))) + (fn vim-mode [] + (.. " " (or (. modes (vim.fn.mode) :text) vim.fn.mode) " ")) + + (fn lsp-progress-provider [] + (let [msgs (vim.lsp.util.get_progress_messages) + s (icollect [_ msg (ipairs msgs)] + (when msg.message + (.. msg.title " " msg.message)))] + (or-empty (str.join " | " s)))) -(fn lsp-diagnostic-component [kind color] - {:enabled #(~= 0 (length (vim.diagnostic.get 0 {:severity kind}))) - :provider #(spaces (length (vim.diagnostic.get 0 {:severity kind}))) - :left_sep "" - :right_sep "" - :hl {:fg bar-bg :bg color}}) + (fn lsp-diagnostic-component [kind color] + {:enabled #(~= 0 (length (vim.diagnostic.get 0 {:severity kind}))) + :provider #(spaces (length (vim.diagnostic.get 0 {:severity kind}))) + :left_sep "" + :right_sep "" + :hl {:fg bar-bg :bg color}}) -(fn coordinates [] - (let [[line col] (vim.api.nvim_win_get_cursor 0)] - (.. " " line " "))) + (fn coordinates [] + (let [[line col] (vim.api.nvim_win_get_cursor 0)] + (.. " " line ":" col " "))) ; Fills the bar with an horizontal line -(fn inactive-separator-provider [] - (if (not= (vim.fn.winnr) (vim.fn.winnr :j)) - (string.rep "─" (vim.api.nvim_win_get_width 0)) - "")) - -(local components {:active {} :inactive {}}) + (fn inactive-separator-provider [] + (if (not= (vim.fn.winnr) (vim.fn.winnr :j)) + (string.rep "─" (vim.api.nvim_win_get_width 0)) + "")) + + (local components {:active {} :inactive {}}) -(tset components.active 1 - [{:provider vim-mode :hl #(vim-mode-hl false)} - {:provider get-current-filepath :left_sep " " :hl {:fg colors.light4}} - {:provider git-status-provider :left_sep " " :hl #(vim-mode-hl true)}]) + (tset components.active 1 + [{:provider vim-mode :hl #(vim-mode-hl false)} + {:provider get-current-filepath :left_sep " " :hl {:fg colors.light4}} + {:provider git-status-provider :left_sep " " :hl #(vim-mode-hl true)}]) -(tset components.active 2 - [{:provider lsp-progress-provider - :left_sep " " - :right_sep " " - :enabled #(< 0 (length (vim.lsp.buf_get_clients)))}]) + (tset components.active 2 + [{:provider lsp-progress-provider + :left_sep " " + :right_sep " " + :enabled #(< 0 (length (vim.lsp.buf_get_clients)))}]) -(tset components.active 3 - [{:provider vim.bo.filetype :right_sep " " :hl #(vim-mode-hl true)} - (lsp-diagnostic-component vim.diagnostic.severity.INFO colors.neutral_green) - (lsp-diagnostic-component vim.diagnostic.severity.HINT colors.neutral_aqua) - (lsp-diagnostic-component vim.diagnostic.severity.WARN colors.neutral_yellow) - (lsp-diagnostic-component vim.diagnostic.severity.ERROR colors.neutral_red) - {:provider coordinates :hl #(vim-mode-hl false)}]) + (tset components.active 3 + [{:provider vim.bo.filetype :right_sep " " :hl #(vim-mode-hl true)} + (lsp-diagnostic-component vim.diagnostic.severity.INFO colors.neutral_green) + (lsp-diagnostic-component vim.diagnostic.severity.HINT colors.neutral_aqua) + (lsp-diagnostic-component vim.diagnostic.severity.WARN colors.neutral_yellow) + (lsp-diagnostic-component vim.diagnostic.severity.ERROR colors.neutral_red) + {:provider coordinates :hl #(vim-mode-hl false)}]) -(tset components.inactive 1 - [{:provider inactive-separator-provider - :hl {:bg "NONE" :fg horiz-separator-color}}]) + (tset components.inactive 1 + [{:provider inactive-separator-provider + :hl {:bg "NONE" :fg horiz-separator-color}}]) + (utils.highlight-add :StatusLineNC {:bg "NONE" :fg colors.light1}) - -(utils.highlight-add :StatusLineNC {:bg "NONE" :fg colors.light1}) - -(feline.setup {:theme {:fg colors.light1 :bg colors.bg_main} - :components components}) + (feline.setup {:theme {:fg colors.light1 :bg colors.bg_main} + :components components})) [(utils.plugin :Famiu/feline.nvim {:config setup})] diff --git a/nvim/.config/nvim/fnl/dots/plugins/gitsigns.fnl b/nvim/.config/nvim/fnl/dots/plugins/gitsigns.fnl index 1a766de..968f2b2 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/gitsigns.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/gitsigns.fnl @@ -1,7 +1,6 @@ -(import-macros m :macros) -(m.al utils dots.utils) -(m.al colors dots.colors) -(m.al gitsigns gitsigns) +(local {: autoload} (require :nfnl.module)) +(local utils (autoload :dots.utils)) +(local gitsigns (autoload :gitsigns)) (fn setup [] (gitsigns.setup diff --git a/nvim/.config/nvim/fnl/dots/plugins/glance.fnl b/nvim/.config/nvim/fnl/dots/plugins/glance.fnl deleted file mode 100644 index 6ea840a..0000000 --- a/nvim/.config/nvim/fnl/dots/plugins/glance.fnl +++ /dev/null @@ -1,8 +0,0 @@ -(import-macros m :macros) -(m.al a aniseed.core) -(m.al glance glance) -(m.al utils dots.utils) - -[(utils.plugin - :dnlhc/glance.nvim - {:lazy true :config #(glance.setup)})] diff --git a/nvim/.config/nvim/fnl/dots/plugins/gruvbox8.fnl b/nvim/.config/nvim/fnl/dots/plugins/gruvbox8.fnl index 0c86fb8..39f61b1 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/gruvbox8.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/gruvbox8.fnl @@ -1,6 +1,6 @@ -(import-macros {: al} :macros) -(al utils dots.utils) -(al colors dots.colors) +(local {: autoload} (require :nfnl.module)) +(local utils (autoload :dots.utils)) +(local colors (autoload :dots.colors)) (fn setup [] diff --git a/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl b/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl index b8aa6a3..34bdf77 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl @@ -18,15 +18,6 @@ (fn on_attach [client bufnr] - ;(pkg lsp_signature.nvim [lsp_signature (require "lsp_signature")] - ;(lsp_signature.on_attach {:bind true - ;:hint_scheme "String" - ;:hint_prefix "ƒ " - ;:handler_opts {:border "single"} - ;:use_lspsaga false - ;:decorator ["`" "`"]})) - - ;(req dots.utils.highlight :LspDiagnosticsUnderlineError {:gui "underline"}) (if client.server_capabilities.documentHighlight (do (utils.highlight "LspReferenceRead" {:gui "underline"}) diff --git a/nvim/.config/nvim/fnl/dots/plugins/ltex-ls.fnl b/nvim/.config/nvim/fnl/dots/plugins/ltex-ls.fnl index c526fd0..b0579dc 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/ltex-ls.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/ltex-ls.fnl @@ -1,11 +1,8 @@ -(import-macros m :macros) -(m.al a aniseed.core) -(m.al str aniseed.string) -(m.al lsp lspconfig) -(m.al configs lspconfig/configs) -(m.al lsputil lspconfig/util) -(m.al utils dots.utils) -(m.al cmp_nvim_lsp cmp_nvim_lsp) +(local {: autoload} (require :nfnl.module)) +(local lsp (autoload :lspconfig)) +(local configs (autoload :lspconfig/configs)) +(local lsputil (autoload :lspconfig/util)) +(local utils (require :dots.utils)) (fn cmds [xs] diff --git a/nvim/.config/nvim/fnl/dots/plugins/neogit.fnl b/nvim/.config/nvim/fnl/dots/plugins/neogit.fnl deleted file mode 100644 index 5dd72af..0000000 --- a/nvim/.config/nvim/fnl/dots/plugins/neogit.fnl +++ /dev/null @@ -1,9 +0,0 @@ -(import-macros m :macros) -(m.al neogit neogit) -(m.al utils dots.utils) - -[(utils.plugin :TimUntersberger/neogit - {:config #(neogit.setup {:integrations {:diffview true}}) - :cmd ["Neogit"]})] - - diff --git a/nvim/.config/nvim/fnl/dots/plugins/noice.fnl b/nvim/.config/nvim/fnl/dots/plugins/noice.fnl index 6032b81..c2ac614 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/noice.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/noice.fnl @@ -1,43 +1,35 @@ -(import-macros m :macros) -(m.al utils dots.utils) +(local utils (require :dots.utils)) +[(utils.plugin + :folke/noice.nvim + {:dependencies [:MunifTanjim/nui.nvim] + :opts {:presets {:inc_rename true + :long_message_to_split true + :bottom_search true} + ;:command_palette true} + :lsp {:override {:vim.lsp.util.convert_input_to_markdown_lines true + :vim.lsp.util.stylize_markdown true + :cmp.entry.get_documentation true}} + :views {:cmdline_popup {:border {:style "none" :padding [1 1]} + :position {:row 5 :col "50%"} + :size {:width 60 :height "auto"}} + :popupmenu {:relative "editor" + :border {:style "none" :padding [1 1]} + :position {:row 8 :col "50%"} + :size {:width 60 :height 10}} + :mini {:max_height 5}} + :cmdline {:view "cmdline" ; change to cmdline_popup + :format {:cmdline {:icon ":"} + :lua false + :help false}} + :messages {:view "mini" + :view_error "cmdline_output" + :view_warn "mini" + :view_search "virtualtext"} + :markdown {:hover {"|(%S-)|" vim.cmd.help}} + :routes [{:view "notify" :filter {:event "msg_showmode"}} + {:view "mini" + :filter {:error true :max_height 5}} + {:view "cmdline_output" + :filter {:error true :min_height 6}}]}})] -(fn setup [] - (m.al a nfnl.core) - (m.al lazy lazy) - (m.al noice noice) - (m.al colors dots.colors) - (noice.setup - {:presets {:inc_rename true - :long_message_to_split true - :bottom_search true} - ;:command_palette true} - :lsp {:override {:vim.lsp.util.convert_input_to_markdown_lines true - :vim.lsp.util.stylize_markdown true - :cmp.entry.get_documentation true}} - :views {:cmdline_popup {:border {:style "none" :padding [1 1]} - :position {:row 5 :col "50%"} - :size {:width 60 :height "auto"}} - :popupmenu {:relative "editor" - :border {:style "none" :padding [1 1]} - :position {:row 8 :col "50%"} - :size {:width 60 :height 10}} - :mini {:max_height 5}} - :cmdline {:view "cmdline" ; change to cmdline_popup - :format {:cmdline {:icon ":"} - :lua false - :help false}} - :messages {:view "mini" - :view_error "cmdline_output" - :view_warn "mini" - :view_search "virtualtext"} - :markdown {:hover {"|(%S-)|" vim.cmd.help}} - :routes [{:view "notify" :filter {:event "msg_showmode"}} - {:view "mini" - :filter {:error true :max_height 5}} - {:view "cmdline_output" - :filter {:error true :min_height 6}}]})) - -;[(utils.plugin :folke/noice.nvim -; {:config setup -; :dependencies [:MunifTanjim/nui.nvim]}}]})) [] diff --git a/nvim/.config/nvim/fnl/dots/plugins/nvim-colorizer.fnl b/nvim/.config/nvim/fnl/dots/plugins/nvim-colorizer.fnl index d13c918..1c7a881 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/nvim-colorizer.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/nvim-colorizer.fnl @@ -1,7 +1,6 @@ -(import-macros m :macros) -(m.al colorizer colorizer) -(m.al utils dots.utils) - +(local {: autoload} (require :nfnl.module)) +(local colorizer (autoload :colorizer)) +(local utils (autoload :dots.utils)) (fn setup [] ; this really shouldn't be necessary,.. but it is diff --git a/nvim/.config/nvim/fnl/dots/plugins/persistence.fnl b/nvim/.config/nvim/fnl/dots/plugins/persistence.fnl deleted file mode 100644 index 944fb9c..0000000 --- a/nvim/.config/nvim/fnl/dots/plugins/persistence.fnl +++ /dev/null @@ -1,11 +0,0 @@ -(import-macros m :macros) -(m.al persistence persistence) -(m.al utils dots.utils) - - -(fn setup [] - (persistence.setup - {:dir (vim.fn.expand (.. (vim.fn.stdpath "cache") "/sessions/"))})) - -[(utils.plugin :folke/persistence.nvim - {:config setup})] diff --git a/nvim/.config/nvim/fnl/dots/plugins/plugins.fnl b/nvim/.config/nvim/fnl/dots/plugins/plugins.fnl index bf47113..b7bceab 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/plugins.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/plugins.fnl @@ -1,6 +1,4 @@ -(import-macros {: al} :macros) -(al a nfnl.core) -(al lazy lazy) +;(local {: autolod} (require :nfnl.module)) (macro setup [name opts] @@ -22,20 +20,19 @@ (plugin :psliwka/vim-smoothie) (plugin :nathanaelkane/vim-indent-guides {:cmd ["IndentGuidesToggle"]}) - (plugin :luukvbaal/stabilize.nvim - {:config #(setup :stabilize)}) - - (plugin :stevearc/dressing.nvim - {:config #(setup :dressing)}) - - (plugin :tweekmonster/startuptime.vim - {:cmd ["StartupTime"]}) - (plugin :moll/vim-bbye - {:lazy true :cmd [:Bdelete :Bwipeout]}) + (plugin :luukvbaal/stabilize.nvim {:config true}) + (plugin :stevearc/dressing.nvim {:config true}) + (plugin :tweekmonster/startuptime.vim {:cmd ["StartupTime"]}) + (plugin :moll/vim-bbye {:lazy true :cmd [:Bdelete :Bwipeout]}) (plugin :petertriho/nvim-scrollbar {:event "VeryLazy" :lazy true - :config #(setup :scrollbar)}) + :config true}) + (plugin :TimUntersberger/neogit + {:opts {:integrations {:diffview true}} + :cmd ["Neogit"]}) + (plugin :folke/persistence.nvim + {:opts {:dir (vim.fn.expand (.. (vim.fn.stdpath "cache") "/sessions/"))}}) (plugin "https://git.sr.ht/~whynothugo/lsp_lines.nvim" {:config #(do (setup :lsp_lines) @@ -59,13 +56,13 @@ (plugin :phaazon/hop.nvim {:lazy true :event "VeryLazy" - :config #(setup "hop" {:keys "jfkdls;amvieurow"})}) + :opts {:keys "jfkdls;amvieurow"}}) ; >>> ; debugger <<< (plugin :rcarriga/nvim-dap-ui {:lazy true - :config #(setup :dapui) + :config true :dependencies [:mfussenegger/nvim-dap]}) (plugin :mfussenegger/nvim-dap {:lazy true}) @@ -87,7 +84,7 @@ :dependencies [:nvim-lua/plenary.nvim :nvim-telescope/telescope.nvim :kyazdani42/nvim-web-devicons] - :config #(setup :octo)}) + :config true}) (plugin :ruanyl/vim-gh-line) (plugin :rhysd/conflict-marker.vim) @@ -101,9 +98,11 @@ (plugin :weilbith/nvim-code-action-menu {:cmd "CodeActionMenu" :config #(set vim.g.code_action_menu_show_details false)}) + (plugin :dnlhc/glance.nvim + {:lazy true :config true}) (plugin :smjonas/inc-rename.nvim - {:config #(setup :inc_rename {:input_buffer_type "dressing"})}) + {:opts {:input_buffer_type "dressing"}}) ; >>> ; cmp <<< @@ -146,10 +145,22 @@ {:ft ["rust"] :dependencies ["mattn/webapi-vim"] :config #(do (set vim.g.rustfmt_fail_silently 1))}) + + (plugin :Saecki/crates.nvim + {:dependencies ["nvim-lua/plenary.nvim"] + :dir "/Users/leon/tmp/crates.nvim" + :event ["BufRead Cargo.toml"] + :lazy true + :opts {:disable_invalid_feature_diagnostic true + :enable_update_available_warning false}}) - (plugin :simrat39/rust-tools.nvim + ; temporarily using this fork that merges a few fixes, until simrat is back + (plugin :MunifTanjim/rust-tools.nvim {:ft ["rust" "toml"] :dependencies ["nvim-lua/popup.nvim" "nvim-lua/plenary.nvim"]}) + ;(plugin :simrat39/rust-tools.nvim + ;{:ft ["rust" "toml"] + ;:dependencies ["nvim-lua/popup.nvim" "nvim-lua/plenary.nvim"]}) (plugin :qnighy/lalrpop.vim {}) diff --git a/nvim/.config/nvim/fnl/dots/plugins/sneak.fnl b/nvim/.config/nvim/fnl/dots/plugins/sneak.fnl deleted file mode 100644 index 52813ff..0000000 --- a/nvim/.config/nvim/fnl/dots/plugins/sneak.fnl +++ /dev/null @@ -1,9 +0,0 @@ -(import-macros m :macros) -(m.al utils dots.utils) - - -(set vim.g.sneak#label 1) -(utils.keymap [:n :o] : "Sneak_s" {:noremap false}) -(utils.keymap [:n :o] : "Sneak_S" {:noremap false}) - -[] diff --git a/nvim/.config/nvim/fnl/dots/plugins/telescope.fnl b/nvim/.config/nvim/fnl/dots/plugins/telescope.fnl index 893155c..c4e4399 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/telescope.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/telescope.fnl @@ -1,8 +1,7 @@ -(import-macros {: al} :macros) -(al utils dots.utils) -(al telescope telescope) -(al actions telescope.actions) -(al colors dots.colors) +(local {: autoload} (require :nfnl.module)) +(local utils (autoload :dots.utils)) +(local telescope (autoload :telescope)) +(local actions (autoload :telescope.actions)) (fn setup [] (telescope.setup @@ -11,7 +10,6 @@ :extensions {:ui-select [((. (require "telescope.themes") :get_dropdown))]}}) (telescope.load_extension "dap") - ;(telescope.load_extension "ui-select") (utils.keymap :n : ":Telescope find_files")) diff --git a/nvim/.config/nvim/fnl/dots/plugins/todo-comments.fnl b/nvim/.config/nvim/fnl/dots/plugins/todo-comments.fnl index 387f9d6..18a16c3 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/todo-comments.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/todo-comments.fnl @@ -1,20 +1,12 @@ -(import-macros m :macros) -(m.al a nfnl.core) -(m.al utils dots.utils) -(m.al todo-comments todo-comments) - - -(fn setup [] - (todo-comments.setup - {:keywords {:TODO {:icon " "} - :WARN {:icon " " :alt [:WARNING :XXX :!!!]} - :NOTE {:icon " " :alt [:INFO]} - :FIX {:icon " " :alt [:FIXME :BUG :FIXIT :ISSUE :PHIX]} - :PERF {:icon " " :alt [:OPTIM :PERFORMANCE :OPTIMIZE]} - :HACK {:icon " "}}})) +(local utils (require :dots.utils)) [(utils.plugin :folke/todo-comments.nvim {:lazy true :event "VeryLazy" - :config setup})] + :opts {:keywords {:TODO {:icon " "} + :WARN {:icon " " :alt [:WARNING :XXX :!!!]} + :NOTE {:icon " " :alt [:INFO]} + :FIX {:icon " " :alt [:FIXME :BUG :FIXIT :ISSUE :PHIX]} + :PERF {:icon " " :alt [:OPTIM :PERFORMANCE :OPTIMIZE]} + :HACK {:icon " "}}}})] diff --git a/nvim/.config/nvim/fnl/dots/plugins/treesitter.fnl b/nvim/.config/nvim/fnl/dots/plugins/treesitter.fnl index 2f01be0..85d6c46 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/treesitter.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/treesitter.fnl @@ -1,6 +1,4 @@ -(import-macros m :macros) -(m.al utils dots.utils) -(m.al a nfnl.core) +(local utils (require :dots.utils)) (fn setup [] diff --git a/nvim/.config/nvim/fnl/dots/plugins/trouble.fnl b/nvim/.config/nvim/fnl/dots/plugins/trouble.fnl index be1cc90..1f7feba 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/trouble.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/trouble.fnl @@ -6,16 +6,21 @@ (fn setup [] (trouble.setup {:icons false - :auto_preview true + ; disabled due to https://github.com/folke/trouble.nvim/issues/125 + :auto_preview false :auto_close true :auto_open false :auto_jump ["lsp_definitions" "lsp_workspace_diagnostics" "lsp_type_definitions"] :indent_lines false + :multiline false :action_keys - {:jump "o" - :jump_close "" - :close "" + {:jump "" + :jump_close "o" + :close ["" "q"] :cancel "q" + :preview "p" + :toggle_preview "P" + :toggle_mode "m" :hover ["a" "K"]}}) (utils.highlight "TroubleFoldIcon" {:bg "NONE" :fg colors.bright_orange}) diff --git a/nvim/.config/nvim/fnl/dots/plugins/vimtex.fnl b/nvim/.config/nvim/fnl/dots/plugins/vimtex.fnl index ab83456..d46910c 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/vimtex.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/vimtex.fnl @@ -1,5 +1,4 @@ -(import-macros m :macros) -(m.al utils dots.utils) +(local utils (require :dots.utils)) (fn setup [] (set vim.g.vimtex_view_method "general") diff --git a/nvim/.config/nvim/fnl/dots/smart-compe-conjure.fnl b/nvim/.config/nvim/fnl/dots/smart-compe-conjure.fnl deleted file mode 100644 index f41e6c7..0000000 --- a/nvim/.config/nvim/fnl/dots/smart-compe-conjure.fnl +++ /dev/null @@ -1,58 +0,0 @@ -(al utils dots.utils) -(al a aniseed.core) -(al str aniseed.string) -(al view aniseed.view) -(al popup popup) -(al compe compe) - -(defn setup [] - (def fuck (require "compe_conjure")) - - - (def my_source {}) - (set my_source.new - (fn [] - (setmetatable {} {:__index my_source}))) - - (set my_source.determine fuck.determine) - (set my_source.get_metadata fuck.get_metadata) - (set my_source.complete fuck.complete) - (set my_source.abort fuck.abort) - (set my_source.documentation - (fn [self args] - (a.println (view.serialise args)) - (args.callback - (let [help-tag (help.find-help-tag-for args.completed_item.word)] - (when help-tag - (var lines ["```help"]) - (each [_ line (ipairs (help.help-for-tag help-tag))] - (table.insert lines line)) - (table.insert lines "```") - lines))))) - - (compe.register_source :epic (my_source.new)) - - - (compe.setup - {:enabled true - :autocomplete false - :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 - :nvim_lsp true - :nvim_lua true - :vsnip false - :epic true}})) - - -[] diff --git a/nvim/.config/nvim/fnl/dots/utils.fnl b/nvim/.config/nvim/fnl/dots/utils.fnl index 853dc79..db88d83 100644 --- a/nvim/.config/nvim/fnl/dots/utils.fnl +++ b/nvim/.config/nvim/fnl/dots/utils.fnl @@ -1,6 +1,6 @@ -(import-macros {: al} :macros) -(al a nfnl.core) -(al str nfnl.string) +(local {: autoload} (require :nfnl.module)) +(local a (autoload :nfnl.core)) +(local str (autoload :nfnl.string)) (fn plugin [name ?opts] (if (= nil ?opts) @@ -9,7 +9,7 @@ (tset ?opts 1 name) ?opts))) -(fn all [f xs] +(fn all [f] (not (a.some #(not (f $1))))) (fn single-to-list [x] @@ -56,7 +56,6 @@ tbl)) - (fn without-keys [keys t] (filter-table #(not (contains? keys $1)) t)) @@ -75,16 +74,6 @@ (vim.keymap.del mode from (if ?buf-local {:buffer 0} {}))) -(fn safe-require [name] - (xpcall - #( - ;do - ;(print name) - ;(time - (require name)) - #(let [fennel (require :aniseed.fennel)] - (a.println (.. "Error sourcing " name ":\n" (fennel.traceback $1)))))) - (fn buffer-content [bufnr] "Returns a table of lines in the given buffer" @@ -131,27 +120,6 @@ (f (g ...)))) -; These are a workaround around broken load order -; mostly used for themeing stuff -; given that the colorscheme may override highlight stuff set before it loaded, this can _ensure_ -; that code is ran at the very end of the config - -(var deferred-funs []) -(var did-exec-deferred false) -(fn clear-deferred [] (set deferred-funs [])) - -; defer a function. If deferred funcs have already been ran, -; assume we're reloading config because the user is configuring, and just execute immediately -(fn defer-to-end [f] - (if did-exec-deferred - (f) - (table.insert deferred-funs f))) - -(fn run-deferred [] - (set did-exec-deferred true) - (each [_ f (ipairs deferred-funs)] - (f))) - (fn get-selection [] (let [[_ s-start-line s-start-col] (vim.fn.getpos "'<") [_ s-end-line s-end-col] (vim.fn.getpos "'>") @@ -167,7 +135,6 @@ (values s-start-line s-end-line lines))))) {: plugin - : plugin-installed? : all : single-to-list : contains? @@ -180,14 +147,10 @@ : without-keys : keymap : del-keymap - : safe-require : buffer-content : surround-if-present : highlight : highlight-add : shorten-path : comp - : clear-deferred - : defer-to-end - : run-deferred : get-selection} diff --git a/nvim/.config/nvim/fnl/macros.fnl b/nvim/.config/nvim/fnl/macros.fnl index 8d9f504..08dd857 100644 --- a/nvim/.config/nvim/fnl/macros.fnl +++ b/nvim/.config/nvim/fnl/macros.fnl @@ -12,21 +12,6 @@ (fn [name thing] `(local ,name ((. (require :nfnl.module) :autoload) ,(tostring thing)))) - - :defer - (fn [...] - `(let [utils# (require :dots.utils)] - (utils#.defer-to-end (fn [] ,...)))) - - - :req - (fn [name ...] - (let [str (require :nfnl.string) - a (require :nfnl.core) - segs (str.split (tostring name) "%.") - mod (str.join "." (a.butlast segs)) - func (a.last segs)] - `((. (require (tostring ,mod)) (tostring ,func)) ,...))) :autocmd (fn [...] @@ -40,16 +25,6 @@ (fn [name] `(.. "lua require('" *module-name* "')['" ,(tostring name) "']()")) - :pkg - (fn [name mappings ...] - `(if (~= nil (. packer_plugins `,(tostring name))) - (let ,mappings ,...) - (print (.. "plugin disabled " `,(tostring name))))) - - :vim-let - (fn [field value] - (let [text (.. "let " `,(tostring field) "=\"" value "\"")] - `(vim.cmd ,text))) :each-pair (fn [args ...] @@ -59,35 +34,8 @@ (for [i# 1 (a#.count data#) 2] (let [,l# (. data# i#) ,r# (. data# (+ i# 1))] - ,...))))) - - :packer-use - (fn [...] - (let [a (require "nfnl.core") - args [...] - use-statements []] - (for [i 1 (a.count args) 2] - (let [name (. args i) - block (. args (+ i 1))] - (a.assoc block 1 name) - (when (. block :mod) - ;(a.assoc block :config `#((. (require "utils") :safe-require) ,(. block :mod))) - (a.assoc block :config `#( - ;do - ;(print ,(. block :mod)) - ;(time - ;( - require ,(. block :mod)))) - (a.assoc block :mod) - (table.insert use-statements block))) - - (let [use-sym (gensym)] - `(let [packer# (require "packer")] - (packer#.startup - (fn [,use-sym] - ,(unpack - (icollect [_# v# (ipairs use-statements)] - `(,use-sym ,v#)))))))))} + ,...)))))} + diff --git a/nvim/.config/nvim/fnl/main.fnl b/nvim/.config/nvim/fnl/main.fnl index e34245b..4f39ff1 100644 --- a/nvim/.config/nvim/fnl/main.fnl +++ b/nvim/.config/nvim/fnl/main.fnl @@ -1,33 +1,22 @@ -(import-macros {: vim-let} :macros) - (local {: autoload} (require :nfnl.module)) -(local a (autoload :aniseed.core)) -(local str (autoload :aniseed.string)) +(local a (autoload :nfnl.core)) +(local str (autoload :nfnl.string)) (local utils (autoload :dots.utils)) (local lazy (require :lazy)) -(utils.clear-deferred) -;(macro make-errors-epic [f] -; `(xpcall #,f #(let [fennel# (require :aniseed.fennel)] -; (a.println (fennel#.traceback $1))))) -(macro make-errors-epic [f] - f) (when (vim.fn.has "termguicolors") (set vim.opt.termguicolors true)) -;(make-errors-epic (require "dots.plugins")) - -(vim-let mapleader "\\") -(vim-let maplocalleader ",") +(vim.cmd "let mapleader=\"\\\"") +(vim.cmd "let maplocalleader=\",\"") (lazy.setup {:import "dots.plugins" :install {:colorscheme "gruvbox8"}}) ; (require "impatient") -(make-errors-epic (require "dots.plugins.lsp")) -(make-errors-epic (require "dots.keybinds")) +(require "dots.keybinds") ; add to runtimepath (let [added-paths []] @@ -75,7 +64,7 @@ (set vim.g.AutoPairsMultilineClose 0) -(vim-let &t_ut "") +(vim.cmd "let &t_ut=\"\"") (vim.api.nvim_create_autocmd "BufWritePost" {:pattern "*.hs" :callback #(set vim.opt.shiftwidth 2)}) (vim.api.nvim_create_autocmd "FileType" {:pattern "vim" :callback #(set vim.opt_local.foldmethod "marker")}) @@ -148,6 +137,5 @@ ; (vim.cmd "Copilot enable") -(utils.run-deferred) ; vim:foldmarker=foldstart,foldend diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 4f8989f..47201c2 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -1,6 +1,5 @@ { "agda-vim": { "branch": "master", "commit": "4a0f475aaef756702222bdd5b01e25f814f5691f" }, - "aniseed": { "branch": "master", "commit": "7bc09736f3651c10d29b82d1a465b7f540614be1" }, "antifennel-nvim": { "branch": "master", "commit": "79261d02213a5093135e5d02431682f04459f0f7" }, "any-jump.vim": { "branch": "master", "commit": "770ef708ae3f13322430fcc663d7dfb864756b9b" }, "ats-vim": { "branch": "master", "commit": "8e3e722b6d09ed81313573b4e7b108b265628ff1" }, @@ -16,6 +15,7 @@ "cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" }, "conflict-marker.vim": { "branch": "master", "commit": "11a4d42244755505b66b15cd4496a150432eb5e3" }, "conjure": { "branch": "master", "commit": "58c46d1f4999679659a5918284b574c266a7ac83" }, + "copilot.lua": { "branch": "master", "commit": "1a8032ae496916ccc7a7a52ee79194fbef29f462" }, "diffview.nvim": { "branch": "main", "commit": "0437ef8bfdd67156d87140d692840a3c2824fa20" }, "dressing.nvim": { "branch": "master", "commit": "8f4d62b7817455896a3c73cab642002072c114bc" }, "editorconfig-vim": { "branch": "master", "commit": "0d54ea863089fb13be423b4aed6cca35f3a5d778" }, @@ -32,7 +32,7 @@ "inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" }, "kmonad-vim": { "branch": "master", "commit": "37978445197ab00edeb5b731e9ca90c2b141723f" }, "lalrpop.vim": { "branch": "master", "commit": "7073eec8efdeff37cacd4bca378c28dad02c3c14" }, - "lazy.nvim": { "branch": "main", "commit": "6b6f0a451200bb6abde85978c577c73ea1577758" }, + "lazy.nvim": { "branch": "main", "commit": "25f6009087cc2bb85aedf4425c23f35c03e60b02" }, "litee.nvim": { "branch": "main", "commit": "bf366a1414fd0f9401631ac8884f2f9fa4bf18d2" }, "lsp_lines.nvim": { "branch": "main", "commit": "9e3f99fbbd28aaec80dc0158c43be8cca8dd5017" }, "lsp_signature.nvim": { "branch": "master", "commit": "bdf3dc7bb03edd25c2173e0e31c2fb122052ed23" }, @@ -63,19 +63,17 @@ "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "purescript-vim": { "branch": "main", "commit": "82348352e6568fcc0385bd7c99a8ead3a479feea" }, - "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, + "rust-tools.nvim": { "branch": "patched", "commit": "4338a9b08faa8da8b5aad095a035ceff31301e3f" }, "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, "sad.vim": { "branch": "master", "commit": "2f5b33b239a566ffedaa81cee3051bb613482d1e" }, "stabilize.nvim": { "branch": "master", "commit": "eeb1873daffaba67246188a5668b366e45ed1de1" }, "startuptime.vim": { "branch": "master", "commit": "dfa57f522d6f61793fe5fea65bca7484751b8ca2" }, - "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "targets.vim": { "branch": "master", "commit": "642d3a4ce306264b05ea3219920b13ea80931767" }, "telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" }, "telescope.nvim": { "branch": "master", "commit": "205f469244916716c49cc2b9026566749425c5ba" }, "todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" }, "trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" }, - "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" }, "typescript-vim": { "branch": "master", "commit": "31ede5ad905ce4159a5e285073a391daa3bf83fa" }, "vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" }, "vim-exchange": { "branch": "master", "commit": "784d63083ad7d613aa96f00021cd0dfb126a781a" }, @@ -102,6 +100,5 @@ "webapi-vim": { "branch": "master", "commit": "70c49ada7827d3545a65cbdab04c5c89a3a8464e" }, "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }, "yats.vim": { "branch": "master", "commit": "2b6950c7143790e6930b8cf32d60c6858a50d47c" }, - "yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" }, - "zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" } + "yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" } } \ No newline at end of file