This commit is contained in:
Lucas F. 2024-12-10 19:29:04 -03:00
commit 8cc59af68e
37 changed files with 72435 additions and 0 deletions

89
lua/plugins/astrocore.lua Normal file
View file

@ -0,0 +1,89 @@
local listchars = function() vim.opt.listchars:append "space:⋅" end
---@type LazySpec
return {
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
features = {
large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
autopairs = true, -- enable autopairs at start
cmp = true, -- enable completion at start
diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on)
highlighturl = true, -- highlight URLs at start
notifications = true, -- enable notifications at start
},
diagnostics = {
virtual_text = true,
underline = true,
},
options = {
opt = { -- vim.opt.<key>
relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number
spell = false, -- sets vim.opt.spell
signcolumn = "yes", -- sets vim.opt.signcolumn to yes
wrap = false, -- sets vim.opt.wrap
rnu = true,
autoindent = true,
list = true,
timeoutlen = 100,
updatetime = 50,
tabstop = 4,
softtabstop = 4,
shiftwidth = 4,
},
g = { -- vim.g.<key>
autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
cmp_enabled = true, -- enable completion at start
autopairs_enabled = true, -- enable autopairs at start
diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on)
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
},
listchars(), -- comment this line if you don't want to render dots for empty spaces
},
mappings = {
-- first key is the mode
n = {
-- navigate buffer tabs
["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" },
["[b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
["<Leader>bd"] = {
function()
require("astroui.status.heirline").buffer_picker(
function(bufnr) require("astrocore.buffer").close(bufnr) end
)
end,
desc = "Close buffer from tabline",
},
},
},
autocmds = {
set_templ_to_format = {
{
event = { "BufEnter" },
desc = "Set templ filetype to format",
pattern = "*.templ",
callback = function() vim.bo.filetype = "templ" end,
},
},
set_html_to_format = {
{
event = { "BufReadPost" },
desc = "Set html filetype to htmldjango format",
pattern = "*.html",
callback = function() vim.bo.filetype = "htmldjango" end,
},
},
highlight_yank = {
{
event = { "TextYankPost" },
desc = "Highlight on yank",
callback = function() vim.highlight.on_yank() end,
}
},
},
},
}

99
lua/plugins/astrolsp.lua Normal file
View file

@ -0,0 +1,99 @@
---@type LazySpec
return {
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = {
-- Configuration table of features provided by AstroLSP
features = {
autoformat = true, -- enable or disable auto formatting on start
codelens = true, -- enable/disable codelens refresh on start
inlay_hints = false, -- enable/disable inlay hints on start
semantic_tokens = true, -- enable/disable semantic token highlighting
},
-- customize lsp formatting options
formatting = {
-- control auto formatting on save
format_on_save = {
enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
"go",
"python",
"rust",
},
ignore_filetypes = { -- disable format on save for specified filetypes
-- "python",
"htmldjango",
"html",
},
},
disabled = { -- disable formatting capabilities for the listed language servers
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
-- "lua_ls",
},
timeout_ms = 10000, -- default format timeout
-- filter = function(client) -- fully override the default formatting function
-- return true
-- end
},
-- enable servers that you already have installed without mason
servers = {
-- "pyright"
},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
-- clangd = { capabilities = { offsetEncoding = "utf-8" } },
},
-- customize how language servers are attached
handlers = {
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
-- function(server, opts) require("lspconfig")[server].setup(opts) end
-- the key is the server that is being setup with `lspconfig`
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
},
autocmds = {
lsp_document_highlight = {
cond = "textDocument/documentHighlight",
{
event = { "CursorHold", "CursorHoldI" },
desc = "Document Highlighting",
callback = function() vim.lsp.buf.document_highlight() end,
},
{
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
desc = "Document Highlighting Clear",
callback = function() vim.lsp.buf.clear_references() end,
},
},
lsp_codelens_refresh = {
cond = "textDocument/codeLens",
{
event = { "InsertLeave", "BufEnter" },
desc = "Refresh codelens (buffer)",
callback = function(args)
if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end
end,
},
},
},
mappings = {
n = {
gD = {
function() vim.lsp.buf.declaration() end,
desc = "Declaration of current symbol",
cond = "textDocument/declaration",
},
["<Leader>uY"] = {
function() require("astrolsp.toggles").buffer_semantic_tokens() end,
desc = "Toggle LSP semantic highlight (buffer)",
cond = function(client)
return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil
end,
},
},
},
on_attach = function(client, bufnr) end,
},
}

