feat(working): first working condition

This commit is contained in:
darwincereska
2025-11-19 08:59:51 -05:00
parent 5a5c81eb60
commit c86f52f5fb
31 changed files with 789 additions and 283 deletions

View File

@@ -1,7 +1,80 @@
return {
"windwp/nvim-autopairs",
lazy = false,
priority = 1000,
event = "InsertEnter",
config = true,
'windwp/nvim-autopairs',
event = "InsertEnter",
dependencies = { 'nvim-treesitter/nvim-treesitter' },
config = function()
local npairs = require('nvim-autopairs')
local Rule = require('nvim-autopairs.rule')
local cond = require('nvim-autopairs.conds')
npairs.setup({
check_ts = true, -- Enable treesitter integration
ts_config = {
lua = {'string', 'source'},
kotlin = {'string', 'comment'},
java = {'string', 'comment'},
},
disable_filetype = { "TelescopePrompt", "spectre_panel" },
disable_in_macro = false,
disable_in_visualblock = false,
disable_in_replace_mode = true,
ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=],
enable_moveright = true,
enable_afterquote = true,
enable_check_bracket_line = false,
enable_bracket_in_quote = true,
enable_abbr = false,
break_undo = true,
map_cr = true,
map_bs = true,
map_c_h = false,
map_c_w = false,
-- Fast wrap feature - press Alt+e to wrap selection
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = [=[[%'%"%>%]%)%}%,]]=],
offset = 0,
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'PmenuSel',
highlight_grey = 'LineNr'
},
})
-- Custom rules for better Kotlin support
npairs.add_rules({
-- Add spaces inside brackets for function calls
Rule(' ', ' ')
:with_pair(function(opts)
local pair = opts.line:sub(opts.col - 1, opts.col)
return vim.tbl_contains({ '()', '[]', '{}' }, pair)
end),
-- Don't pair quotes after backslash
Rule('"', '"', 'kotlin')
:with_pair(cond.not_before_regex('\\', 1)),
-- Smart pairing for lambda expressions
Rule('{', '}', 'kotlin')
:with_pair(function(opts)
-- Don't autopair if we're after forEach, let, etc.
local line = opts.line:sub(1, opts.col - 1)
if line:match('forEach%s*$') or line:match('let%s*$') or line:match('run%s*$') then
return false
end
return true
end),
})
-- Integration with nvim-cmp if you have it
local cmp_status_ok, cmp = pcall(require, "cmp")
if cmp_status_ok then
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end
end
}

View File

@@ -2,6 +2,34 @@ return {
"numToStr/Comment.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("config.plugin.comment")
require("Comment").setup({
-- Add a space b/w comment and the line
padding = true,
-- Whether the cursor should stay at its position
sticky = true,
-- Lines to be ignored while (un)comment
ignore = nil,
-- LHS of toggle mappings in NORMAL mode
toggler = {
line = 'gcc', -- Line-comment toggle keymap
block = 'gbc', -- Block-comment toggle keymap
},
-- LHS of operator-pending mappings in NORMAL and VISUAL mode
opleader = {
line = 'gc', -- Line-comment keymap
block = 'gb', -- Block-comment keymap
},
-- LHS of extra mappings
extra = {
above = 'gcO', -- Add comment on the line above
below = 'gco', -- Add comment on the line below
eol = 'gcA', -- Add comment at the end of line
},
-- Enable keybindings
mappings = {
basic = true, -- Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
extra = true, -- Extra mapping; `gco`, `gcO`, `gcA`
},
})
end,
}

View File

@@ -0,0 +1,20 @@
return {
"norcalli/nvim-colorizer.lua",
event = { "BufReadPost", "BufNewFile" }, -- load on file open
config = function()
require("colorizer").setup(
{ "*" }, -- highlight colors in all files
{
RGB = true, -- #RGB
RRGGBB = true, -- #RRGGBB
names = true, -- CSS color names
RRGGBBAA = true, -- #RRGGBBAA
rgb_fn = true, -- css rgb() functions
hsl_fn = true, -- css hsl() functions
css = true, -- enable all css features
css_fn = true, -- enable all css functions
}
)
end,
}

67
lua/plugins/dressing.lua Normal file
View File

@@ -0,0 +1,67 @@
return {
"stevearc/dressing.nvim",
event = "VeryLazy",
config = function()
require("dressing").setup({
input = {
enabled = true,
default_prompt = "Input:",
prompt_align = "left",
insert_only = true,
start_in_insert = true,
border = "rounded",
relative = "cursor",
prefer_width = 40,
width = nil,
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
win_options = {
winblend = 0,
wrap = false,
},
mappings = {
n = {
["<Esc>"] = "Close",
["<CR>"] = "Confirm",
},
i = {
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
["<Up>"] = "HistoryPrev",
["<Down>"] = "HistoryNext",
},
},
},
select = {
enabled = true,
backend = { "telescope", "builtin", "nui" },
trim_prompt = true,
telescope = require("telescope.themes").get_dropdown({
borderchars = {
prompt = { "", "", " ", "", "", "", "", "" },
results = { "", "", "", "", "", "", "", "" },
preview = { "", "", "", "", "", "", "", "" },
},
width = 0.8,
previewer = false,
prompt_title = false,
}),
builtin = {
border = "rounded",
relative = "editor",
win_options = {
winblend = 0,
cursorline = true,
cursorlineopt = "both",
},
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
},
},
})
end,
}

46
lua/plugins/flash.lua Normal file
View File

@@ -0,0 +1,46 @@
return {
"folke/flash.nvim",
event = "VeryLazy",
opts = {
labels = "asdfghjklqwertyuiopzxcvbnm",
search = {
multi_window = true,
forward = true,
wrap = true,
mode = "exact",
incremental = false,
},
jump = {
jumplist = true,
pos = "start",
history = false,
register = false,
nohlsearch = false,
autojump = false,
},
label = {
uppercase = true,
rainbow = {
enabled = false,
shade = 5,
},
},
modes = {
search = {
enabled = true,
},
char = {
enabled = true,
jump_labels = true,
multi_line = true,
},
},
},
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}

28
lua/plugins/hover.lua Normal file
View File

@@ -0,0 +1,28 @@
return {
"lewis6991/hover.nvim",
config = function()
require("hover").setup {
init = function()
require("hover.providers.lsp")
require('hover.providers.diagnostic')
end,
preview_opts = {
border = 'rounded'
},
preview_window = false,
title = true,
mouse_providers = {
'LSP'
},
mouse_delay = 1000
}
-- Setup the hover on keyboard
vim.keymap.set("n", "K", require("hover").hover, {desc = "hover.nvim"})
vim.keymap.set("n", "gK", require("hover").hover_select, {desc = "hover.nvim (select)"})
-- Mouse hover
vim.keymap.set('n', '<MouseMove>', require('hover').hover_mouse, { desc = "hover.nvim (mouse)" })
vim.o.mousemoveevent = true
end
}

View File

@@ -0,0 +1,9 @@
return {
"smjonas/inc-rename.nvim",
cmd = "IncRename",
config = function()
require("inc_rename").setup({
input_buffer_type = "dressing",
})
end,
}

View File

@@ -0,0 +1,36 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
event = { "BufReadPost", "BufNewFile" },
config = function()
require("ibl").setup({
indent = {
char = "",
tab_char = "",
},
scope = {
enabled = true,
show_start = true,
show_end = false,
injected_languages = true,
highlight = { "Function", "Label" },
priority = 500,
},
exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
},
})
end,
}

