From 2803dcf4d56af0e09b1216ded5f7d76cfebee25e Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Mon, 3 Jan 2022 11:42:25 -0600 Subject: [PATCH] Better ansible support, dap --- lua/lsp.lua | 17 +++++++++++------ lua/maps.lua | 2 ++ lua/plugins.lua | 24 ++++++++++++++++++++++-- lua/plugins/dap.lua | 14 -------------- lua/plugins/treesitter.lua | 7 ++++--- 5 files changed, 39 insertions(+), 25 deletions(-) diff --git a/lua/lsp.lua b/lua/lsp.lua index 44d2d31..0093f10 100755 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -16,16 +16,21 @@ lsp_installer.on_server_ready(function(server) -- https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb -- -- locate it with `find ~/ -name ` - -- local extension_path = os.getenv("HOME") .. ".vscode/extensions/vadimcn.vscode-lldb-1.6.10/" + -- local extension_path = "/Users/pricehiller/.vscode/extensions/vadimcn.vscode-lldb-1.6.10/" -- local codelldb_path = extension_path .. 'adapter/codelldb' -- local liblldb_path = extension_path .. 'lldb/lib/' - -- opts.dap = { - -- adapter = require('rust-tools.dap').get_codelldb_adapter(codelldb_path, liblldb_path) - -- } - require("rust-tools").setup{ + local rustopts = { + server = vim.tbl_deep_extend("force", server:get_default_options(), opts, {}), + -- dap = { + -- adapter = require('rust-tools.dap').get_codelldb_adapter( + -- codelldb_path, liblldb_path) + -- }, + tools = { - server = vim.tbl_deep_extend("force", server:get_default_options(), opts), + hover_actions = { auto_focus = true } + } } + require("rust-tools").setup(rustopts) server:attach_buffers() else -- I use ansible a lot, define exceptions for servers that can use diff --git a/lua/maps.lua b/lua/maps.lua index 03a6469..c4537d8 100755 --- a/lua/maps.lua +++ b/lua/maps.lua @@ -57,6 +57,7 @@ map("n", "th", ":Telescope help_tags") map("n", "to", ":Telescope oldfiles") map("n", "tt", ":Telescope treesitter") map("n", "tc", ":Telescope neoclip default") +map("n", "tr", ":Telescope registers") -- Lsp @@ -73,6 +74,7 @@ map("n", "lT", ":lua vim.lsp.buf.type_definition()", lsp_opts) map("n", "ln", ":lua vim.lsp.buf.rename()", lsp_opts) map("n", "lc", ":lua vim.lsp.buf.code_action()", lsp_opts) map("n", "lr", ":lua vim.lsp.buf.references()", lsp_opts) +map("n", "lf", ":lua vim.lsp.buf.formatting()", lsp_opts) map("n", "[", ":lua vim.lsp.diagnostic.goto_prev()", lsp_opts) map("n", "]", ":lua vim.lsp.diagnostic.goto_next()", lsp_opts) map("n", "lq", ":Telescope diagnostics bufnr=0", lsp_opts) diff --git a/lua/plugins.lua b/lua/plugins.lua index 4c163d3..459e5b2 100755 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -174,6 +174,8 @@ return require("packer").startup({function() require("plugins/lspconfig") end } + + use { "williamboman/nvim-lsp-installer", after = "nvim-lspconfig", @@ -184,8 +186,12 @@ return require("packer").startup({function() use { "simrat39/rust-tools.nvim", - after = "nvim-lspconfig" + after = "nvim-lspconfig", + config = function() + require("rust-tools").setup({}) + end } + use { "rafamadriz/friendly-snippets", event = "InsertEnter" @@ -195,7 +201,7 @@ return require("packer").startup({function() use { "ray-x/lsp_signature.nvim", after = "friendly-snippets", - config = function () + config = function() require("lsp_signature").setup() end } @@ -410,6 +416,20 @@ return require("packer").startup({function() "tpope/vim-surround" } + use { + "pearofducks/ansible-vim", + config = function() + -- vim.g.ansible_unindent_after_newline = 1 + vim.g.ansible_attribute_highlight = "ob" + -- vim.g.ansible_template_syntaxes = { "*.rb.j2": "ruby" + -- "*.bash.j2": "bash", + -- "*.sh.j2": "sh", + -- "*.py.j2": "python3" + -- } + end + + } + -- Bootstrap packer if not installed, sync packages if packer_bootstrap then diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 646198f..57dedea 100755 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,22 +1,8 @@ - local present, dap = pcall(require, "dap") if not present then return end --- dap-install configurations -local dap_install = require("dap-install") -dap_install.setup { - installation_path = vim.fn.stdpath("data") .. "/dapinstall/", -} -local dap_install = require("dap-install") -local dbg_list = require("dap-install.api.debuggers").get_installed_debuggers() - -for _, debugger in ipairs(dbg_list) do - dap_install.config(debugger) -end - - -- dap-ui configurations require("dapui").setup({}) diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index da10f2e..3ca665f 100755 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -7,13 +7,14 @@ nvim_treesitter.setup { highlight = { enable = true, additional_vim_regex_highlighting = true, + disable = { "yaml" }, }, matchup = { enable = true, }, - indent = { - disable = { 'yaml' } - }, + -- indent = { + -- disable = { 'yaml' } + -- }, autotag = { enable = true }