From ec235190e8f3240b78f943f6fbb10408783949d0 Mon Sep 17 00:00:00 2001 From: talha Date: Fri, 10 Jan 2025 14:54:54 +0500 Subject: initializing new branch --- after/plugin/lsp.lua | 32 +++++++++++++++++++++++++------- after/plugin/telescope.lua | 9 ++++----- 2 files changed, 29 insertions(+), 12 deletions(-) (limited to 'after') 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", "vca", function() vim.lsp.buf.code_action() end, opts) vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("n", "vlf", function() + vim.keymap.set("n", "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", "", 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'}, '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', 'pf', builtin.find_files, {}) -vim.keymap.set('n', '', builtin.git_files, {}) -vim.keymap.set('n', 'ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }); -end) +vim.keymap.set('n', 'pf', builtin.find_files) +vim.keymap.set('n', '', builtin.git_files) +vim.keymap.set('n', 'ps', builtin.live_grep) +vim.keymap.set('n', 'gw', builtin.grep_string) -- cgit v1.2.3