View File

@@ -16,6 +16,7 @@ return {
"pyright",
"lua_ls",
"ts_ls",
-- "kotlin_lsp",
},
automatic_installation = true,
})
@@ -23,22 +24,73 @@ return {
},
{
"neovim/nvim-lspconfig",
dependencies = {
dependencies = {
"mason-org/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
},
config = function()
local lspconfig = require("lspconfig")
local cmp_nvim_lsp = require("cmp_nvim_lsp")
-- Enable mouse support
vim.o.mouse = 'a'
vim.o.mousemoveevent = true
local capabilities = cmp_nvim_lsp.default_capabilities()
-- Setup each server
vim.lsp.enable("gopls")
vim.lsp.enable("clangd")
vim.lsp.enable("pyright")
vim.lsp.enable("lua_ls")
vim.lsp.enable("ts_ls")
-- LSP keybindings and settings
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local opts = { buffer = ev.buf }
-- Navigation
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>rn', ':IncRename ', opts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
end,
})
-- Configure diagnostic display
vim.diagnostic.config({
virtual_text = true,
signs = false, -- Disable icons in sign column
underline = true,
update_in_insert = false,
severity_sort = true,
float = {
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})
-- Set up line number highlighting for diagnostics (no icons)
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = "", numhl = hl })
end
-- Setup each server using vim.lsp.config (new API in 0.11+)
local servers = {
"gopls",
"clangd",
"pyright",
"lua_ls",
"ts_ls",
-- "kotlin_lsp",
}
for _, server in ipairs(servers) do
vim.lsp.config(server, {
capabilities = capabilities,
})
vim.lsp.enable(server)
end
end,
},
}

