Fix null-ls keybinds

This commit is contained in:
Alexander Rosenberg 2023-05-14 18:30:12 -07:00
parent 9e00218179
commit 3a87627581
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -29,6 +29,9 @@
(= client.name :rust_analyzer))) (= client.name :rust_analyzer)))
:async true }) buf) :async true }) buf)
;; Use builtin formatexpr
(vim.api.nvim_buf_set_option buf :formatexpr "")
;; Some telescope commands ;; Some telescope commands
(bind! :n :<leader>s "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf) (bind! :n :<leader>s "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf)
(bind! :n :<leader>fs "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf) (bind! :n :<leader>fs "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf)
@ -111,6 +114,15 @@
(fn setup-null-ls [] (fn setup-null-ls []
(let [builtins (. (require :null-ls) :builtins)] (let [builtins (. (require :null-ls) :builtins)]
(setup! :null-ls (setup! :null-ls
:on_attach (fn [client buf]
(bind! [ :n :v ] :<leader>o
#(vim.lsp.buf.format { :filter
;; use null-ls for formatting
(fn [client] (or
(= client.name :null-ls)
(= client.name :rust_analyzer)))
:async true }) buf)
(vim.api.nvim_buf_set_option buf :formatexpr ""))
:sources [ :sources [
builtins.formatting.astyle builtins.formatting.astyle
builtins.formatting.prettier builtins.formatting.prettier