diff --git a/mzte-nv/conf/lua/pluginconf/p-telescope.fnl b/mzte-nv/conf/lua/pluginconf/p-telescope.fnl index fe6de19..54c27bc 100644 --- a/mzte-nv/conf/lua/pluginconf/p-telescope.fnl +++ b/mzte-nv/conf/lua/pluginconf/p-telescope.fnl @@ -24,21 +24,37 @@ (set utils.transform_path (mztenv.telescope.makePathTransformer utils.transform_path)) -(let [mopt mztenv.utils.map_opt - lsp-opts {:fname_width 80 :show_line false}] - (macro nmap [map action opt] - `(vim.keymap.set :n ,map #(,action (themes.get_ivy ,opt)) mopt)) - ;; resume search - (nmap :fr builtin.resume) - ;; file finding mappings - (nmap :ff builtin.find_files) - (nmap :fg builtin.live_grep) - ;; LSP mappings - (nmap :gd builtin.lsp_definitions lsp-opts) - (nmap :gi builtin.lsp_implementations lsp-opts) - (nmap :gr builtin.lsp_references lsp-opts) - (nmap :gs builtin.lsp_dynamic_workspace_symbols lsp-opts) - (nmap :gp builtin.diagnostics {:bufnr 0}) - (nmap :gP builtin.diagnostics) - ;; harpoon - (nmap :gm ext.harpoon.marks)) +(macro nmap [map action opt] + `(vim.keymap.set :n ,map #(,action (themes.get_ivy ,opt)) + mztenv.utils.map_opt)) + +(macro lsp-map [suffix action extra-opts] + (local opt {:fname_width 80 :show_line false}) + (each [k v (pairs (or extra-opts {}))] + (tset opt k v)) + `(do + (nmap ,(.. :g suffix) ,action ,opt) + (nmap ,(.. :gt suffix) ,action + ,(doto (collect [k v (pairs opt)] k v) + (tset :jump_type :tab))) + (nmap ,(.. :gs suffix) ,action + ,(doto (collect [k v (pairs opt)] k v) + (tset :jump_type :split))) + (nmap ,(.. :gv suffix) ,action + ,(doto (collect [k v (pairs opt)] k v) + (tset :jump_type :vsplit))))) + +;; resume search +(nmap :fr builtin.resume) +;; file finding mappings +(nmap :ff builtin.find_files) +(nmap :fg builtin.live_grep) +;; LSP mappings +(lsp-map :d builtin.lsp_definitions) +(lsp-map :i builtin.lsp_implementations) +(lsp-map :r builtin.lsp_references) +(lsp-map :s builtin.lsp_dynamic_workspace_symbols) +(lsp-map :p builtin.diagnostics {:bufnr 0}) +(lsp-map :P builtin.diagnostics) +;; harpoon +(nmap :gm ext.harpoon.marks)