nvim-telescope: add mappings for opening lsp stuff separately

This commit is contained in:
LordMZTE 2024-01-23 21:00:24 +01:00
parent bfe11b70bf
commit d0c33ded0a
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -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)