From f6692c95f3267ff98f8917adf163ba5fcc4e1c21 Mon Sep 17 00:00:00 2001 From: Guilherme Rugai Freire Date: Wed, 11 Feb 2026 01:06:19 -0300 Subject: [PATCH] upadte neovim config --- .config/nvim/after/plugin/colors.lua | 17 ++--- .config/nvim/after/plugin/lsp.lua | 96 ++++++++-------------------- .config/nvim/lua/grfreire/packer.lua | 94 +++++++++++++-------------- 3 files changed, 81 insertions(+), 126 deletions(-) diff --git a/.config/nvim/after/plugin/colors.lua b/.config/nvim/after/plugin/colors.lua index 426c777..997518a 100644 --- a/.config/nvim/after/plugin/colors.lua +++ b/.config/nvim/after/plugin/colors.lua @@ -1,10 +1,11 @@ -function SetColor(color) - color = color or "oxocarbon" - vim.cmd.colorscheme(color) - - -- Transparent background - -- vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) - -- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +function setTheme(theme) + if theme == 'bamboo' then + require('bamboo').setup({}); + require('bamboo').load(); + elseif theme == 'sonokai' then + vim.cmd 'colorscheme sonokai'; + vim.opt.termguicolors = false; + end end -SetColor() +setTheme('sonokai') diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index dbfbd66..a70545f 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -1,75 +1,35 @@ -local lsp = require("lsp-zero") - -lsp.preset("recommended") - -require("mason").setup({}) -require("mason-lspconfig").setup({ - ensure_installed = {'lua_ls', 'clangd', 'eslint', 'tsserver'}, - handlers = { lsp.default_setup } -}) - --- Fix Undefined global 'vim' -lsp.configure('lua_ls', { - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - } - } - } -}) - +require("mason").setup() +require("mason-lspconfig").setup({}) local cmp = require('cmp') -local cmp_select = {behavior = cmp.SelectBehavior.Select} -local cmp_mappings = lsp.defaults.cmp_mappings({ - [''] = cmp.mapping.select_prev_item(cmp_select), - [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), -}) - --- disable completion with tab --- this helps with copilot setup -cmp_mappings[''] = nil -cmp_mappings[''] = nil cmp.setup({ - mapping = cmp_mappings + sources = { + { name = 'nvim_lsp' }, + }, + snippet = { + expand = function(args) + -- You need Neovim v0.10 to use vim.snippet + vim.snippet.expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({}), }) -lsp.set_preferences({ - suggest_lsp_servers = false, - sign_icons = { - error = 'E', - warn = 'W', - hint = 'H', - info = 'I' - } -}) - -lsp.on_attach(function(client, bufnr) - local opts = {buffer = bufnr, remap = false} - - if client.name == "eslint" then - vim.cmd.LspStop('eslint') - return - end - - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "vws", vim.lsp.buf.workspace_symbol, opts) - vim.keymap.set("n", "vd", vim.diagnostic.open_float, opts) - vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts) - vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts) - vim.keymap.set("n", "vca", vim.lsp.buf.code_action, opts) - vim.keymap.set("n", "vrr", vim.lsp.buf.references, opts) - vim.keymap.set("n", "vrn", vim.lsp.buf.rename, opts) - vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts) -end) - -lsp.setup() - -vim.diagnostic.config({ - virtual_text = true, +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function(event) + local opts = { buffer = event.buf } + + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "vws", vim.lsp.buf.workspace_symbol, opts) + vim.keymap.set("n", "vd", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts) + vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts) + vim.keymap.set("n", "vca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "vrr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "vrn", vim.lsp.buf.rename, opts) + vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts) + end, }) diff --git a/.config/nvim/lua/grfreire/packer.lua b/.config/nvim/lua/grfreire/packer.lua index 0210296..c823010 100644 --- a/.config/nvim/lua/grfreire/packer.lua +++ b/.config/nvim/lua/grfreire/packer.lua @@ -6,64 +6,58 @@ vim.cmd [[packadd packer.nvim]] return require('packer').startup(function(use) - -- Packer package manager itself - use 'wbthomason/packer.nvim' + -- Packer package manager itself + use 'wbthomason/packer.nvim' - -- Telescope fuzzyfinder - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.5', - -- or , branch = '0.1.x', - requires = { { 'nvim-lua/plenary.nvim' } } - } + -- Telescope fuzzyfinder + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.5', + -- or , branch = '0.1.x', + requires = { { 'nvim-lua/plenary.nvim' } } + } - use({ - "nyoom-engineering/oxocarbon.nvim", - as = "oxocarbon", - config = function () - vim.opt.background = "dark" - vim.cmd('colorscheme oxocarbon') - end - }) + use { 'ribru17/bamboo.nvim' } + use { 'sainnhe/sonokai' } - -- Tree-sitter - AST capabilities for neovim - use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) - use('nvim-treesitter/playground') + -- Tree-sitter - AST capabilities for neovim + use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) + use('nvim-treesitter/playground') - -- Harpoon - easily go between files - use('theprimeagen/harpoon') + -- Harpoon - easily go between files + use('theprimeagen/harpoon') - -- Undotree - undo history visualizer - use('mbbill/undotree') + -- Undotree - undo history visualizer + use('mbbill/undotree') - -- Vim fugitive - git wrapper - use('tpope/vim-fugitive') + -- Vim fugitive - git wrapper + use('tpope/vim-fugitive') - -- Statusline - use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true } - } + -- Statusline + use { + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true } + } - -- LSP - use { - 'VonHeikemen/lsp-zero.nvim', - requires = { - -- LSP Support - { 'neovim/nvim-lspconfig' }, - { 'williamboman/mason.nvim' }, - { 'williamboman/mason-lspconfig.nvim' }, + -- LSP + use { + 'VonHeikemen/lsp-zero.nvim', + requires = { + -- LSP Support + { 'neovim/nvim-lspconfig' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, - -- Autocompletion - { 'hrsh7th/nvim-cmp' }, - { 'hrsh7th/cmp-buffer' }, - { 'hrsh7th/cmp-path' }, - { 'saadparwaiz1/cmp_luasnip' }, - { 'hrsh7th/cmp-nvim-lsp' }, - { 'hrsh7th/cmp-nvim-lua' }, + -- Autocompletion + { 'hrsh7th/nvim-cmp' }, + { 'hrsh7th/cmp-buffer' }, + { 'hrsh7th/cmp-path' }, + { 'saadparwaiz1/cmp_luasnip' }, + { 'hrsh7th/cmp-nvim-lsp' }, + { 'hrsh7th/cmp-nvim-lua' }, - -- Snippets - { 'L3MON4D3/LuaSnip' }, - { 'rafamadriz/friendly-snippets' }, - } - } + -- Snippets + { 'L3MON4D3/LuaSnip' }, + { 'rafamadriz/friendly-snippets' }, + } + } end)