(local opts {:noremap true :silent true}) (macro nmap [map action] `(vim.keymap.set :n ,map ,action opts)) (macro cmd [c] (.. : c :)) ;; Getting stuck in ~~vim~~ terminal (vim.keymap.set :t : "" opts) ;; Quick cursor movement (nmap : :5j) (nmap : :5k) ;; Quick system register access (each [_ p (ipairs ["+" "*"])] (each [_ r (ipairs [:y :p :d])] (nmap (.. p r) (.. "\"" p r)))) ;; Vimgrep (nmap : (cmd :cnext)) (nmap : (cmd :cprevious)) ;; LSP (nmap :-a #(vim.lsp.buf.code_action)) (nmap :-d #(vim.diagnostic.goto_next)) (nmap :-n #(vim.lsp.buf.rename)) (nmap :-r #(vim.lsp.buf.format {:async true})) (nmap : #(vim.lsp.buf.signature_help)) (nmap :e #(vim.diagnostic.open_float)) (nmap :K (fn [] (if ((. (require :conjure.client) :get)) ((. (require :conjure.eval) :doc-word)) (vim.lsp.buf.hover)))) ;; command to stop LSPs (vim.api.nvim_create_user_command :StopLsps #(vim.lsp.stop_client (vim.lsp.get_active_clients)) {:nargs 0})