diff options
Diffstat (limited to 'after')
-rw-r--r-- | after/plugin/lsp.lua | 32 | ||||
-rw-r--r-- | after/plugin/telescope.lua | 9 |
2 files changed, 29 insertions, 12 deletions
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index b0977c1..41e7870 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -45,27 +45,38 @@ lsp.on_attach(function(client, bufnr) vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("n", "<leader>vlf", function() + vim.keymap.set("n", "<leader>vlf", function() vim.lsp.buf.format({ async = false, timeout_ms = 10000, - filter = allow_format({'rust_analyzer', 'tsserver'}), - }) + filter = allow_format({'rust_analyzer', 'tsserver', 'gopls', 'clangd', 'html-lsp'}), + }) end, opts) vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) end) + -- specific setup for python as it's lsp does not come with formatting require('lspconfig').pyright.setup({ single_file_support = false, - on_attach = function(client, bufnr) - local opts = {buffer = bfnr, remap = false} + on_attach = function(_, bufnr) + local opts = {buffer = bufnr, remap = false} vim.keymap.set({'n', 'x'}, '<leader>vcf', function() local filename = GetCurrFileName() vim.cmd(":silent !autopep8 -i " .. filename) vim.cmd(":silent !isort " .. filename) - end, opts) - end + end, opts) + end, +}) + +require('lspconfig').lua_ls.setup({ + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } }) lsp.setup() @@ -105,3 +116,10 @@ cmp.setup({ end, }, }) + +cmp.setup.filetype({ 'sql' }, { + sources = { + { name = 'vim-dadbod-completion' }, + { name = 'buffer'}, + }, +}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index 4806008..5c1ec30 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -1,6 +1,5 @@ local builtin = require('telescope.builtin') -vim.keymap.set('n', '<leader>pf', builtin.find_files, {}) -vim.keymap.set('n', '<C-p>', builtin.git_files, {}) -vim.keymap.set('n', '<leader>ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }); -end) +vim.keymap.set('n', '<leader>pf', builtin.find_files) +vim.keymap.set('n', '<C-p>', builtin.git_files) +vim.keymap.set('n', '<leader>ps', builtin.live_grep) +vim.keymap.set('n', '<leader>gw', builtin.grep_string) |