31
lua/plugins/astroui.lua Normal file
View file

@ -0,0 +1,31 @@
return {
"AstroNvim/astroui",
---@type AstroUIOpts
opts = {
-- change colorscheme
colorscheme = "astrodark",
-- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
highlights = {
init = { -- this table overrides highlights in all themes
-- Normal = { bg = "#000000" },
},
astrodark = { -- a table of overrides/changes when applying the astrotheme theme
-- Normal = { bg = "#000000" },
},
},
-- Icons can be configured throughout the interface
icons = {
-- configure the loading of the lsp in the status line
LSPLoading1 = "",
LSPLoading2 = "",
LSPLoading3 = "",
LSPLoading4 = "",
LSPLoading5 = "",
LSPLoading6 = "",
LSPLoading7 = "",
LSPLoading8 = "",
LSPLoading9 = "",
LSPLoading10 = "",
},
},
}

10
lua/plugins/dadbod.lua Normal file
View file

@ -0,0 +1,10 @@
return {
"kristijanhusak/vim-dadbod-ui",
dependencies = {
{ "tpope/vim-dadbod", lazy = true },
-- { "kristijanhusak/vim-dadbod-completion", lazy = true },
},
init = function()
vim.g.db_ui_use_nerd_fonts = 1
end,
}

57
lua/plugins/dial.lua Normal file
View file

@ -0,0 +1,57 @@
return {
{
"monaqa/dial.nvim",
config = function()
local augend = require "dial.augend"
require("dial.config").augends:register_group {
default = {
augend.constant.new {
elements = { "and", "or" },
word = true,
cyclic = true,
},
augend.constant.new {
elements = { "true", "false" },
word = true,
cyclic = true,
},
augend.constant.new {
elements = { "True", "False" },
word = true,
cyclic = true,
},
augend.constant.new {
elements = { "&&", "||" },
word = false,
cyclic = true,
},
augend.constant.new {
elements = { "&", "|" },
word = false,
cyclic = true,
},
augend.constant.new {
elements = { "y/n", "n/y" },
word = false,
cyclic = true,
},
augend.constant.new {
elements = { "yes", "no" },
word = false,
cyclic = true,
},
augend.constant.new {
elements = { "get", "post", "put", "patch", "delete" },
word = false,
cyclic = true,
},
augend.constant.new {
elements = { "GET", "POST", "PUT", "PATCH", "DELETE" },
word = false,
cyclic = true,
},
},
}
end,
},
}

8
lua/plugins/django.lua Normal file
View file

@ -0,0 +1,8 @@
return {
{
"https://git.lucasf.dev/public/django.nvim",
config = function()
local django = require("django").setup()
end
}
}

133
lua/plugins/mappings.lua Normal file
View file

