diff --git a/init.lua b/init.lua index 49a3a340..28d65210 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -357,6 +357,7 @@ require('lazy').setup({ { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() + local actions = require 'telescope.actions' -- Telescope is a fuzzy finder that comes with a lot of different things that -- it can fuzzy find! It's more than just a "file finder", it can search -- many different aspects of Neovim, your workspace, LSP, and more! @@ -379,15 +380,17 @@ require('lazy').setup({ -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, - -- pickers = {} + defaults = { + mappings = { + i = { + -- Navegar com Ctrl+j e Ctrl+k + [''] = actions.move_selection_next, + [''] = actions.move_selection_previous, + -- Confirmar seleção com Enter + [''] = actions.select_default, + }, + }, + }, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), @@ -632,6 +635,30 @@ require('lazy').setup({ }, }, }, + + gopls = { + -- Comando para iniciar o gopls + cmd = { 'gopls' }, + + -- Arquivos que o gopls deve processar + filetypes = { 'go', 'gomod' }, + + -- Definindo as capacidades do LSP (com suporte a snippets, por exemplo) + capabilities = capabilities, + + -- Configurações específicas do gopls + settings = { + gopls = { + analyses = { + unusedparams = true, -- Analisar parâmetros não utilizados + }, + staticcheck = true, -- Habilitar verificações estáticas + }, + }, + + -- Configurações de root directory + root_dir = require('lspconfig/util').root_pattern('go.work', 'go.mod', '.git'), + }, } -- Ensure the servers and tools above are installed @@ -764,19 +791,25 @@ require('lazy').setup({ -- No, but seriously. Please read `:help ins-completion`, it is really good! mapping = cmp.mapping.preset.insert { -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), + -- [''] = cmp.mapping.select_next_item(), + -- -- Select the [p]revious item + -- [''] = cmp.mapping.select_prev_item(), + -- + -- -- Scroll the documentation window [b]ack / [f]orward + -- [''] = cmp.mapping.scroll_docs(-4), + -- [''] = cmp.mapping.scroll_docs(4), + -- + -- -- Accept ([y]es) the completion. + -- -- This will auto-import if your LSP supports it. + -- -- This will expand snippets if the LSP sent a snippet. + -- [''] = cmp.mapping.confirm { select = true }, - -- Scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.select_next_item(), -- Usar Ctrl + j para navegar para baixo + [''] = cmp.mapping.select_prev_item(), -- Usar Ctrl + k para navegar para cima + [''] = cmp.mapping.confirm { select = true }, -- Usar Enter para confirmar seleção [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, - -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines --[''] = cmp.mapping.confirm { select = true },