View File

@@ -6,15 +6,81 @@ return {
"nvim-mini/mini.nvim",
},
config = function()
require("config.plugin.render-markdown")
require("render-markdown").setup({
completions = { lsp = { enabled = true } },
heading = {
enabled = true,
sign = false,
icons = { "󰲡 ", "󰲣 ", "󰲥 ", "󰲧 ", "󰲩 ", "󰲫 " },
signs = { ""},
left_pad = 0,
right_pad = 0,
width = "full",
min_width = 0,
border = true,
border_virtual = true,
above = "",
below = "",
},
code = {
enabled = true,
sign = true,
style = "full",
position = "left",
language_pad = 2,
disable_background = { "diff" },
width = "full",
left_pad = 0,
right_pad = 0,
min_width = 0,
border = "thin",
above = "",
below = "",
highlight = "RenderMarkdownCode",
highlight_inline = "RenderMarkdownCodeInline",
},
win_options = {
conceallevel = {
default = vim.o.conceallevel,
rendered = 3,
},
concealcursor = {
default = vim.o.concealcursor,
rendered = "n",
},
},
})
-- Fix tab behavior in markdown files
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function()
vim.opt_local.spell = true
vim.opt_local.spelllang = "en_us"
-- Override tab mapping in markdown files
vim.keymap.set("i", "<Tab>", function()
-- Check if we're in a code block
local line = vim.api.nvim_get_current_line()
local col = vim.api.nvim_win_get_cursor(0)[2]
-- If we're at the beginning of a line or after whitespace, insert tab
if col == 0 or line:sub(1, col):match("^%s*$") then
return "<Tab>"
else
-- Otherwise, let completion handle it if available
if vim.fn.pumvisible() == 1 then
return "<C-n>"
else
return "<Tab>"
end
end
end, { expr = true, buffer = true })
end,
})
end,
},
{

6
lua/plugins/mdx.lua Normal file
View File

@@ -0,0 +1,6 @@
return {
'davidmh/mdx.nvim',
config = function()
require('mdx').setup()
end
}

73
lua/plugins/noice.lua Normal file
View File

@@ -0,0 +1,73 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
config = function()
require("noice").setup({
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,
},
hover = {
enabled = false, -- We're using hover.nvim
},
signature = {
enabled = true,
auto_open = {
enabled = true,
trigger = true,
luasnip = true,
throttle = 50,
},
},
},
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = true, -- add a border to hover docs and signature help
},
views = {
cmdline_popup = {
position = {
row = "50%",
col = "50%",
},
size = {
width = 60,
height = "auto",
},
border = {
style = "rounded",
padding = { 0, 1 },
},
},
popupmenu = {
relative = "editor",
position = {
row = "55%",
col = "50%",
},
size = {
width = 60,
height = 10,
},
border = {
style = "rounded",
padding = { 0, 1 },
},
win_options = {
winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" },
},
},
},
})
end,
}

27
lua/plugins/notify.lua Normal file
View File