@ -0,0 +1,133 @@
local astro = require "astrocore"
return {
{
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
mappings = {
n = {
--essentials
["d"] = { "_d" },
["<esc>"] = { "<Nop>" },
["<C-z>"] = { "<Nop>" },
["G"] = { "Gzz" },
["<C-t>"] = { "ggVG<cr>", desc = "select all" },
["<leader>W"] = { "<cmd>w<cr>", desc = "Save" },
["<S-s>"] = { "ciw", desc = "replace word" },
["<S-r>"] = { "cc", desc = "replace line" },
["<M-s>"] = { "viw", desc = "select word" },
["<M-y>"] = { "viwy", desc = "copy word" },
["<M-p>"] = { "viwpgvy", desc = "replace word by copied word" },
["<C-n>"] = { require("dial.map").inc_normal(), desc = "dial increment" },
["<A-j>"] = { ":m .+1<CR>==" },
["<A-k>"] = { ":m .-2<CR>==" },
["<M-o>"] = { "o<esc>p" },
["<S-y>"] = { "0v$y", desc = "copy entire row" },
["<C-]>"] = { "<cmd>tabNext<cr>", desc = "move to next Tab" },
["<C-[>"] = { "<cmd>tabprevious<cr>", desc = "move to previous Tab" },
["<CS-]>"] = { "<cmd>cnext<cr>", desc = "next quickfix" },
["<leader>fl"] = { function() require('helpers').oldfiles({}) end, desc = "find oldfiles" },
--git
["<leader>gy"] = { "<cmd>DiffviewFileHistory %<cr>", desc = "Git file diff history" },
["<leader>gY"] = { "<cmd>DiffviewFileHistory<cr>", desc = "Git diff history" },
--tabs
["<tab>"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" },
["<S-tab>"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
["<leader>bt"] = { "<cmd>tabclose<cr>", desc = "Close tab" },
--window moviment
["<C-h>"] = { "<C-w>h", desc = "Go to left window" },
["<C-l>"] = { "<C-w>l", desc = "Go to right window" },
["<C-j>"] = { "<C-w>j", desc = "Go to lower window" },
["<C-k>"] = { "<C-w>k", desc = "Go to upper window" },
-- split window
["|"] = { "<C-w>v", desc = "Vertical Split" },
["\\"] = { "<C-w>s", desc = "Horizontal Split" },
--terminals get or create
-- ["<C-\\>"] = { "<cmd>ToggleTerm<cr>" },
["<C-\\>"] = { function() require("helpers").toggle_term() end, desc = "Toggle Terminal" },
["<c-;>"] = { function() require("helpers").select_terminal() end, desc = "List All opened terminals" },
["<M-1>"] = {
function() require("helpers").term_horizontal() end,
desc = "Horizontal Terminal",
},
["<M-2>"] = {
function() require("helpers").term_vertical() end,
desc = "Vertical Terminal",
},
["<M-3>"] = {
function() require("helpers").term_float() end,
desc = "Float Terminal",
},
--buffers
["<leader>b"] = { name = "Buffers" },
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
-- navigate buffer tabs with `H` and `L`
L = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" },
H = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
["<Leader>bD"] = {
function()
require("astroui.status.heirline").buffer_picker(
function(bufnr) require("astrocore.buffer").close(bufnr) end
)
end,
desc = "Pick to close",
},
--user extra commands
["<leader>kd"] = {desc =" Database commands"},
["<leader>kdu"] = {"<cmd>DBUIToggle<cr>",desc ="Toggle ui"},
["<leader>kda"] = {"<cmd>DBUIAddConnection<cr>",desc ="Add connection"},
["<leader>k"] = { desc = " User extra commands" },
["<leader>kr"] = { "<cmd>lua require('helpers').openMDfile()<cr>", desc = "Open md file in glow" },
["<leader>km"] = {
"<cmd>lua require('helpers').openMDfile(\"com.github.marktext.marktext\")<cr>",
desc = "Open md file in MarkText",
},
["<leader>kj"] = { "<cmd>set ft=htmldjango<cr>", desc = "set ft=htmldjango" },
["<leader>kh"] = { "<cmd>set ft=html<cr>", desc = "set ft=html" },
["<leader>kt"] = { "<cmd>set ft=templ<cr>", desc = "set ft=templ" },
["<leader>ke"] = {"<cmd>redir! > error_messages | silent messages | redir END | edit!<CR>", desc = "Create error_messages file with vim messages"},
--terminal compile sass to css
["<leader>ts"] = {
function() require("helpers").compile_sass() end,
desc = "compile sass to css.",
},
--python test
["<leader>T"] = { desc = "󰌠 Tests" },
["<leader>Tr"] = { "<cmd>lua require('neotest').run.run()<cr>", desc = "Run test" },
["<leader>Tf"] = { "<cmd>lua require('neotest').run.run(vim.fn.expand('%'))<cr>", desc = "Run test expand" },
["<leader>Td"] = { "<cmd>lua require('neotest').run.run({strategy = 'dap'})<cr>", desc = "Run test dap" },
["<leader>Ts"] = { "<cmd>lua require('neotest').summary.toggle()<cr>", desc = "Toggle test summary" },
["<leader>Tp"] = { "<cmd>lua require('neotest').output_panel.toggle()<cr>", desc = "Toggle output panel" },
--trouble
["<leader>xx"] = { function() require("trouble").toggle() end, desc = "Trouble toggle" },
["<leader>xw"] = {
function() require("trouble").toggle "workspace_diagnostics" end,
desc = "Trouble Workspace",
},
["<leader>xd"] = {
function() require("trouble").toggle "document_diagnostics" end,
desc = "Trouble Document",
},
["<leader>xq"] = { function() require("trouble").toggle "quickfix" end, desc = "Trouble Quickfix" },
["<leader>xl"] = { function() require("trouble").toggle "loclist" end, desc = "Trouble Location" },
["gR"] = { function() require("trouble").toggle "lsp_references" end, desc = "Trouble LSP References" },
},
t = {
["<C-\\>"] = { "<cmd>ToggleTerm<cr>" },
},
v = {
["<S-s>"] = { "ciw", desc = "select word" },
["<"] = { "<gv" },
[">"] = { ">gv" },
["p"] = { "pgvy" },
["d"] = { "_d" },
},
x = {
["<A-j>"] = { ":m '>+1<CR>gv-gv" },
["<A-k>"] = { ":m '<-2<CR>gv-gv" },
},
},
},
},
}

56
lua/plugins/mason.lua Normal file
View file

@ -0,0 +1,56 @@
---@type LazySpec
return {
{
"neovim/nvim-lspconfig",
config = function()
require("lspconfig").pyright.setup {
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "workspace",
useLibraryCodeForTypes = true,
typeCheckingMode = "off",
},
},
},
}
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = {
ensure_installed = {
"lua_ls",
"pyright",
"html",
"jsonls",
"cssls",
"gopls",
"bashls",
"tailwindcss",
"templ",
},
},
},
{
"jay-babu/mason-null-ls.nvim",
opts = {
ensure_installed = {
"prettier",
"stylua",
"djlint",
"isort",
"black",
},
},
},
{
"jay-babu/mason-nvim-dap.nvim",
opts = {
ensure_installed = {
"python",
},
},
},
}

