commit a89179ce061ae0e4b603f490f3718a117002bce7 Author: bacalhau Date: Wed Jul 2 15:42:50 2025 +0100 first commit diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..63a7b3d --- /dev/null +++ b/init.lua @@ -0,0 +1,8 @@ +--lazy +require("config.lazy") + +-- main nvim configs +require("behavior") + +-- treesitter +require("lazy").setup({{"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"}}) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..c9074be --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,16 @@ +{ + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, + "cmp-path": { "branch": "main", "commit": "edbab83da34fffbaf993491e84d0223540f42f0b" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gruvbox.nvim": { "branch": "main", "commit": "58a2cda2e953a99e2f87c12b7fb4602da4e0709c" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-jdtls": { "branch": "master", "commit": "4d77ff02063cf88963d5cf10683ab1fd15d072de" }, + "nvim-lspconfig": { "branch": "master", "commit": "1cb30b1bafe5a63a5c6ac20dc39f83487df38855" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" } +} diff --git a/lua/.luarc.json b/lua/.luarc.json new file mode 100644 index 0000000..0d7584e --- /dev/null +++ b/lua/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.disable": [ + "undefined-global" + ] +} \ No newline at end of file diff --git a/lua/behavior.lua b/lua/behavior.lua new file mode 100644 index 0000000..247b511 --- /dev/null +++ b/lua/behavior.lua @@ -0,0 +1,28 @@ +-- base +vim.g.mapleader = " " + +-- line numbers +vim.opt.nu = true +vim.opt.relativenumber = true + +-- spell check +vim.opt.spell = true +vim.opt.spelllang = { 'pt', 'en' } + +-- tab +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true +vim.smartindent = true + +-- search +vim.opt.hlsearch = false +vim.opt.incsearch = true + +-- edit history +vim.opt.undofile = true +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" + +vim.opt.scrolloff = 8 +vim.opt.updatetime = 50 diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..8c75b2a --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,36 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "gruvbox" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) + diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..4d83158 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,71 @@ +return { + { + "mason-org/mason-lspconfig.nvim", + config = function() + ensure_installed = { "lua-language-server", "gopls", "jdtls" } + end + }, + { + "mason-org/mason.nvim", + config = function() + require("mason").setup() + end + }, + { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + + vim.keymap.set('n', 'K', vim.lsp.buf.hover, {}) + vim.keymap.set('n', 'd', vim.diagnostic.open_float, {}) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, {}) + + local servers = { "lua_ls", "gopls", "jdtls" } + for _, server in ipairs(servers) do + lspconfig[server].setup({}) + end + end + }, + { "mfussenegger/nvim-jdtls" }, + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", + dependencies = { + "rafamadriz/friendly-snippets", + } + }, + { + 'hrsh7th/nvim-cmp', + dependencies = { + 'hrsh7th/cmp-nvim-lsp', -- Autocompletar com LSP + 'hrsh7th/cmp-buffer', -- Autocompletar com o buffer + 'hrsh7th/cmp-path', -- Autocompletar com caminhos de arquivo + 'saadparwaiz1/cmp_luasnip', -- Autocompletar com LuaSnip + 'L3MON4D3/LuaSnip', -- O plugin de snippets + }, + config = function() + local cmp = require('cmp') + local luasnip = require('luasnip') + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- Expande o snippet com LuaSnip + end, + }, + mapping = { + [''] = cmp.mapping.select_next_item(), -- Seleciona o próximo item + [''] = cmp.mapping.select_prev_item(), -- Seleciona o item anterior + [''] = cmp.mapping.confirm({ select = true }), -- Confirma a seleção + }, + sources = { + { name = 'nvim_lsp' }, -- LSP + { name = 'buffer' }, -- Buffer + { name = 'path' }, -- Caminhos + { name = 'luasnip' }, -- LuaSnip + }, + }) + end + } +} diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua new file mode 100644 index 0000000..585babe --- /dev/null +++ b/lua/plugins/theme.lua @@ -0,0 +1,37 @@ +return { + +-- theming + { + "ellisonleao/gruvbox.nvim", + lazy = false, + priority = 1000, + config = function() + require("gruvbox").setup({ + terminal_colors = true, -- add neovim terminal colors + undercurl = true, + underline = true, + bold = true, + italic = { + strings = false, + emphasis = false, + comments = false, + operators = false, + folds = false, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "hard", -- can be "hard", "soft" or empty string + palette_overrides = {}, + overrides = {}, + dim_inactive = false, + transparent_mode = false, + }) + + vim.cmd([[colorscheme gruvbox]]) + + end + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..9b67dcb --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,14 @@ +return{ + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function () + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = { "c", "lua", "vim", "vimdoc", "html", "go", "java", "css" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} diff --git a/spell/en.utf-8.spl b/spell/en.utf-8.spl new file mode 100644 index 0000000..e4b1e1c Binary files /dev/null and b/spell/en.utf-8.spl differ diff --git a/spell/pt.utf-8.spl b/spell/pt.utf-8.spl new file mode 100644 index 0000000..b6e9e91 Binary files /dev/null and b/spell/pt.utf-8.spl differ