From 8309138032f1bcd6eeb9586994994696f4786204 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 2 Jan 2022 15:13:39 -0500 Subject: [PATCH] updates for video --- lua/user/keymaps.lua | 1 + lua/user/lsp/handlers.lua | 8 +------- lua/user/lsp/null-ls.lua | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 638cab5..6140fbd 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -69,3 +69,4 @@ keymap("t", "", "l", term_opts) -- Nvimtree keymap("n", "e", ":NvimTreeToggle", opts) +keymap("n", "f", ":Format", opts) diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index 5dfde9b..4868b79 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -72,13 +72,7 @@ local function lsp_keymaps(bufnr) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "f", "lua vim.diagnostic.open_float()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) - vim.api.nvim_buf_set_keymap( - bufnr, - "n", - "gl", - 'lua vim.diagnostic.open_float()', - opts - ) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "q", "lua vim.diagnostic.setloclist()", opts) vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index c7d40fd..ec79994 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -1,6 +1,6 @@ local null_ls_status_ok, null_ls = pcall(require, "null-ls") if not null_ls_status_ok then - return + return end -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting @@ -8,12 +8,13 @@ local formatting = null_ls.builtins.formatting -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics local diagnostics = null_ls.builtins.diagnostics -null_ls.setup({ - debug = false, - sources = { - formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), - formatting.black.with({ extra_args = { "--fast" } }), - formatting.stylua, - diagnostics.flake8 - }, -}) +null_ls.setup { + debug = false, + sources = { + formatting.prettier.with { extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }, + formatting.black.with { extra_args = { "--fast" } }, + -- formatting.yapf, + formatting.stylua, + diagnostics.flake8, + }, +}