152
lua/plugins/neotree.lua Normal file
View file

@ -0,0 +1,152 @@
local get_icon = require("astroui").get_icon
return {
"nvim-neo-tree/neo-tree.nvim",
dependencies = { "MunifTanjim/nui.nvim" },
cmd = "Neotree",
opts = {
auto_clean_after_session_restore = true,
close_if_last_window = false,
source_selector = {
winbar = false,
content_layout = "center",
},
default_component_configs = {
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
modified = { symbol = get_icon "FileModified" },
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
added = get_icon "GitAdd",
deleted = get_icon "GitDelete",
modified = get_icon "GitChange",
renamed = get_icon "GitRenamed",
untracked = "",
ignored = get_icon "GitIgnored",
unstaged = get_icon "GitUnstaged",
staged = get_icon "GitStaged",
conflict = get_icon "GitConflict",
},
},
},
window = {
width = 35,
mappings = {
["<space>"] = false, -- disable space until we figure out which-key disabling
["[b"] = "prev_source",
["]b"] = "next_source",
o = "open",
O = "system_open",
h = "parent_or_close",
l = "child_or_open",
Y = "copy_selector",
},
},
filesystem = {
filtered_items = {
visible = true, -- when true, they will just be displayed differently than normal items
hide_dotfiles = false,
hide_gitignored = false,
hide_hidden = false, -- only works on Windows for hidden files/directories
hide_by_name = {
--"node_modules"
},
hide_by_pattern = { -- uses glob style patterns
--"*.meta",
--"*/src/*/tsconfig.json",
"*_templ.go",
},
always_show = { -- remains visible even if other settings would normally hide it
--".gitignored",
},
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
--".DS_Store",
--"thumbs.db"
},
never_show_by_pattern = { -- uses glob style patterns
--".null-ls_*",
},
},
follow_current_file = {
enabled = true,
},
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true,
commands = {
delete = function(state)
local tree = state.tree
local node = tree:get_node()
local log = require "neo-tree.log"
local inputs = require "neo-tree.ui.inputs"
local msg = string.format("Are you sure you want to delete '%s'?", node.name)
local do_delete_ = function(confirmed)
if not confirmed then return end
vim.fn.system { "gio", "trash", node.path }
end
if node.type == "file" or node.type == "directory" then
inputs.confirm(msg, do_delete_)
else
log.warn "The `delete` command can only be used on files and directories"
end
end,
delete_visual = function(state, selected_nodes)
local paths_to_delete = {}
local inputs = require "neo-tree.ui.inputs"
for _, node_to_delete in pairs(selected_nodes) do
if node_to_delete.type == "file" or node_to_delete.type == "directory" then
table.insert(paths_to_delete, node_to_delete.path)
end
end
local msg = "Are you sure you want to delete " .. #paths_to_delete .. " items?"
local do_delete_ = function(confirmed)
if not confirmed then return end
for _, path in pairs(paths_to_delete) do
vim.fn.system { "gio", "trash", path }
end
end
inputs.confirm(msg, do_delete_)
end,
},
},
buffers = {
follow_current_file = {
enabled = true,
}, -- This will find and focus the file in the active buffer every
-- time the current file is changed while the tree is open.
group_empty_dirs = true, -- when true, empty folders will be grouped together
show_unloaded = true,
window = {
mappings = {
["bd"] = "buffer_delete",
["<bs>"] = "navigate_up",
["."] = "set_root",
},
},
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function(_) vim.opt_local.signcolumn = "auto" end,
},
},
},
}