@@ -0,0 +1,27 @@
return {
"rcarriga/nvim-notify",
event = "VeryLazy",
config = function()
local notify = require("notify")
notify.setup({
background_colour = "#000000",
fps = 60,
icons = {
DEBUG = "",
ERROR = "",
INFO = "",
TRACE = "",
WARN = ""
},
level = 2,
minimum_width = 50,
render = "compact",
stages = "fade_in_slide_out",
timeout = 3000,
top_down = true,
})
-- Set nvim-notify as the default notification handler
vim.notify = notify
end,
}

View File

@@ -2,10 +2,17 @@ return {
"stevearc/oil.nvim",
---@module "oil"
---@module oil.setupOpts
opts = {},
dependencies = { "nvim-mini/mini.icons" },
lazy = false,
config = function()
require("config.plugin.oil")
require("oil").setup({
default_file_explorer = true,
columns = {
"icon",
},
keymaps = {
["g."] = { "actions.toggle_hidden", mode = "n"}
}
})
end,
}

View File

@@ -2,6 +2,53 @@ return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("config.plugin.statusbar")
require("lualine").setup {
options = {
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = { "NvimTree", "neo-tree", "alpha", "dashboard" },
winbar = { "NvimTree", "neo-tree", "alpha", "dashboard" },
},
ignore_focus = { "NvimTree", "neo-tree" },
always_divide_middle = true,
globalstatus = true, -- This makes lualine span the entire bottom
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = { "mode" }, -- Shows full text like "NORMAL", "INSERT", "VISUAL"
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = {
"filename",
{
function()
return vim.b.table_mode_active == 1 and "[TABLE]" or ""
end,
color = { fg = "#98c379" }, -- Green color
},
},
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = { "nvim-tree", "neo-tree" }
}
end,
}

View File

@@ -2,6 +2,10 @@ return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("config.plugin.telescope")
require("telescope").setup({
defaults = {
file_ignore_patterns = { "node_modules", ".git/" },
},
})
end,
}

View File

@@ -2,6 +2,34 @@ return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("config.plugin.treesitter")
require("nvim-treesitter.configs").setup({
ensure_installed = {
"markdown",
"markdown_inline",
"lua",
"python",
"javascript",
"typescript",
"html",
"css",
"json",
"yaml",
"bash",
"vim",
"c",
"cpp",
"lua",
"go",
"kotlin",
"java"
},
highlight = {
enable = true,
additional_vim_regex_highlighting = { "markdown", "mdx" },
},
indent = {
enable = true,
},
})
end,
}

View File

@@ -3,6 +3,26 @@ return {
dependencies = "kevinhwang91/promise-async",
lazy = false,
config = function()
require("config.plugin.ufo")
-- Basic fold UI
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- Triangles for folds
vim.opt.fillchars = {
foldopen = "",
foldclose = "",
foldsep = " ",
}
require("ufo").setup({
provider_selector = function(bufnr, filetype, buftype)
if filetype == "markdown" then
return { "treesitter", "indent" }
end
return { "lsp", "indent" }
end,
})
end
}

View File

@@ -9,7 +9,32 @@ return {
"MunifTanjim/nui.nvim",
},
config = function()
require("config.plugin.neo-tree")
require("neo-tree").setup({
close_if_last_window = true,
hijack_netrw_behavior = "disabled",
filesystem = {
filtered_items = {
hide_gitignored = true,
hide_hidden = true,
},
follow_current_file = { enabled = true },
},
git_status = {
enable = true,
},
window = {
position = "left",
auto_expand_width = false,
hijack_netrw_behavior = "disabled",
width = 35,
mappings = {
["<space>"] = "toggle_node",
["<2-LeftMouse>"] = "open",
["e"] = function() vim.api.nvim_exec("Neotree focus filesystem", true) end,
["g"] = function() vim.api.nvim_exec("Neotree focus git_status", true) end,
},
},
})
end,
},
}

25
lua/plugins/which-key.lua Normal file
View File

@@ -0,0 +1,25 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
preset = "modern",
delay = 300,
win = {
border = "rounded",
padding = { 1, 2 },
},
layout = {
spacing = 3,
},
spec = {
{ "<leader>c", group = "code" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
{ "<leader>r", group = "rename" },
{ "<leader>t", group = "toggle/table" },
{ "g", group = "goto" },
{ "[", group = "prev" },
{ "]", group = "next" },
},
},
}