From e4da06e19c072322573c916fa6bdda8827a59e6c Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sun, 8 Jan 2023 20:05:49 +0100 Subject: Refactor with opts --- fnl/config/better-escape.fnl | 2 +- fnl/config/cmd.fnl | 93 -------------------------------------------- fnl/config/comment.fnl | 2 +- fnl/config/flit.fnl | 2 +- fnl/config/gitsigns.fnl | 2 +- fnl/config/lualine.fnl | 2 +- fnl/config/minibar.fnl | 2 +- fnl/config/persistence.fnl | 2 +- fnl/config/spectre.fnl | 2 +- fnl/config/toggleterm.fnl | 2 +- fnl/config/trim.fnl | 2 +- fnl/config/trouble.fnl | 2 +- fnl/config/user-cmd.fnl | 93 ++++++++++++++++++++++++++++++++++++++++++++ fnl/config/zen.fnl | 2 +- fnl/init.fnl | 2 +- lazy-lock.json | 8 ++-- 16 files changed, 110 insertions(+), 110 deletions(-) delete mode 100644 fnl/config/cmd.fnl create mode 100644 fnl/config/user-cmd.fnl diff --git a/fnl/config/better-escape.fnl b/fnl/config/better-escape.fnl index f262784..d4379a0 100644 --- a/fnl/config/better-escape.fnl +++ b/fnl/config/better-escape.fnl @@ -5,4 +5,4 @@ :clear_empty_lines false :keys :}) -{1 :max397574/better-escape.nvim :event :BufReadPost :config opts} +{1 :max397574/better-escape.nvim :event :BufReadPost :opts opts} diff --git a/fnl/config/cmd.fnl b/fnl/config/cmd.fnl deleted file mode 100644 index 1ae9b58..0000000 --- a/fnl/config/cmd.fnl +++ /dev/null @@ -1,93 +0,0 @@ -;; Commands for plugins. -(module config.cmd {autoload {nvim aniseed.nvim util config.util}}) - -(nvim.create_user_command :OrgAgendaPrompt - (lambda [] - (let [orgmode (require :orgmode)] - (orgmode.action :agenda.prompt))) - {:nargs 0}) - -(nvim.create_user_command :OrgCapturePrompt - (lambda [] - (let [orgmode (require :orgmode)] - (orgmode.action :capture.prompt))) - {:nargs 0}) - -(nvim.create_user_command :CommentNormal - (lambda [] - (let [comment-api (require :Comment.api)] - (comment-api.toggle.linewise.current))) - {:nargs 0}) - -(nvim.create_user_command :CommentVisual - (lambda [] - (let [comment-api (require :Comment.api)] - (comment-api.toggle.linewise (vim.fn.visualmode)))) - {:nargs 0}) - -(nvim.create_user_command :HarpoonAdd - (lambda [] - (let [harpoon (require :harpoon.mark)] - (harpoon.add_file))) - {:nargs 0}) - -(nvim.create_user_command :HarpoonNext - (lambda [] - (let [harpoon (require :harpoon.ui)] - (harpoon.nav_next))) - {:nargs 0}) - -(nvim.create_user_command :HarpoonPrev - (lambda [] - (let [harpoon (require :harpoon.ui)] - (harpoon.nav_prev))) - {:nargs 0}) - -(nvim.create_user_command :HarpoonUI - (lambda [] - (let [harpoon (require :harpoon.ui)] - (harpoon.toggle_quick_menu))) - {:nargs 0}) - -(nvim.create_user_command :Replace - (lambda [] - (let [spectre (require :spectre)] - (spectre.open))) - {:nargs 0}) - -(nvim.create_user_command :ReplaceWord - (lambda [] - (let [spectre (require :spectre)] - (spectre.open_visual {:select_word true}))) - {:nargs 0}) - -(nvim.create_user_command :ReplaceInBuf - (lambda [] - (let [spectre (require :spectre)] - (spectre.open_file_search))) - {:nargs 0}) - -(nvim.create_user_command :RestoreSession - (lambda [] - (let [persistence (require :persistence)] - (persistence.load))) - {:nargs 0}) - -(nvim.create_user_command :RestoreLastSession - (lambda [] - (let [persistence (require :persistence)] - (persistence.load {:last true}))) - {:nargs 0}) - -(nvim.create_user_command :IgnoreSession - (lambda [] - (let [persistence (require :persistence)] - (persistence.stop))) - {:nargs 0}) - -(nvim.create_user_command :FindFiles - (lambda [] - (util.telescope-builtin :find_files - {:theme :get_dropdown - :previewer false})) - {:nargs 0}) diff --git a/fnl/config/comment.fnl b/fnl/config/comment.fnl index 29b7871..07bfc6d 100644 --- a/fnl/config/comment.fnl +++ b/fnl/config/comment.fnl @@ -17,4 +17,4 @@ ;; Add comment at the end of line :eol :mcA}}) -{1 :numToStr/Comment.nvim :event :BufReadPost :config opts} +{1 :numToStr/Comment.nvim :event :BufReadPost :opts opts} diff --git a/fnl/config/flit.fnl b/fnl/config/flit.fnl index 536c505..8c408aa 100644 --- a/fnl/config/flit.fnl +++ b/fnl/config/flit.fnl @@ -5,4 +5,4 @@ :multiline true :opts {}}) -{1 :ggandor/flit.nvim :event :BufReadPost :config opts} +{1 :ggandor/flit.nvim :event :BufReadPost :opts opts} diff --git a/fnl/config/gitsigns.fnl b/fnl/config/gitsigns.fnl index 7b7ed95..d4bd72b 100644 --- a/fnl/config/gitsigns.fnl +++ b/fnl/config/gitsigns.fnl @@ -45,4 +45,4 @@ :col 1} :yadm {:enable false}}) -{1 :lewis6991/gitsigns.nvim :event :BufReadPost :config opts} +{1 :lewis6991/gitsigns.nvim :event :BufReadPost :opts opts} diff --git a/fnl/config/lualine.fnl b/fnl/config/lualine.fnl index 34f735c..be326f5 100644 --- a/fnl/config/lualine.fnl +++ b/fnl/config/lualine.fnl @@ -83,5 +83,5 @@ {1 :nvim-lualine/lualine.nvim :event :VeryLazy - :config opts + :opts opts :dependencies [:kyazdani42/nvim-web-devicons :arkav/lualine-lsp-progress]} diff --git a/fnl/config/minibar.fnl b/fnl/config/minibar.fnl index 9e49c7f..03882cb 100644 --- a/fnl/config/minibar.fnl +++ b/fnl/config/minibar.fnl @@ -29,4 +29,4 @@ {1 :aktersnurra/minibar.nvim :event :BufReadPre - :config opts} + :opts opts} diff --git a/fnl/config/persistence.fnl b/fnl/config/persistence.fnl index e1368f1..0238897 100644 --- a/fnl/config/persistence.fnl +++ b/fnl/config/persistence.fnl @@ -2,4 +2,4 @@ (local opts {:options [:buffers :curdir :tabpages :winsize :help]}) -{1 :folke/persistence.nvim :event :VeryLazy :config opts} +{1 :folke/persistence.nvim :event :VeryLazy :opts opts} diff --git a/fnl/config/spectre.fnl b/fnl/config/spectre.fnl index c662935..067a817 100644 --- a/fnl/config/spectre.fnl +++ b/fnl/config/spectre.fnl @@ -59,4 +59,4 @@ :is_open_target_win true :is_insert_mode false}) -{1 :windwp/nvim-spectre :event :BufReadPost :config opts} +{1 :windwp/nvim-spectre :event :BufReadPost :opts opts} diff --git a/fnl/config/toggleterm.fnl b/fnl/config/toggleterm.fnl index 3c8aa39..ed7dd5c 100644 --- a/fnl/config/toggleterm.fnl +++ b/fnl/config/toggleterm.fnl @@ -2,4 +2,4 @@ (local opts {:size 16 :shade_terminals false}) -{1 :akinsho/toggleterm.nvim :cmd :ToggleTerm :config opts} +{1 :akinsho/toggleterm.nvim :cmd :ToggleTerm :opts opts} diff --git a/fnl/config/trim.fnl b/fnl/config/trim.fnl index e21b715..af8b5ab 100644 --- a/fnl/config/trim.fnl +++ b/fnl/config/trim.fnl @@ -2,4 +2,4 @@ (local opts {:disable [:python]}) -{1 :cappyzawa/trim.nvim :event :BufFilePre :config opts} +{1 :cappyzawa/trim.nvim :event :BufFilePre :opts opts} diff --git a/fnl/config/trouble.fnl b/fnl/config/trouble.fnl index 988f2ed..a38ed86 100644 --- a/fnl/config/trouble.fnl +++ b/fnl/config/trouble.fnl @@ -78,4 +78,4 @@ ;; enabling this will use the signs defined in your lsp client }) -{1 :folke/trouble.nvim :cmd :TroubleToggle :config opts} +{1 :folke/trouble.nvim :cmd :TroubleToggle :opts opts} diff --git a/fnl/config/user-cmd.fnl b/fnl/config/user-cmd.fnl new file mode 100644 index 0000000..f72d95a --- /dev/null +++ b/fnl/config/user-cmd.fnl @@ -0,0 +1,93 @@ +;; Commands for plugins. +(module config.user-cmd {autoload {nvim aniseed.nvim util config.util}}) + +(nvim.create_user_command :OrgAgendaPrompt + (lambda [] + (let [orgmode (require :orgmode)] + (orgmode.action :agenda.prompt))) + {:nargs 0}) + +(nvim.create_user_command :OrgCapturePrompt + (lambda [] + (let [orgmode (require :orgmode)] + (orgmode.action :capture.prompt))) + {:nargs 0}) + +(nvim.create_user_command :CommentNormal + (lambda [] + (let [comment-api (require :Comment.api)] + (comment-api.toggle.linewise.current))) + {:nargs 0}) + +(nvim.create_user_command :CommentVisual + (lambda [] + (let [comment-api (require :Comment.api)] + (comment-api.toggle.linewise (vim.fn.visualmode)))) + {:nargs 0}) + +(nvim.create_user_command :HarpoonAdd + (lambda [] + (let [harpoon (require :harpoon.mark)] + (harpoon.add_file))) + {:nargs 0}) + +(nvim.create_user_command :HarpoonNext + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.nav_next))) + {:nargs 0}) + +(nvim.create_user_command :HarpoonPrev + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.nav_prev))) + {:nargs 0}) + +(nvim.create_user_command :HarpoonUI + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.toggle_quick_menu))) + {:nargs 0}) + +(nvim.create_user_command :Replace + (lambda [] + (let [spectre (require :spectre)] + (spectre.open))) + {:nargs 0}) + +(nvim.create_user_command :ReplaceWord + (lambda [] + (let [spectre (require :spectre)] + (spectre.open_visual {:select_word true}))) + {:nargs 0}) + +(nvim.create_user_command :ReplaceInBuf + (lambda [] + (let [spectre (require :spectre)] + (spectre.open_file_search))) + {:nargs 0}) + +(nvim.create_user_command :RestoreSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.load))) + {:nargs 0}) + +(nvim.create_user_command :RestoreLastSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.load {:last true}))) + {:nargs 0}) + +(nvim.create_user_command :IgnoreSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.stop))) + {:nargs 0}) + +(nvim.create_user_command :FindFiles + (lambda [] + (util.telescope-builtin :find_files + {:theme :get_dropdown + :previewer false})) + {:nargs 0}) diff --git a/fnl/config/zen.fnl b/fnl/config/zen.fnl index 1a0c94e..1f53708 100644 --- a/fnl/config/zen.fnl +++ b/fnl/config/zen.fnl @@ -10,4 +10,4 @@ :tmux {:enabled true} :twilight {:enabled true}}}) -{1 :folke/zen-mode.nvim :cmd :ZenMode :config opts} +{1 :folke/zen-mode.nvim :cmd :ZenMode :opts opts} diff --git a/fnl/init.fnl b/fnl/init.fnl index 743dc17..f38a4fa 100644 --- a/fnl/init.fnl +++ b/fnl/init.fnl @@ -1,5 +1,5 @@ ;; Load plugins with lazy. -(module init {require [settings config.autocmd config.cmd]}) +(module init {require [settings config.autocmd config.user-cmd]}) (let [lazy (require :lazy) opts (require :config.lazy) diff --git a/lazy-lock.json b/lazy-lock.json index 31e82a0..2329885 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -11,12 +11,12 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "diffview.nvim": { "branch": "main", "commit": "e3e15d8f1d727056185fc1696be1554837dec897" }, + "diffview.nvim": { "branch": "main", "commit": "e45aaf82e123218da419751d2d6aed2a064ca054" }, "flit.nvim": { "branch": "main", "commit": "be110f9814a45788d10537fd59b3c76d956bb7ad" }, "friendly-snippets": { "branch": "main", "commit": "484fb38b8f493ceeebf4e6fc499ebe41e10aae25" }, "gitsigns.nvim": { "branch": "main", "commit": "d4f8c01280413919349f5df7daccd0c172143d7c" }, "harpoon": { "branch": "master", "commit": "21d0d1bfa3000e4384740bfaefa0ebc51c773786" }, - "lazy.nvim": { "branch": "main", "commit": "b178daf9dc95b9171ead57a89ea81239cadda2ec" }, + "lazy.nvim": { "branch": "main", "commit": "e77be3cf3b01402b86464e1734fb5ead448ce12e" }, "leap.nvim": { "branch": "main", "commit": "a968ab4250840dc879e805f918b4f3b892310a12" }, "lir.nvim": { "branch": "master", "commit": "84af01547e51e15fc97e878330414385eeb825e8" }, "lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, @@ -24,7 +24,7 @@ "lualine.nvim": { "branch": "master", "commit": "d8c392dd75778d6258da4e7c55522e94ac389732" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "33a198bc5ee0215ae8ab3f61781b29103cf4ca5a" }, "mason-null-ls.nvim": { "branch": "main", "commit": "c4b4a6fe3cb8d8590b831c22b3475166dc9a894e" }, - "mason.nvim": { "branch": "main", "commit": "153fce2d2c4a78b394e50804941e5138dfd16a29" }, + "mason.nvim": { "branch": "main", "commit": "0975eeac8d6e1e87270cc42285e673a4ee36bc5e" }, "minibar.nvim": { "branch": "master", "commit": "353ca4efaf7fff1566bb02e0d7cb51133c41f660" }, "neogit": { "branch": "master", "commit": "84cf7efba6e4daed11a1185ea09fa553a3ca3d4f" }, "no-clown-fiesta.nvim": { "branch": "master", "commit": "8d4f03c8211a7b5528cd9fa8212d8f1e7baea485" }, @@ -34,7 +34,7 @@ "nvim-bufdel": { "branch": "main", "commit": "a60b3531e5bd56f8602acb4ba7f5b2eeb782d54b" }, "nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-lspconfig": { "branch": "master", "commit": "41dc4e017395d73af0333705447e858b7db1f75e" }, + "nvim-lspconfig": { "branch": "master", "commit": "2df0fbdadd947cd2995566a0117b8802a9ba74f4" }, "nvim-spectre": { "branch": "master", "commit": "68ea562b485b6593e325e7916c3bd6e833d433e7" }, "nvim-surround": { "branch": "main", "commit": "ad56e6234bf42fb7f7e4dccc7752e25abd5ec80e" }, "nvim-treesitter": { "branch": "master", "commit": "3e316204f8ec8450bbaace69d0bf8fe332633fec" }, -- cgit v1.2.3-70-g09d2