Telescope must still be fixed to navigate with j and k but the tree is much better etc.

This commit is contained in:
Gustavo 2025-07-03 23:32:57 +02:00
parent a61f73853d
commit 0b4c1a94e9
12 changed files with 259 additions and 92 deletions

View File

@ -112,7 +112,7 @@ vim.o.confirm = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- vim.keymap.set('n', '<leader>dq', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
@ -137,6 +137,9 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
-- NOTE These are Custom
vim.keymap.set('n', '<leader>x', ':q<CR>', { desc = 'Kill buffer' })
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -278,7 +281,9 @@ require('lazy').setup({
spec = {
{ '<leader>f', group = '[F]ind' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
{ '<leader>d', group = '[D]ebug' },
{ '<leader>g', group = 'Git', mode = { 'n', 'v' } },
{ '<leader>q', group = 'Quickfix' },
},
},
},
@ -333,12 +338,12 @@ require('lazy').setup({
-- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it!
local actions = require 'telescope.actions'
-- [[ 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 = {
layout_strategy = 'horizontal',
layout_config = {
@ -346,11 +351,25 @@ require('lazy').setup({
height = 0.9,
},
preview_width = 0.6,
path_display = { 'truncate' },
mappings = {
i = { ['<c-enter>'] = 'to_fuzzy_refine' },
n = {
['<c-w>'] = actions.add_selected_to_qflist + actions.open_qflist,
},
i = {
['<c-enter>'] = 'to_fuzzy_refine',
['<c-j>'] = actions.cycle_history_next,
['<c-k>'] = actions.cycle_history_prev,
['<c-w>'] = actions.add_selected_to_qflist + actions.open_qflist,
},
},
},
pickers = {
find_files = {
find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' },
},
},
-- pickers = {}
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
@ -619,7 +638,11 @@ require('lazy').setup({
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`ts_ls`) will work just fine
ts_ls = {},
ts_ls = {
capabilities = capabilities,
},
vue_ls = {},
eslint = {},
--
lua_ls = {
@ -706,13 +729,30 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
typescript = { 'prettierd' },
typescriptreact = { 'prettierd' },
svelte = { { 'prettierd', 'prettier', stop_after_first = true } },
astro = { { 'prettierd', 'prettier', stop_after_first = true } },
javascript = { { 'prettierd', 'prettier', stop_after_first = true } },
typescript = { { 'prettierd', 'prettier', stop_after_first = true } },
javascriptreact = { { 'prettierd', 'prettier', stop_after_first = true } },
typescriptreact = { { 'prettierd', 'prettier', stop_after_first = true } },
json = { { 'prettierd', 'prettier', stop_after_first = true } },
graphql = { { 'prettierd', 'prettier', stop_after_first = true } },
java = { 'google-java-format' },
kotlin = { 'ktlint' },
ruby = { 'standardrb' },
markdown = { { 'prettierd', 'prettier', stop_after_first = true } },
erb = { 'htmlbeautifier' },
html = { 'htmlbeautifier' },
bash = { 'beautysh' },
proto = { 'buf' },
rust = { 'rustfmt' },
yaml = { 'yamlfix' },
toml = { 'taplo' },
css = { { 'prettierd', 'prettier', stop_after_first = true } },
scss = { { 'prettierd', 'prettier', stop_after_first = true } },
sh = { 'shellcheck' },
go = { 'gofmt' },
xml = { 'xmllint' },
},
},
},
@ -911,22 +951,10 @@ require('lazy').setup({
-- init.lua. If you want these files, they are in the repository, so you can just download them and
-- place them in the correct locations.
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
--
-- Here are some example plugins that I've included in the Kickstart repository.
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
require 'kickstart.plugins.debug',
require 'kickstart.plugins.indent_line',
require 'kickstart.plugins.lint',
require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
{ import = 'kickstart.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`

View File

@ -1,29 +1,31 @@
{
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
"conform.nvim": { "branch": "master", "commit": "4c9003aab62879612c50136649baa1b8ed36cfa1" },
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
"gitsigns.nvim": { "branch": "main", "commit": "588264bee92993df92535b6742576f5655c91b1c" },
"gitsigns.nvim": { "branch": "main", "commit": "c80e0b4bfc411d5740a47adc8775fd1070f2028b" },
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"lazygit.nvim": { "branch": "main", "commit": "4839ab642962cc76bb1bf278427dc4c59be15072" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "73e0143385d8a2185944b42ed44d728b94ee19a3" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"mini.nvim": { "branch": "main", "commit": "48f48e4b3f317e9da34ee7a01958b4c5018e2d34" },
"neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-dap": { "branch": "master", "commit": "14fe46ae16eb272629144a93f7738f5279665a4f" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-dap": { "branch": "master", "commit": "1c75a797b4017fec6491f509cf196c8c8833f26f" },
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
"nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" },
"nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" },
"nvim-lspconfig": { "branch": "master", "commit": "1cb30b1bafe5a63a5c6ac20dc39f83487df38855" },
"nvim-lspconfig": { "branch": "master", "commit": "1ddc1a2e692b120cda6d33c890461e49cb85d6bf" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" },
"nvim-tree.lua": { "branch": "master", "commit": "6b5b36659688767fb9f133bb83024ab1466fe5cd" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" },
@ -34,5 +36,6 @@
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "d52d70780ca6497ed28ad1b11bb1e981f666f62a" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
}

View File

@ -1,8 +0,0 @@
return {
require 'kickstart.plugins.debug',
require 'kickstart.plugins.indent_line',
require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.gitsigns',
}

View File

@ -15,6 +15,6 @@ return {
-- setting the keybinding for LazyGit with 'keys' is recommended in
-- order to load the plugin when the command is run for the first time
keys = {
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
{ '<leader>gg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
},
}

View File

@ -0,0 +1,89 @@
return {
'nvim-tree/nvim-tree.lua',
version = '*',
lazy = false,
dependencies = {
'nvim-tree/nvim-web-devicons',
},
config = function()
local function custom_attach(bufnr)
local api = require 'nvim-tree.api'
local function opts(desc)
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
local function edit_or_open()
local node = api.tree.get_node_under_cursor()
if node.nodes ~= nil then
-- expand or collapse folder
api.node.open.edit()
else
-- open file
api.node.open.edit()
-- Close the tree if file was opened
api.tree.close()
end
end
-- open as vsplit on current node
local function vsplit_preview()
local node = api.tree.get_node_under_cursor()
if node.nodes ~= nil then
-- expand or collapse folder
api.node.open.edit()
else
-- open file as vsplit
api.node.open.vertical()
end
-- Finally refocus on tree if it was lost
api.tree.focus()
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent, opts 'Up')
vim.keymap.set('n', '?', api.tree.toggle_help, opts 'Help')
--
-- global
vim.api.nvim_set_keymap('n', '<C-h>', ':NvimTreeToggle<cr>', { silent = true, noremap = true })
-- on_attach
vim.keymap.set('n', 'l', edit_or_open, opts 'Edit Or Open')
vim.keymap.set('n', 'L', vsplit_preview, opts 'Vsplit Preview')
vim.keymap.set('n', 'h', api.tree.close, opts 'Close')
vim.keymap.set('n', 'H', api.tree.collapse_all, opts 'Collapse All')
end
require('nvim-tree').setup {
on_attach = custom_attach,
sort = {
sorter = 'case_sensitive',
},
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
}
end,
}
-- return {
-- 'nvim-tree/nvim-tree.lua',
-- version = '*',
-- lazy = false,
-- dependencies = {
-- 'nvim-tree/nvim-web-devicons',
-- },
-- config = function()
-- require('nvim-tree').setup {}
-- end,
-- }

View File

@ -0,0 +1,33 @@
return {
'folke/trouble.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
cmd = { 'Trouble' },
opts = {}, -- Use default options
keys = {
{
'<leader>qx',
'<cmd>Trouble diagnostics toggle<cr>',
desc = 'Toggle Diagnostics',
},
{
'<leader>qd',
'<cmd>Trouble diagnostics toggle filter.buf=0<cr>',
desc = 'Toggle Document Diagnostics',
},
{
'<leader>qq',
'<cmd>Trouble quickfix toggle<cr>',
desc = 'Toggle Quickfix List',
},
{
'<leader>ql',
'<cmd>Trouble loclist toggle<cr>',
desc = 'Toggle Location List',
},
{
'<leader>qr',
'<cmd>Trouble lsp toggle focus=false win.position=right<cr>',
desc = 'Toggle LSP References',
},
},
}

View File

@ -1,6 +1,3 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',

View File

@ -55,14 +55,14 @@ return {
desc = 'Debug: Step Out',
},
{
'<leader>b',
'<leader>db',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
'<leader>dB',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,

View File

@ -41,20 +41,20 @@ return {
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [r]eset hunk' })
-- normal mode
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function()
map('n', '<leader>gs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>gr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>gS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>gu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>gR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('n', '<leader>gp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>gb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>gd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>gD', function()
gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
map('n', '<leader>tgb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tgD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
end,
},
},

View File

@ -14,7 +14,9 @@ return {
javascript = { 'eslint' },
javascripttreact = { 'eslint' },
typescript = { 'eslint' },
typescriptreact = { 'eslint' },
svelte = { 'eslint_d' },
kotlin = { 'ktlint' },
terraform = { 'tflint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
@ -47,6 +49,9 @@ return {
lint.linters_by_ft['javascripttreact'] = nil
lint.linters_by_ft['typescript'] = nil
lint.linters_by_ft['typescriptreact'] = nil
lint.linters_by_ft['svelte'] = nil
lint.linters_by_ft['kotlin'] = nil
lint.linters_by_ft['terraform'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.

View File

@ -0,0 +1,45 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('lualine').setup {
options = {
theme = 'tokyonight',
component_separators = '',
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } },
lualine_b = { 'branch', 'diagnostics' },
lualine_c = { { 'filename', path = 1 } },
lualine_x = {},
lualine_y = { 'filetype', 'progress' },
lualine_z = {
{ 'location', separator = { right = '' }, left_padding = 2 },
},
},
inactive_sections = {
lualine_a = { 'filename' },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { 'location' },
},
tabline = {},
extensions = {},
}
end,
}

View File

@ -1,25 +0,0 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
lazy = false,
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
},
},
},
},
}