refactor: move config

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-03-15 21:33:43 -03:00
parent 092129549f
commit f97d64c598
7 changed files with 184 additions and 15 deletions

5
TODO.md Normal file → Executable file
View File

@@ -1,8 +1,9 @@
- [ ] (), {}, [] and closing tags </> auto competition
- [ ] Integration with lazygit or other git integration/TUI
- [x] Integration with lazygit or other git integration/TUI
- [ ] Plugin for easily jumping in file, like leap.nvim or hop.nvim
- [ ] Configure neo-tree mappings.
- [ ] Some type of spell checking?
- [x] Some type of spell checking?
- [ ] Better markdown editing.
- [ ] Fix nix integration.

0
after/.gitkeep Normal file
View File

View File

@@ -12,7 +12,7 @@ local on_attach = function(_, bufnr)
bmap('gI', vim.lsp.buf.implementation, 'Goto Implementation');
bmap('<leader>D', vim.lsp.buf.type_definition, 'Type Definition');
bmap('K', vim.lsp.buf.hover, 'Hover docs');
-- bmap('K', vim.lsp.buf.hover, 'Hover docs');
bmap('<C-k>', vim.lsp.buf.signature_help, 'Signature docs');
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
@@ -36,6 +36,26 @@ require('which-key').register({
['<leader>w'] = { name = '[w] Workspace', _ = 'which_key_ignore' },
});
require('hover').setup({
init = function()
require('hover.providers.lsp');
end,
preview_opts = {
border = 'single',
},
preview_window = false,
title = true,
mouse_providers = { 'LSP', },
mouse_delay = 1000,
});
vim.keymap.set('n', 'K', require('hover').hover, { desc = '[K] Hover' });
vim.keymap.set('n', 'sK', require('hover').hover_select, { desc = '[K] Hover select' });
-- Mouse support
vim.keymap.set('n', '<MouseMove>', require('hover').hover_mouse, { desc = '[MouseMove] Hover mouse' });
vim.o.mousemoveevent = true;
local capabilities = vim.lsp.protocol.make_client_capabilities();
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities);

View File

@@ -0,0 +1,81 @@
require('nvim-treesitter.configs').setup({
ensure_installed = { 'lua', 'vim', 'vimdoc', 'bash', 'javascript' },
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false,
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
toggle_injected_languages = 't',
toggle_anonymous_nodes = 'a',
toggle_language_display = 'I',
focus_language = 'f',
unfocus_language = 'F',
update = 'R',
goto_node = '<cr>',
show_help = '?',
},
},
query_linter = {
enable = true,
use_virtual_text = true,
lint_events = { 'BugWrite', 'CursorHold' },
},
});

View File

@@ -5,6 +5,8 @@
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" },
"gitsigns.nvim": { "branch": "main", "commit": "3e6e91b09f0468c32d3b96dcacf4b947f037ce25" },
"hover.nvim": { "branch": "main", "commit": "bbd59ddfae4e64459944acf2abcda4d81ba8bac6" },
"indent-blankline.nvim": { "branch": "master", "commit": "3c8a185da4b8ab7aef487219f5e001b11d4b6aaf" },
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
"lspkind.nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" },
@@ -14,7 +16,9 @@
"neodev.nvim": { "branch": "main", "commit": "be8d4d4cab6c13c6a572269c9d6a63774baba9a0" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
"nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" },
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }

View File

@@ -33,6 +33,8 @@ vim.keymap.set('n', '<leader>x', '<cmd>!chmod +x %<CR>', { silent = true });
vim.keymap.set('n', '<leader>w\\', '<cmd>:vsplit<cr>', { desc = '[w\\] Splits the window vertically' });
vim.keymap.set('n', '<leader>w/', '<cmd>:split<cr>', { desc = '[w/] Splits the window horizontally' });
vim.keymap.set('n', '<leader>e', '<cmd>:Ex<cr>', { desc = '[e] Explorer' });
vim.keymap.set('n', 's=', 'z=', { desc = '[s=] Suggest spelling correction' });
vim.keymap.set('n', '<leader>st', function()
if vim.o.spell then

View File

@@ -27,13 +27,6 @@ return {
main = 'ibl',
opts = {},
},
{ 'j-hui/fidget.nvim', },
{ "williamboman/mason.nvim", },
{ "williamboman/mason-lspconfig.nvim", },
{ "neovim/nvim-lspconfig", },
{ 'folke/which-key.nvim', },
{ 'folke/neodev.nvim', },
{ 'nvim-tree/nvim-web-devicons', },
{
'lewis6991/gitsigns.nvim',
opts = {
@@ -44,14 +37,15 @@ return {
topdelete = { text = '-' },
changedelete = { text = '~' },
},
on_attach = function (bufnr)
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' });
on_attach = function(bufnr)
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk,
{ buffer = bufnr, desc = 'Preview git hunk' });
local gs = package.loaded.gitsigns;
vim.keymap.set({ 'n', 'v' }, ']c', function()
if vim.wo.diff then
return ']c';
end
vim.schedule(function ()
vim.schedule(function()
gs.next_hunk()
end);
return '<Ignore>';
@@ -60,7 +54,7 @@ return {
if vim.wo.diff then
return '[c';
end
vim.schedule(function ()
vim.schedule(function()
gs.next_hunk()
end);
return '<Ignore>';
@@ -68,6 +62,22 @@ return {
end,
},
},
{
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
'nvim-treesitter/playground',
},
build = ':TSUpdate',
},
{ 'j-hui/fidget.nvim', },
{ "williamboman/mason.nvim", },
{ "williamboman/mason-lspconfig.nvim", },
{ "neovim/nvim-lspconfig", },
{ 'folke/which-key.nvim', },
{ 'lewis6991/hover.nvim', },
{ 'folke/neodev.nvim', },
{ 'nvim-tree/nvim-web-devicons', },
{
'hrsh7th/nvim-cmp',
dependencies = {
@@ -78,6 +88,39 @@ return {
'onsails/lspkind.nvim',
},
},
{ 'tpope/vim-sleuth', },
{
'folke/troube.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', },
opts = {},
lazy = false,
},
{
'stevearc/conform.nvim',
opts = {
formatters_by_ft = {
nix = { 'nixpkgs_fmt' },
},
format_on_save = {
timeout_ms = 1000,
lsp_fallback = true,
},
},
},
{
'numToStr/Comment.nvim',
opts = {
extra = {
above = 'gc0',
below = 'gco',
eol = 'gcA',
},
mappings = {
basic = true,
extra = true,
},
},
},
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
@@ -86,10 +129,28 @@ return {
{
'nvim-telescope/telescope-fnf-native.nvim',
build = 'make',
cond = function ()
cond = function()
return vim.fn.executable('make') == 1
end
},
},
},
{
'okuuva/auto-save.nvim',
lazy = false,
event = { 'InsertLeave', 'TextChanged', },
opts = {},
},
{ 'tpope/vim-fugitive', },
{ 'tpope/vim-rhubarb', },
{
'kdheepak/lazygit.nvim',
dependencies = { 'nvim-lua/plenary.nvim', },
keys = { { '<leader>gg', '<cmd>:LazyGit<cr>', desc = '[gg] Lazygit', } },
},
{ 'lambdalisue/suda.vim', },
{
'aserowy/tmux.nvim',
config = true,
},
};