24
lua/plugins/none-ls.lua Normal file
View file

@ -0,0 +1,24 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
-- Customize None-ls sources
---@type LazySpec
return {
"nvimtools/none-ls.nvim",
opts = function(_, opts)
-- opts variable is the default configuration table for the setup function call
-- local null_ls = require "null-ls"
-- Check supported formatters and linters
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
-- Only insert new sources, do not replace the existing ones
-- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function)
opts.sources = require("astrocore").list_insert_unique(opts.sources, {
-- Set a formatter
-- null_ls.builtins.formatting.stylua,
-- null_ls.builtins.formatting.prettier,
})
end,
}

View file

@ -0,0 +1,31 @@
---@type LazySpec
return {
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"lua",
"vim",
"python",
"comment",
"dockerfile",
"bash",
"css",
"scss",
"gitcommit",
"gitignore",
"gitattributes",
"html",
"htmldjango",
"javascript",
"json",
"markdown",
"mermaid",
"sql",
"toml",
"vim",
"yaml",
"go",
"templ",
},
},
}

252
lua/plugins/user.lua Normal file
View file

@ -0,0 +1,252 @@
---@type LazySpec
return {
{
"goolord/alpha-nvim",
opts = function(_, opts)
opts.section.header.val = {
" .-=*##%%+=* **+@@%%#+-: ",
" -%@@@@@@@%++--: ---++#@@@@@@@@+ ",
" *@@@@@@@@@@@@@@@%- =%@@@@@@@@@@@@@@@* ",
" .@@@@@@@@#@@@@@@@@#. .#@@@@@@@@#@@@@@@@@: ",
" =@@@@@@%=-*@@@%%@@@- -@@@%%@@@*-=#@@@@@@* ",
" %@@@@@%-+--*%+--*@@+ +@@*=-=%*--+=*@@@@@@. ",
" -@@@@@@--*+-------+#* *%+-------=*--#@@@@@= ",
" +@@@%=---++--------=- ==--------++----#@@@# ",
" #@@------=+---------.=---------+=------@@% ",
" #@--------+--------=---------+=-------%%. ",
" +*----=+**#=------=--------#**++----+* ",
" -#+-------==-----=------=+-------=#= ",
" +%=------=+----------==-------## ",
" -%+------=*---.:---+=------=@= ",
" : :-----*-. .-*=----:. .. ",
" ..:::::.-: .-.:::::.. ",
" ",
"██╗ ██╗██╗ ██╗██████╗ ██╗ ██╗███╗ ██╗██╗ ██╗██╗███╗ ███╗",
"██║ ██╔╝██║ ██║██╔══██╗██║ ██║████╗ ██║██║ ██║██║████╗ ████║",
"█████╔╝ ██║ ██║██████╔╝██║ ██║██╔██╗ ██║██║ ██║██║██╔████╔██║",
"██╔═██╗ ██║ ██║██╔══██╗██║ ██║██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║",
"██║ ██╗╚██████╔╝██║ ██║╚██████╔╝██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║",
"╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
}
return opts
end,
},
{
"L3MON4D3/LuaSnip",
config = function(plugin, opts)
require "astronvim.plugins.configs.luasnip"(plugin, opts)
local luasnip = require "luasnip"
luasnip.filetype_extend("javascript", { "javascriptreact" })
require("luasnip.loaders.from_lua").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load {
paths = vim.fn.stdpath "config" .. "/lua/snippets",
}
require("luasnip.loaders.from_snipmate").lazy_load()
end,
},
{
"windwp/nvim-autopairs",
config = function(plugin, opts)
require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts)
local npairs = require "nvim-autopairs"
local Rule = require "nvim-autopairs.rule"
local cond = require "nvim-autopairs.conds"
npairs.add_rules(
{
Rule("$", "$", { "tex", "latex" })
-- don't add a pair if the next character is %
:with_pair(cond.not_after_regex "%%")
-- don't add a pair if the previous character is xxx
:with_pair(
cond.not_before_regex("xxx", 3)
)
-- don't move right when repeat character
:with_move(cond.none())
-- don't delete if the next character is xx
:with_del(cond.not_after_regex "xx")
-- disable adding a newline when you press <cr>
:with_cr(cond.none()),
},
-- disable for .vim files, but it work for another filetypes
Rule("a", "a", "-vim")
)
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
dependencies = { "nvim-dap" },
opts = function(_, opts)
local venv_path = os.getenv "VIRTUAL_ENV" or os.getenv "CONDA_PREFIX"
require "astronvim."
opts.ensure_installed = require("astrocore").extend_tbl(opts.ensure_installed, {
"python",
"stylua",
"delve",
})
opts.handlers = {
function(config)
require("mason-nvim-dap").default_setup(config)
end,
python = function(config)
config.adapters = {
type = "executable",
command = vim.fn.exepath "debugpy-adapter",
}
config.configurations = {
{
type = "python",
request = "launch",
name = "Python: Django",
program = "${workspaceFolder}/manage.py",
pythonPath = venv_path and (venv_path .. "/bin/python") or nil,
console = "integratedTerminal",
args = { "runserver", "--noreload", "--nothreading" },
django = true,
justMyCode = false,
},
{
type = "python",
request = "launch",
name = "Python: Launch file",
program = "${file}",
pythonPath = venv_path and (venv_path .. "/bin/python") or nil,
console = "integratedTerminal",
},
{
type = "python",
request = "launch",
name = "Python: Launch package",
program = "${workspaceFolder}/main.py",
pythonPath = venv_path and (venv_path .. "/bin/python") or nil,
console = "integratedTerminal",
},
}
require("mason-nvim-dap").default_setup(config) -- don't forget this!
end,
}
end,
},
{
"mattn/emmet-vim",
lazy = false,
},
{
"vim-test/vim-test",
},
{
"nvim-neotest/neotest",
dependencies = {
"vim-test/vim-test",
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-python",
},
opts = function(_, opts)
local venv_path = os.getenv "VIRTUAL_ENV" or os.getenv "CONDA_PREFIX"
opts.adapters = {
require "neotest-python" {
dap = {
justMyCode = false,
program = "${workspaceFolder}/manage.py",
python = venv_path and (venv_path .. "/bin/python") or nil,
args = { "test" },
},
runner = "pytest",
is_test_file = function(file_path)
if file_path:match "tests.py" or file_path:match "test_.+.py$" or file_path:match "^.+_tests.py$" then
return file_path
end
end,
},
}
end,
keys = {
{
"<M-t>",
function() require("neotest").summary.toggle() end,
desc = "Toggle test summary",
},
},
},
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = function(_, opts)
opts.keywords = {
FIX = {
icon = "", -- icon used for the sign, and in search results
color = "error", -- can be a hex color, or a named color (see below)
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
},
TODO = { icon = "", color = "info" },
HACK = { icon = "", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "XXX" } },
PERF = { icon = "󰑮 ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "󱝿 ", color = "hint", alt = { "NOTE" } },
TEST = { icon = "󰙨 ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
}
opts.signs = true
opts.sign_priority = 8
opts.merge_keywords = true
opts.pattern = [[(KEYWORDS):]]
return opts
end,
keys = {
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
},
},
{ "ralismark/nvim-tabletops", lazy = false },
{ "sindrets/diffview.nvim", lazy = false },
{ "theHamsta/nvim-dap-virtual-text" },
{
"laytan/cloak.nvim",
lazy = false,
opts = {
enabled = true,
cloak_character = "🔐",
highlight_group = "Comment",
cloak_length = 1,
try_all_patterns = true,
patterns = {
{
file_pattern = ".env*",
cloak_pattern = "=.+",
replace = nil,
},
},
},
},
{
"Exafunction/codeium.vim",
enabled=false,
event = "BufEnter",
config = function()
vim.keymap.set("i", "<C-g>", function() return vim.fn["codeium#Accept"]() end, { expr = true, silent = true })
vim.keymap.set(
"i",
"<c-;>",
function() return vim.fn["codeium#CycleCompletions"](1) end,
{ expr = true, silent = true }
)
vim.keymap.set(
"i",
"<c-,>",
function() return vim.fn["codeium#CycleCompletions"](-1) end,
{ expr = true, silent = true }
)
vim.keymap.set("i", "<c-x>", function() return vim.fn["codeium#Clear"]() end, { expr = true, silent = true })
end,
},
{
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {},
},
{
"mbbill/undotree",
config = function() vim.keymap.set("n", "<leader>ku", vim.cmd.UndotreeToggle) end,
}
}