summaryrefslogtreecommitdiff
path: root/after/plugin
diff options
context:
space:
mode:
authortalha <talha@talhaamir.xyz>2025-01-10 14:54:54 +0500
committertalha <talha@talhaamir.xyz>2025-01-10 15:01:25 +0500
commitec235190e8f3240b78f943f6fbb10408783949d0 (patch)
tree6b1a447a5c68584e54cc0c03235b77d37d61897d /after/plugin
parent440cc9de7021c7059523b6dafbf02f247291f160 (diff)
initializing new branch
Diffstat (limited to 'after/plugin')
-rw-r--r--after/plugin/lsp.lua32
-rw-r--r--after/plugin/telescope.lua9
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)