From 71dac4d82f2be3e0e358631dc7197abe77639d39 Mon Sep 17 00:00:00 2001 From: mace Date: Sat, 22 Nov 2025 11:59:03 +0100 Subject: [PATCH] cleanup autoformat, telescope --- init.lua | 32 +----------- lua/custom/lspconfig.lua | 1 - lua/custom/plugins/init.lua | 13 ----- lua/custom/telescope.lua | 20 ++++++++ lua/kickstart/plugins/autoformat.lua | 74 ---------------------------- 5 files changed, 22 insertions(+), 118 deletions(-) delete mode 100644 lua/kickstart/plugins/autoformat.lua diff --git a/init.lua b/init.lua index 4876e7f..4712103 100644 --- a/init.lua +++ b/init.lua @@ -90,7 +90,7 @@ require('lazy').setup({ { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! - 'folke/neodev.nvim', + -- 'folke/neodev.nvim', }, }, @@ -274,38 +274,10 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` -require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, - }, -} -- Enable telescope fzf native, if installed -pcall(require('telescope').load_extension, 'fzf') -- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) -vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) -end, { desc = '[/] Fuzzily search in current buffer' }) - -vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) - -- Diagnostic keymaps vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) @@ -359,7 +331,7 @@ local on_attach = function(_, bufnr) end -- Setup neovim lua configuration -require('neodev').setup() +-- require('neodev').setup() -- [[ Configure nvim-cmp ]] -- See `:help cmp` diff --git a/lua/custom/lspconfig.lua b/lua/custom/lspconfig.lua index 4097932..cc15dc1 100644 --- a/lua/custom/lspconfig.lua +++ b/lua/custom/lspconfig.lua @@ -140,7 +140,6 @@ setup_server("phpactor", { vim.lsp.config("lua_ls", { filetypes = { "lua" }, - root_dir = util.root_pattern(".git", ".lua_ls.json", "lua"), settings = { Lua = { diagnostics = { diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 58d9a47..dc565eb 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -63,19 +63,6 @@ return { }, "norcalli/nvim-colorizer.lua", - { - "neovim/nvim-lspconfig", - dependencies = { - { - "SmiteshP/nvim-navbuddy", - dependencies = { - "SmiteshP/nvim-navic", - "MunifTanjim/nui.nvim", - }, - opts = { lsp = { auto_attach = true } }, - }, - }, - }, "easymotion/vim-easymotion", -- Markdown diff --git a/lua/custom/telescope.lua b/lua/custom/telescope.lua index 2ea1a9e..220c2f4 100644 --- a/lua/custom/telescope.lua +++ b/lua/custom/telescope.lua @@ -19,6 +19,8 @@ telescope.setup({ [""] = actions.move_selection_previous, -- move to prev result [""] = actions.move_selection_next, -- move to next result [""] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist + [''] = false, + [''] = false, }, }, }, @@ -43,3 +45,21 @@ vim.api.nvim_set_keymap( ":lua require'telescope'.extensions.project.project{}", { noremap = true, silent = true } ) + +vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer' }) + +vim.keymap.set('n', 'gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) +vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) +vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) + diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua deleted file mode 100644 index bc56b15..0000000 --- a/lua/kickstart/plugins/autoformat.lua +++ /dev/null @@ -1,74 +0,0 @@ --- autoformat.lua --- --- Use your language server to automatically format your code on save. --- Adds additional commands as well to manage the behavior - -return { - 'neovim/nvim-lspconfig', - config = function() - -- Switch for controlling whether you want autoformatting. - -- Use :KickstartFormatToggle to toggle autoformatting on or off - local format_is_enabled = true - vim.api.nvim_create_user_command('KickstartFormatToggle', function() - format_is_enabled = not format_is_enabled - print('Setting autoformatting to: ' .. tostring(format_is_enabled)) - end, {}) - - -- Create an augroup that is used for managing our formatting autocmds. - -- We need one augroup per client to make sure that multiple clients - -- can attach to the same buffer without interfering with each other. - local _augroups = {} - local get_augroup = function(client) - if not _augroups[client.id] then - local group_name = 'kickstart-lsp-format-' .. client.name - local id = vim.api.nvim_create_augroup(group_name, { clear = true }) - _augroups[client.id] = id - end - - return _augroups[client.id] - end - - -- Whenever an LSP attaches to a buffer, we will run this function. - -- - -- See `:help LspAttach` for more information about this autocmd event. - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), - -- This is where we attach the autoformatting for reasonable clients - callback = function(args) - local client_id = args.data.client_id - local client = vim.lsp.get_client_by_id(client_id) - local bufnr = args.buf - - -- Only attach to clients that support document formatting - if not client.server_capabilities.documentFormattingProvider then - return - end - - -- Tsserver usually works poorly. Sorry you work with bad languages - -- You can remove this line if you know what you're doing :) - if client.name == 'tsserver' then - return - end - - -- Create an autocmd that will run *before* we save the buffer. - -- Run the formatting command for the LSP that has just attached. - vim.api.nvim_create_autocmd('BufWritePre', { - group = get_augroup(client), - buffer = bufnr, - callback = function() - if not format_is_enabled then - return - end - - vim.lsp.buf.format { - async = false, - filter = function(c) - return c.id == client.id - end, - } - end, - }) - end, - }) - end, -}