summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fnl/plugins/grug-far.fnl46
-rw-r--r--fnl/plugins/spectre.fnl86
-rw-r--r--lazy-lock.json28
3 files changed, 60 insertions, 100 deletions
diff --git a/fnl/plugins/grug-far.fnl b/fnl/plugins/grug-far.fnl
new file mode 100644
index 0000000..ed6eae1
--- /dev/null
+++ b/fnl/plugins/grug-far.fnl
@@ -0,0 +1,46 @@
+;; Find and replace plugin.
+(local auto-cmds
+ [[:FileType
+ {:pattern [:grug-far]
+ :command "nnoremap <silent> <buffer> q :close<CR>"}]
+ [:FileType {:pattern [:grug-far] :command "setlocal spell!"}]])
+
+(fn replace [?cword ?file]
+ (let [grug (require :grug-far)]
+ (var opts {:prefills {}})
+ (when ?cword
+ (set opts.prefills.search ?cword))
+ (when ?file
+ (set opts.prefills.flags ?file))
+ (grug.grug_far opts)))
+
+(fn visual-replace []
+ (let [grug (require :grug-far)]
+ (grug.with_visual_selection {:prefills {:flags (vim.fn.expand "%")}})))
+
+(fn config []
+ (let [cmds (require :util.cmds)
+ grug (require :grug-far)]
+ (cmds.create-auto-cmds auto-cmds)
+ (grug.setup)))
+
+(local keys [{1 :<m-r> 2 :<cmd>GrugFar<cr> :desc "Find and Replace"}
+ {1 :<m-w>
+ 2 (fn []
+ (replace (vim.fn.expand :<cword>)))
+ :desc "Find and replace word under cursor"}
+ {1 :<m-x>
+ 2 (fn []
+ (replace nil (vim.fn.expand "%")))
+ :desc "Find and replace in file"}
+ {1 :<m-a>
+ 2 (fn []
+ (replace (vim.fn.expand :<cword>) (vim.fn.expand "%")))
+ :desc "Find and replace cword in file"}
+ {1 :<m-r>
+ 2 (fn []
+ (visual-replace))
+ :desc "Find and Replace"
+ :mode [:v]}])
+
+{1 :MagicDuck/grug-far.nvim : keys : config}
diff --git a/fnl/plugins/spectre.fnl b/fnl/plugins/spectre.fnl
deleted file mode 100644
index 8c86a6d..0000000
--- a/fnl/plugins/spectre.fnl
+++ /dev/null
@@ -1,86 +0,0 @@
-;; Find and replace.
-
-(local user-cmds [[:Replace
- (lambda []
- (let [spectre (require :spectre)]
- (spectre.open)))
- {:nargs 0}]
- [:ReplaceWord
- (lambda []
- (let [spectre (require :spectre)]
- (spectre.open_visual {:select_word true})))
- {:nargs 0}]
- [:ReplaceInBuf
- (lambda []
- (let [spectre (require :spectre)]
- (spectre.open_file_search)))
- {:nargs 0}]])
-
-(local auto-cmds
- [[:FileType
- {:pattern [:spectre_panel]
- :command "nnoremap <silent> <buffer> q :close<CR>"}]
- [:FileType {:pattern [:spectre_panel] :command "setlocal spell!"}]])
-
-(fn init []
- (let [cmds (require :util.cmds)]
- (cmds.create-user-cmds user-cmds)
- (cmds.create-auto-cmds auto-cmds)))
-
-(local opts {:color_devicons true
- :highlight {:ui :String :search :DiffChange :replace :DiffDelete}
- :mapping {:toggle_line {:map :t
- :cmd "<cmd>lua require('spectre').toggle_line()<CR>"
- :desc "toggle current item"}
- :enter_file {:map :<cr>
- :cmd "<cmd>lua require('spectre.actions').select_entry()<CR>"
- :desc "goto current file"}
- :send_to_qf {:map :Q
- :cmd "<cmd>lua require('spectre.actions').send_to_qf()<CR>"
- :desc "send all item to quickfix"}
- :replace_cmd {:map :c
- :cmd "<cmd>lua require('spectre.actions').replace_cmd()<CR>"
- :desc "input replace vim command"}
- :show_option_menu {:map :o
- :cmd "<cmd>lua require('spectre').show_options()<CR>"
- :desc "show option"}
- :run_replace {:map :R
- :cmd "<cmd>lua require('spectre.actions').run_replace()<CR>"
- :desc "replace all"}
- :change_view_mode {:map :m
- :cmd "<cmd>lua require('spectre').change_view()<CR>"
- :desc "change result view mode"}
- :toggle_ignore_case {:map :I
- :cmd "<cmd>lua require('spectre').change_options('ignore-case')<CR>"
- :desc "toggle ignore case"}
- :toggle_ignore_hidden {:map :H
- :cmd "<cmd>lua require('spectre').change_options('hidden')<CR>"
- :desc "toggle search hidden"}}
- :find_engine {:rg {:cmd :rg
- :args [:--color=never
- :--no-heading
- :--with-filename
- :--line-number
- :--column]
- :options {:ignore-case {:value :--ignore-case
- :icon "[I]"
- :desc "ignore case"}
- :hidden {:value :--hidden
- :desc "hidden file"
- :icon "[H]"}}}}
- :replace_engine {:sed {:cmd :sed :args nil}
- :options {:ignore-case {:value :--ignore-case
- :icon "[I]"
- :desc "ignore case"}}}
- :default {:find {:cmd :rg :options [:ignore-case]}
- :replace {:cmd :sed}}
- :replace_vim_cmd :cdo
- :is_open_target_win true
- :is_insert_mode false})
-
-(local keys
- [{1 :<leader>rn 2 :<cmd>ReplaceInBuf<cr> :desc "Replace in Buffer"}
- {1 :<leader>re 2 :<cmd>Replace<cr> :desc :Replace}
- {1 :<leader>ri 2 :<cmd>ReplaceWord<cr> :desc "Replace Word"}])
-
-{1 :windwp/nvim-spectre :event [:BufReadPost :BufNewFile] : init : keys : opts}
diff --git a/lazy-lock.json b/lazy-lock.json
index f8fde57..9b2d9bf 100644
--- a/lazy-lock.json
+++ b/lazy-lock.json
@@ -7,7 +7,7 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
- "conform.nvim": { "branch": "master", "commit": "acc7d93f4a080fec587a99fcb36cffa29adc4bad" },
+ "conform.nvim": { "branch": "master", "commit": "797de8f79055334104cf77893cd93fe3fc2ac154" },
"dial.nvim": { "branch": "master", "commit": "ed4d6a5bbd5e479b4c4a3019d148561a2e6c1490" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" },
@@ -16,32 +16,32 @@
"git-conflict.nvim": { "branch": "main", "commit": "bfd9fe6fba9a161fc199771d85996236a0d0faad" },
"git-worktree.nvim": { "branch": "master", "commit": "666f84ba8dd9172f0a7b45c9f7c24bc5e55f6fc2" },
"gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" },
+ "grug-far.nvim": { "branch": "main", "commit": "8d322481ee2e8ebc192513bdd370615e8884e7b7" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"hotpot.nvim": { "branch": "master", "commit": "5462d3eb5c191ab380ca911e1e931836d27f6a79" },
"inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" },
- "lazy.nvim": { "branch": "main", "commit": "c92c6b5fd2b3a13c8999ab8379e43a79c9406e59" },
+ "lazy.nvim": { "branch": "main", "commit": "a09c876f6ef642c8feaea45932df73b058d9a083" },
"leap-spooky.nvim": { "branch": "main", "commit": "5f44a1f63dc1c4ce50244e92da5bc0d8d1f6eb47" },
"leap.nvim": { "branch": "main", "commit": "a9a9faee45066f2796c9a0e0ef52bf571d144492" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
"lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" },
"luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" },
- "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" },
+ "mason-lspconfig.nvim": { "branch": "main", "commit": "58bc9119ca273c0ce5a66fad1927ef0f617bd81b" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
- "neogit": { "branch": "master", "commit": "af1d8d88f426a4da63c913f3b81a37350dbe8d02" },
- "no-clown-fiesta.nvim": { "branch": "master", "commit": "b164c148d497b843ad7c5255fee58ea8b6c5dd41" },
+ "neogit": { "branch": "master", "commit": "0ecc2e1c96b202b89ab1d991d0cb17ac720caa69" },
+ "no-clown-fiesta.nvim": { "branch": "master", "commit": "a4df2d2b2741e746a5b2626c2f0a22d4ab3309ea" },
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
"nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" },
"nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" },
- "nvim-lspconfig": { "branch": "master", "commit": "df9c116cbcf0aa7e58f2b36b0296fa687e87f36f" },
- "nvim-spectre": { "branch": "master", "commit": "9a28f926d3371b7ef02243cbbb653a0478d06e31" },
+ "nvim-lspconfig": { "branch": "master", "commit": "1ea7c6126a1aa0121098e4f16c04d5dde1a4ba22" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
- "nvim-treesitter": { "branch": "master", "commit": "de8d91d0efb9016004f04279aae115edb4ef5bf2" },
+ "nvim-treesitter": { "branch": "master", "commit": "002537a3e364b6662c6b63e3f4b33b33e219cc6c" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
- "nvim-various-textobjs": { "branch": "main", "commit": "c2fd8bf4c86ec8d85bd0265074711027e640863a" },
- "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
+ "nvim-various-textobjs": { "branch": "main", "commit": "6cc4433fd35bc44ec7699cf8456d43161b0fd83b" },
+ "nvim-web-devicons": { "branch": "master", "commit": "e612de3d3a41a6b7be47f51e956dddabcbf419d9" },
"nvim-window-picker": { "branch": "main", "commit": "2c8200c5cbcdaac01dfe2c049997a1ca178506d8" },
"oil.nvim": { "branch": "master", "commit": "9e5eb2fcd1dfee2ff30c89273ffff179e42034b9" },
"org-bullets.nvim": { "branch": "main", "commit": "7e76e04827ac3fb13fc645a6309ac14203c4ca6a" },
@@ -52,14 +52,14 @@
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"rest.nvim": { "branch": "fix/getregtype", "commit": "7d6de91881a1b702fca2fe1e7f5ae88670a42b2a" },
- "schemastore.nvim": { "branch": "main", "commit": "58a965eedbfe7c358938b0e535ed2d98a4520987" },
+ "schemastore.nvim": { "branch": "main", "commit": "623df28bf9a2661d9d5a0f391bf30bdd8f8de62b" },
"sqlite.lua": { "branch": "master", "commit": "d0ffd703b56d090d213b497ed4eb840495f14a11" },
"stay-in-place.nvim": { "branch": "main", "commit": "0628b6db8970fc731abf9608d6f80659b58932c9" },
"telescope-frecency.nvim": { "branch": "master", "commit": "bb2c63ee5375ede81c1945b58638412af42b2d62" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
"telescope-orgmode.nvim": { "branch": "main", "commit": "a8478496911e378868f44bd9fd5fd5ce5eeec57b" },
- "telescope.nvim": { "branch": "master", "commit": "bfcc7d5c6f12209139f175e6123a7b7de6d9c18a" },
- "trouble.nvim": { "branch": "main", "commit": "bf99ea71a39e322336b7f8be965f86dbf5c65540" },
+ "telescope.nvim": { "branch": "master", "commit": "79552ef8488cb492e0f9d2bf3b4e808f57515e35" },
+ "trouble.nvim": { "branch": "main", "commit": "40c5317a6e90fe3393f07b0fee580d9e93a216b4" },
"ts-comments.nvim": { "branch": "main", "commit": "80eec3b9663ac3c4743b584f361099b061d0a9e5" },
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
"venn.nvim": { "branch": "main", "commit": "b09c2f36ddf70b498281845109bedcf08a7e0de0" },
@@ -67,6 +67,6 @@
"vim-dadbod-completion": { "branch": "master", "commit": "c3a56c652af9367c5a7b658ed7ed4dc494f430b0" },
"vim-dadbod-ui": { "branch": "master", "commit": "954877c3396ad4bf5624fcbe7b5673ac43cd0928" },
"vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" },
- "which-key.nvim": { "branch": "main", "commit": "8600b0029896ad2e36eb27a0808614ab8a0c057a" },
+ "which-key.nvim": { "branch": "main", "commit": "c74c245d9277ad6865b28ea7e37158b7f990b7fe" },
"zen-mode.nvim": { "branch": "main", "commit": "a31cf7113db34646ca320f8c2df22cf1fbfc6f2a" }
}