Refactors for tests, debug and neotree

This commit is contained in:
Andre Raposo 2024-08-06 14:39:54 -03:00
parent cb546c06da
commit 1a7dacc199
12 changed files with 335 additions and 45 deletions

View File

@ -7,6 +7,9 @@ vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal -- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true vim.g.have_nerd_font = true
-- Set global theme
vim.g.theme = 'oxocarbon'
-- [[ Setting options ]] -- [[ Setting options ]]
-- See `:help vim.opt` -- See `:help vim.opt`
-- NOTE: You can change these options as you wish! -- NOTE: You can change these options as you wish!
@ -139,6 +142,7 @@ vim.opt.rtp:prepend(lazypath)
-- To update plugins you can run -- To update plugins you can run
-- :Lazy update -- :Lazy update
-- --
--
-- NOTE: Here is where you install your plugins. -- NOTE: Here is where you install your plugins.
require('lazy').setup({ require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
@ -158,16 +162,7 @@ require('lazy').setup({
-- See `:help gitsigns` to understand what the configuration keys do -- See `:help gitsigns` to understand what the configuration keys do
{ -- Adds git related signs to the gutter, as well as utilities for managing changes { -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
opts = { opts = {},
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
},
}, },
-- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- NOTE: Plugins can also be configured to run Lua code when they are loaded.
@ -592,9 +587,11 @@ require('lazy').setup({
vim.list_extend(ensure_installed, { vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code 'stylua', -- Used to format Lua code
'black', -- Used to format python code 'black', -- Used to format python code
'sonarlint-language-server', -- Helpful linting and diagnostics 'debugpy', -- Python Debugger
'css-lsp', -- css 'css-lsp', -- css
'emmet-language-server', -- emmet 'emmet-language-server', -- emmet
'sonarlint-language-server', -- Helpful linting and diagnostics
'markdownlint',
}) })
require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-tool-installer').setup { ensure_installed = ensure_installed }
@ -792,17 +789,35 @@ require('lazy').setup({
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim', 'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins. priority = 1000, -- Make sure to load this before all the other start plugins.
init = function() -- init = function()
-- Load the colorscheme here. -- -- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load -- -- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night' -- vim.cmd.colorscheme 'tokyonight-night'
--
-- You can configure highlights by doing something like: -- -- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none' -- vim.cmd.hi 'Comment gui=none'
-- end,
},
{
'Mofiqul/adwaita.nvim',
lazy = false,
priority = 1000,
config = function()
vim.cmd.colorscheme(vim.g.theme)
end, end,
}, },
{
'uloco/bluloco.nvim',
lazy = false,
priority = 1000,
dependencies = { 'rktjmp/lush.nvim' },
},
{
'nyoom-engineering/oxocarbon.nvim',
lazy = false,
priority = 1000,
},
-- Highlight todo, notes, etc in comments -- Highlight todo, notes, etc in comments
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
@ -824,21 +839,7 @@ require('lazy').setup({
-- - sr)' - [S]urround [R]eplace [)] ['] -- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup() require('mini.surround').setup()
-- Simple and easy statusline. require('mini.icons').setup()
-- You could remove this setup call if you don't like it,
-- and try some other statusline plugin
local statusline = require 'mini.statusline'
-- set use_icons to true if you have a Nerd Font
statusline.setup { use_icons = vim.g.have_nerd_font }
-- You can configure sections in the statusline by overriding their
-- default behavior. For example, here we set the section for
-- cursor location to LINE:COLUMN
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_location = function()
return '%2l:%-2v'
end
-- ... and there is more! -- ... and there is more!
-- Check out: https://github.com/echasnovski/mini.nvim -- Check out: https://github.com/echasnovski/mini.nvim
end, end,
@ -849,7 +850,22 @@ require('lazy').setup({
main = 'nvim-treesitter.configs', -- Sets main module to use for opts main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = { opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, ensure_installed = {
'bash',
'c',
'diff',
'html',
'lua',
'luadoc',
'markdown',
'markdown_inline',
'query',
'vim',
'vimdoc',
'javascript',
'typescript',
'jsdoc',
},
-- Autoinstall languages that are not installed -- Autoinstall languages that are not installed
auto_install = true, auto_install = true,
highlight = { highlight = {
@ -913,5 +929,8 @@ require('lazy').setup({
}, },
}) })
-- Setup python provider
vim.g.python3_host_prog = '$HOME/.asdf/shims/python'
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View File

@ -0,0 +1,13 @@
return {
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
build = ':Copilot auth',
opts = {
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
},
}

View File

@ -0,0 +1,29 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
options = {
icons_enabled = vim.g.have_nerd_font,
theme = 'auto',
-- Sections
section_separators = '',
component_separators = '|',
},
sections = {
lualine_a = { 'branch', { 'diff', colored = false } },
lualine_b = { { 'diagnostics', sources = { 'nvim_diagnostic' } } },
lualine_c = { { 'filename', file_status = true, newfile_status = true, path = 0 } },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = {
{
require('noice').api.status.mode.get,
cond = require('noice').api.status.mode.has,
color = { fg = '#ff9e64' },
},
'mode',
},
lualine_z = { 'location' },
},
},
}

View File

@ -0,0 +1,27 @@
return {
'folke/noice.nvim',
event = 'VeryLazy',
opts = {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
cmdline = {
view = 'cmdline',
},
presets = {
long_message_to_split = false, -- long messages will be sent to a split
inc_rename = true, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
'MunifTanjim/nui.nvim',
},
}

View File

@ -0,0 +1,47 @@
return {
'folke/trouble.nvim',
cmd = { 'Trouble' },
opts = {
modes = {
lsp = {
win = { position = 'right' },
},
},
},
keys = {
{ '<leader>xx', '<cmd>Trouble diagnostics toggle<cr>', desc = 'Diagnostics (Trouble)' },
{ '<leader>xX', '<cmd>Trouble diagnostics toggle filter.buf=0<cr>', desc = 'Buffer Diagnostics (Trouble)' },
{ '<leader>cs', '<cmd>Trouble symbols toggle<cr>', desc = 'Symbols (Trouble)' },
{ '<leader>cS', '<cmd>Trouble lsp toggle<cr>', desc = 'LSP references/definitions/... (Trouble)' },
{ '<leader>xL', '<cmd>Trouble loclist toggle<cr>', desc = 'Location List (Trouble)' },
{ '<leader>xQ', '<cmd>Trouble qflist toggle<cr>', desc = 'Quickfix List (Trouble)' },
{
'[q',
function()
if require('trouble').is_open() then
require('trouble').prev { skip_groups = true, jump = true }
else
local ok, err = pcall(vim.cmd.cprev)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = 'Previous Trouble/Quickfix Item',
},
{
']q',
function()
if require('trouble').is_open() then
require('trouble').next { skip_groups = true, jump = true }
else
local ok, err = pcall(vim.cmd.cnext)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = 'Next Trouble/Quickfix Item',
},
},
}

View File

@ -1,6 +1,11 @@
return { return {
'vim-test/vim-test', 'vim-test/vim-test',
opts = {}, lazy = false,
config = function()
require('which-key').add {
{ '<leader>r', name = '[R]un tests', desc = 'which_key_ignore' },
}
end,
keys = { keys = {
{ {
'<leader>rt', '<leader>rt',

View File

@ -0,0 +1,5 @@
return {
'lervag/vimtex',
lazy = false,
opt = {},
}

View File

@ -0,0 +1,12 @@
-- if true then
-- return {}
-- end
return {
'gelguy/wilder.nvim',
opts = {},
config = function()
local wilder = require 'wilder'
wilder.setup { modes = { ':', '/', '?' } }
end,
}

View File

@ -0,0 +1,6 @@
return {
'folke/zen-mode.nvim',
opts = {
-- pass
},
}

View File

@ -22,7 +22,60 @@ return {
'jay-babu/mason-nvim-dap.nvim', 'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here -- Add your own debuggers here
'leoluz/nvim-dap-go', 'mfussenegger/nvim-dap-python',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
}, },
keys = { keys = {
-- Basic debugging keymaps, feel free to change to your liking! -- Basic debugging keymaps, feel free to change to your liking!
@ -94,7 +147,7 @@ return {
-- online, please don't ask me how to install them :) -- online, please don't ask me how to install them :)
ensure_installed = { ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want -- Update this to ensure that you have the debuggers for the langs you want
'delve', 'debugpy',
}, },
} }
@ -120,6 +173,27 @@ return {
}, },
} }
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
-- Basic debugging keymaps, feel free to change to your liking!
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
vim.keymap.set('n', '<leader>B', function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end, { desc = 'Debug: Set Breakpoint' })
-- Change breakpoint icons -- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
@ -136,12 +210,12 @@ return {
dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config dap.configurations.python = {
require('dap-go').setup { {
delve = { type = 'python',
-- On Windows delve must be run attached or it crashes. request = 'launch',
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring name = 'Launch file',
detached = vim.fn.has 'win32' == 0, program = '${file}',
}, },
} }
end, end,

View File

@ -6,6 +6,30 @@ return {
{ {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
opts = { opts = {
current_line_blame = true,
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 300,
ignore_whitespace = false,
virt_text_priority = 100,
},
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '' },
topdelete = { text = '' },
changedelete = { text = '' },
untracked = { text = '' },
},
signs_staged = {
add = { text = '' },
change = { text = '' },
delete = { text = '' },
topdelete = { text = '' },
changedelete = { text = '' },
},
on_attach = function(bufnr) on_attach = function(bufnr)
local gitsigns = require 'gitsigns' local gitsigns = require 'gitsigns'

View File

@ -8,6 +8,7 @@ return {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim', 'MunifTanjim/nui.nvim',
'3rd/image.nvim',
}, },
cmd = 'Neotree', cmd = 'Neotree',
keys = { keys = {
@ -21,5 +22,33 @@ return {
}, },
}, },
}, },
default_component_configs = {
name = {
trailing_slash = true,
use_git_status_colors = true,
highlight = 'NeoTreeFileName',
},
git_status = {
symbols = {
-- Change type
added = '', -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = '', -- or "", but this is redundant info if you use git_status_colors on the name
deleted = '', -- this can only be used in the git_status source
renamed = '󰁕', -- this can only be used in the git_status source
-- Status type
untracked = '',
ignored = '',
unstaged = '󰄱',
staged = '',
conflict = '',
},
},
indent = {
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = '',
expander_expanded = '',
expander_highlight = 'NeoTreeExpander',
},
},
}, },
} }