diff --git a/README.md b/README.md index 8ace8b9b..41139505 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ If you are experiencing issues, please make sure you have the latest versions. External Requirements: - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) +- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), + [fd-find](https://github.com/sharkdp/fd#installation) - Clipboard tool (xclip/xsel/win32yank or other depending on the platform) - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua index 968096de..961bb7d6 100644 --- a/lua/plugins/bufferline.lua +++ b/lua/plugins/bufferline.lua @@ -9,26 +9,31 @@ return { require('bufferline').setup { options = { - mode = 'buffers', -- set to "tabs" to only show tabpages instead - themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default - numbers = 'none', -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, - close_command = 'Bdelete! %d', -- can be a string | function, see "Mouse actions" + mode = 'buffers', -- 'buffers', -- set to "tabs" to only show tabpages instead + + themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default + numbers = 'none', -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, + close_command = 'Bdelete! %d', -- can be a string | function, see "Mouse actions" right_mouse_command = 'Bdelete! %d', -- can be a string | function, see "Mouse actions" - left_mouse_command = 'buffer %d', -- can be a string | function, see "Mouse actions" - middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + left_mouse_command = 'buffer %d', -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" -- buffer_close_icon = '󰅖', buffer_close_icon = '✗', -- buffer_close_icon = '✕', - close_icon = '', + close_icon = '', path_components = 1, -- Show only the file name without the directory modified_icon = '●', - left_trunc_marker = '', - right_trunc_marker = '', + left_trunc_marker = '', + right_trunc_marker = '', max_name_length = 30, max_prefix_length = 30, -- prefix used when a buffer is de-duplicated tab_size = 21, - diagnostics = false, + diagnostics = "nvim_lsp", diagnostics_update_in_insert = false, + diagnostics_indicator = function(count, level, diagnostics_dict, context) + local icon = level:match("error") and "󰅚 " or "󰀪 " + return " " .. icon .. count + end, color_icons = true, show_buffer_icons = true, show_buffer_close_icons = true, @@ -61,6 +66,51 @@ return { -- background = {}, -- indicator_selected = {}, -- fill = {}, + -- + + -- Error highlighting (pink theme) + error = { + fg = '#ff69b4', -- Hot pink + bg = '#2d2d2d', + }, + error_selected = { + fg = '#ff1493', -- Deep pink for active tab + bg = '#3d3d3d', + bold = true, + }, + error_visible = { + fg = '#ff69b4', + bg = '#2d2d2d', + }, + + -- Warning highlighting (optional) + warning = { + fg = '#ffb86c', + bg = '#2d2d2d', + }, + warning_selected = { + fg = '#ff8c00', + bg = '#3d3d3d', + bold = true, + }, + + -- Normal tab highlighting + tab = { + fg = '#6272a4', + bg = '#282a36', + }, + tab_selected = { + fg = '#f8f8f2', + bg = '#44475a', + bold = true, + }, + + -- Background + fill = { + bg = '#282a36', + }, + + }, } diff --git a/lua/plugins/lsp-keymaps.lua b/lua/plugins/lsp-keymaps.lua index f58321fa..bb2213a3 100644 --- a/lua/plugins/lsp-keymaps.lua +++ b/lua/plugins/lsp-keymaps.lua @@ -16,7 +16,6 @@ function M.get() { 'gI', vim.lsp.buf.implementation, desc = 'Go to Implementation' }, { 'gy', vim.lsp.buf.type_definition, desc = 'Go to Type Definition' }, { 'gD', vim.lsp.buf.declaration, desc = 'Go to Declaration' }, - { 'K', vim.lsp.buf.hover, desc = 'Hover' }, { 'gK', vim.lsp.buf.signature_help, desc = 'Signature Help' }, { '', vim.lsp.buf.signature_help, mode = 'i', desc = 'Signature Help' }, { 'ca', vim.lsp.buf.code_action, desc = 'Code Action', mode = { 'n', 'v' } }, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index faae141e..2a1b4f05 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -28,7 +28,6 @@ return { end, }, }, - config = function() vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), @@ -36,10 +35,8 @@ return { local map = function(keys, func, desc) vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end - local telescope_ok, telescope = pcall(require, 'telescope.builtin') if not telescope_ok then return end - map('gd', telescope.lsp_definitions, 'Go to Definition') map('gr', telescope.lsp_references, 'Go to References') map('gI', telescope.lsp_implementations, 'Go to Implementation') @@ -49,16 +46,12 @@ return { map('rn', vim.lsp.buf.rename, 'Rename') map('ca', vim.lsp.buf.code_action, 'Code Action') map('gD', vim.lsp.buf.declaration, 'Go to Declaration') - - map('', function() + map('K', function() local lspsaga_hover_ok, lspsaga_hover = pcall(require, 'lspsaga.hover') if lspsaga_hover_ok then lspsaga_hover:render_hover_doc() - else - vim.lsp.buf.hover() end end, 'Show Hover') - local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client.server_capabilities.documentHighlightProvider then vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { @@ -91,9 +84,16 @@ return { }, filetypes = { 'go', 'templ' }, }, - -- tsserver = { settings = { completions = { completeFunctionCalls = true }, }, filetypes = { 'typescript', 'typescriptreact', 'typescript.tsx', 'javascript' }, root_dir = require('lspconfig.util').root_pattern('package.json', 'tsconfig.json', '.git'), }, + astro = { + filetypes = { "astro" }, + init_options = { + typescript = { + tsdk = vim.fn.stdpath("data") .. "/mason/packages/typescript-language-server/node_modules/typescript/lib", + }, + }, + }, eslint = {}, - html = { filetypes = { 'html', 'twig', 'hbs' } }, -- Removed 'templ' from here + html = { filetypes = { 'html', 'twig', 'hbs' } }, templ = { cmd = { vim.fn.stdpath("data") .. "/mason/bin/templ", "lsp" }, filetypes = { "templ" }, @@ -133,37 +133,41 @@ return { cssls = {}, } - -- Enable LSP Features require('mason').setup() - local ensure_installed = vim.tbl_keys(servers) - vim.list_extend(ensure_installed, { 'templ', 'typescript-language-server' }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + local capabilities = vim.tbl_deep_extend( + 'force', + {}, + vim.lsp.protocol.make_client_capabilities(), + require('cmp_nvim_lsp').default_capabilities() + ) require('mason-lspconfig').setup { - handlers = { - function(server_name) - local server = servers[server_name] or {} - server.capabilities = vim.tbl_deep_extend( - 'force', - {}, - vim.lsp.protocol.make_client_capabilities(), - require('cmp_nvim_lsp').default_capabilities(), - server.capabilities or {} - ) - require('lspconfig')[server_name].setup(server) - end, - }, + ensure_installed = vim.tbl_keys(servers), } + -- Setup servers manually + for name, config in pairs(servers) do + config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {}) + require('lspconfig')[name].setup(config) + end + + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.astro", + callback = function() + vim.lsp.buf.format({ async = false }) + end, + }) + -- Auto-format and organize imports on save for Go vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*.go", callback = function() - vim.lsp.buf.format({ async = false }) -- Format + vim.lsp.buf.format({ async = false }) vim.lsp.buf.code_action({ context = { only = { "source.organizeImports" } }, apply = true, - }) -- Organize imports + }) end, }) end, diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 4d1f4e8d..1fa7970c 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -26,11 +26,14 @@ return { require('telescope').setup { defaults = { + winblend = 0, mappings = { i = { [''] = actions.move_selection_previous, -- move to prev result [''] = actions.move_selection_next, -- move to next result [''] = actions.select_default, -- open file + -- Enable paste from system clipboard + [''] = actions.paste_register, }, n = { ['q'] = actions.close,