Update some keybindings

This commit is contained in:
Janis Hutz 2025-02-06 17:20:12 +01:00
parent c82a1316d0
commit f7b6edd6f7
3 changed files with 59 additions and 5 deletions

View File

@ -135,11 +135,17 @@ return {
on_attach = on_attach,
})
lspconfig.volar.setup({
capabilities = capabilities,
on_attach = on_attach,
cmd = { "vue-language-server", "--stdio" }
})
-- lspconfig.volar.setup({
-- capabilities = capabilities,
-- on_attach = on_attach,
-- cmd = { "vue-language-server", "--stdio" },
-- filetypes = { "vue" },
-- settings = {
-- typescript = {
-- tsdk = '/usr/lib/node_modules/typescript/lib'
-- }
-- }
-- })
-- done in ftplugin
lspconfig.jdtls.setup({

View File

@ -32,6 +32,7 @@ return {
-- "lua_ls",
-- "pyright",
-- "tsserver",
"volar"
},
-- auto-install configured servers (with lspconfig)
automatic_installation = true,

View File

@ -1,3 +1,50 @@
local actions = require('telescope.actions')
local action_state = require('telescope.actions.state')
-- Custom function for search and replace using Telescope
-- test
function _G.search_and_replace()
local current_file = vim.fn.expand('%:p')
local query = vim.fn.input('Enter search pattern: ')
-- Create the Telescope prompt with custom mappings
require('telescope.builtin').find_files({
prompt_title = 'Search and Replace',
cwd = vim.loop.cwd(),
hidden = true,
attach_mappings = function(prompt_bufnr, map)
actions.select_default:replace(function()
local selection = action_state.get_selected_entry()
-- Get the replace pattern from user
local replace_query = vim.fn.input('Replace with: ', '')
if not replace_query == '' then
local args = { query, replace_query }
-- Open a terminal buffer to run the search and replace command
require('telescope.builtin').terminal_job({
cmd = {
'sh', '-c',
string.format(
"grep -rl '%s' . | xargs sed -i 's/%s/%s/g'",
table.concat(args, "'"),
query,
replace_query
)
},
cwd = vim.fn.expand('%:p:h'),
})
end
return true
end)
return true
end
})
end
return {
-- fuzzy finder
"nvim-telescope/telescope.nvim",