commit 718caf540d9efa67a3393f64af3c7998b2de0182 Author: Andre Henriques Date: Sat Jan 13 17:49:53 2024 +0000 Initial commit diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..d42d09b --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require('andr3') diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..0c02672 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,21 @@ +{ + "bubblegum-theme": { "branch": "main", "commit": "105b1302ee54abae9abc199710b94a6098572a8e" }, + "cellular-automaton.nvim": { "branch": "main", "commit": "b7d056dab963b5d3f2c560d92937cb51db61cb5b" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "fidget": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" }, + "friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "luasnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" }, + "neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" }, + "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" }, + "nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" }, + "plenary": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, + "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" } +} \ No newline at end of file diff --git a/lua/andr3/init.lua b/lua/andr3/init.lua new file mode 100644 index 0000000..d8fe5ec --- /dev/null +++ b/lua/andr3/init.lua @@ -0,0 +1,6 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +require('andr3.lazy') +require('andr3.set') +require('andr3.keys') diff --git a/lua/andr3/keys.lua b/lua/andr3/keys.lua new file mode 100644 index 0000000..4405750 --- /dev/null +++ b/lua/andr3/keys.lua @@ -0,0 +1,7 @@ +-- Leader is set on init before lazy +-- vim.g.mapleader = " " +-- vim.g.maplocalleader = " " + +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") + diff --git a/lua/andr3/lazy.lua b/lua/andr3/lazy.lua new file mode 100644 index 0000000..230b549 --- /dev/null +++ b/lua/andr3/lazy.lua @@ -0,0 +1,7 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +vim.opt.rtp:prepend(lazypath) + +require('lazy').setup({ + spec = "andr3.plugins", + change_detection = { notify = false } +}) diff --git a/lua/andr3/plugins/init.lua b/lua/andr3/plugins/init.lua new file mode 100644 index 0000000..1ffaa58 --- /dev/null +++ b/lua/andr3/plugins/init.lua @@ -0,0 +1,10 @@ +return { + "folke/lazy.nvim", + + { 'nvim-lua/plenary.nvim', name = "plenary" }, + + 'mbbill/undotree', + 'tpope/vim-fugitive', + + 'eandrju/cellular-automaton.nvim', +} diff --git a/lua/andr3/plugins/lsp.lua b/lua/andr3/plugins/lsp.lua new file mode 100644 index 0000000..b8e6875 --- /dev/null +++ b/lua/andr3/plugins/lsp.lua @@ -0,0 +1,129 @@ +function setup_attach() + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function (ev) + + -- local lspconfig = require('lspconfig') + + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + -- vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + -- vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'gf', function() + vim.lsp.buf.format { async = true } + end, opts) + end, + }) +end + +function setup_cmp() + local cmp = require('cmp') + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + }) + }) + + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) +end + +return { + + { + "j-hui/fidget.nvim", + name = "fidget", + opts = {} + }, + + { + "neovim/nvim-lspconfig", + dependencies = { + 'neovim/nvim-lspconfig', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/nvim-cmp', + 'saadparwaiz1/cmp_luasnip', + 'luasnip', + 'fidget', + }, + config = function() + local lspconfig = require('lspconfig') + + vim.diagnostic.config({ + virtual_text = { + prefix = "👈", + }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "🆒", + [vim.diagnostic.severity.WARN] = "😞", + [vim.diagnostic.severity.HINT] = "🆘", + [vim.diagnostic.severity.INFO] = "🆓", + CodeAction = "🈁", + } + }, + }) + + -- Check out trouble + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next) + + setup_attach() + setup_cmp() + + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + require('cmp_nvim_lsp').default_capabilities() + ) + + local def_set_servers = { "tsserver", "svelte" } + + for _, server_name in ipairs(def_set_servers) do + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end + end, + }, + +} diff --git a/lua/andr3/plugins/luasnip.lua b/lua/andr3/plugins/luasnip.lua new file mode 100644 index 0000000..4b4fa9e --- /dev/null +++ b/lua/andr3/plugins/luasnip.lua @@ -0,0 +1,11 @@ + +return { + 'L3MON4D3/LuaSnip', + name = "luasnip", + dependencies = { + "rafamadriz/friendly-snippets" + }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end +} diff --git a/lua/andr3/plugins/neogen.lua b/lua/andr3/plugins/neogen.lua new file mode 100644 index 0000000..5f1c21b --- /dev/null +++ b/lua/andr3/plugins/neogen.lua @@ -0,0 +1,8 @@ +return { + "danymat/neogen", + dependencies = {"nvim-treesitter/nvim-treesitter"}, + config = function() + require('neogen').setup({}) + vim.keymap.set("n", "gc", ":lua require('neogen').generate()", opts) + end, +} diff --git a/lua/andr3/plugins/telescope.lua b/lua/andr3/plugins/telescope.lua new file mode 100644 index 0000000..8b8dc46 --- /dev/null +++ b/lua/andr3/plugins/telescope.lua @@ -0,0 +1,20 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { "plenary" }, + config = function() + local telescope = require('telescope.builtin') + + vim.keymap.set('n', 'f', telescope.find_files, {}) + vim.keymap.set('n', '/', telescope.live_grep, {}) + vim.keymap.set('n', 'b', telescope.buffers, {}) + vim.keymap.set('n', '?', telescope.help_tags, {}) + vim.keymap.set('n', 'pws', function() + local word = vim.fn.expand("") + telescope.grep_string({search = word}) + end) + vim.keymap.set('n', 'pWs', function() + local word = vim.fn.expand("") + telescope.grep_string({search = word}) + end) + end, +} diff --git a/lua/andr3/plugins/themes.lua b/lua/andr3/plugins/themes.lua new file mode 100644 index 0000000..8ed9043 --- /dev/null +++ b/lua/andr3/plugins/themes.lua @@ -0,0 +1,8 @@ +return { + { + "git@git.andr3h3nriqu3s.com:andr3/bubblegum-theme.git", + config = function() + vim.cmd('colorscheme bubblegum-256-light') + end + }, +} diff --git a/lua/andr3/plugins/utils.lua b/lua/andr3/plugins/utils.lua new file mode 100644 index 0000000..d8ede0a --- /dev/null +++ b/lua/andr3/plugins/utils.lua @@ -0,0 +1,22 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + config = function() + local ts_update = require('nvim-treesitter.install').update({ with_sync = true }); + ts_update() + + require('nvim-treesitter.configs').setup({ + ensure_installed = { + "lua", "svelte", "javascript", "typescript", "html", "elixir", "vim", + "jsdoc", + }, + + auto_install = true, + + highlight = { + enable = true + } + }) + end + }, +} diff --git a/lua/andr3/set.lua b/lua/andr3/set.lua new file mode 100644 index 0000000..430b326 --- /dev/null +++ b/lua/andr3/set.lua @@ -0,0 +1,19 @@ +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.laststatus = 3 +vim.opt.expandtab = true +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.smartindent = true +vim.opt.wrap = true + +vim.opt.clipboard = "unnamedplus" +vim.opt.signcolumn = "number" + +vim.opt.termguicolors = true +vim.opt.cursorline = true