Initial commit

This commit is contained in:
Andre Henriques 2024-01-13 17:49:53 +00:00
commit 718caf540d
13 changed files with 269 additions and 0 deletions

1
init.lua Normal file
View File

@ -0,0 +1 @@
require('andr3')

21
lazy-lock.json Normal file
View File

@ -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" }
}

6
lua/andr3/init.lua Normal file
View File

@ -0,0 +1,6 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
require('andr3.lazy')
require('andr3.set')
require('andr3.keys')

7
lua/andr3/keys.lua Normal file
View File

@ -0,0 +1,7 @@
-- Leader is set on init before lazy
-- vim.g.mapleader = " "
-- vim.g.maplocalleader = " "
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")

7
lua/andr3/lazy.lua Normal file
View File

@ -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 }
})

View File

@ -0,0 +1,10 @@
return {
"folke/lazy.nvim",
{ 'nvim-lua/plenary.nvim', name = "plenary" },
'mbbill/undotree',
'tpope/vim-fugitive',
'eandrju/cellular-automaton.nvim',
}

129
lua/andr3/plugins/lsp.lua Normal file
View File

@ -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', '<C-k>', vim.lsp.buf.signature_help, opts)
-- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
-- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
-- vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
-- vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<leader>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({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = 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,
},
}

View File

@ -0,0 +1,11 @@
return {
'L3MON4D3/LuaSnip',
name = "luasnip",
dependencies = {
"rafamadriz/friendly-snippets"
},
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end
}

View File

@ -0,0 +1,8 @@
return {
"danymat/neogen",
dependencies = {"nvim-treesitter/nvim-treesitter"},
config = function()
require('neogen').setup({})
vim.keymap.set("n", "<leader>gc", ":lua require('neogen').generate()<CR>", opts)
end,
}

View File

@ -0,0 +1,20 @@
return {
'nvim-telescope/telescope.nvim',
dependencies = { "plenary" },
config = function()
local telescope = require('telescope.builtin')
vim.keymap.set('n', '<leader>f', telescope.find_files, {})
vim.keymap.set('n', '<leader>/', telescope.live_grep, {})
vim.keymap.set('n', '<leader>b', telescope.buffers, {})
vim.keymap.set('n', '<leader>?', telescope.help_tags, {})
vim.keymap.set('n', '<leader>pws', function()
local word = vim.fn.expand("<cword>")
telescope.grep_string({search = word})
end)
vim.keymap.set('n', '<leader>pWs', function()
local word = vim.fn.expand("<cWORD>")
telescope.grep_string({search = word})
end)
end,
}

View File

@ -0,0 +1,8 @@
return {
{
"git@git.andr3h3nriqu3s.com:andr3/bubblegum-theme.git",
config = function()
vim.cmd('colorscheme bubblegum-256-light')
end
},
}

View File

@ -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
},
}

19
lua/andr3/set.lua Normal file
View File

@ -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