This commit is contained in:
Acid
2025-12-11 17:46:34 -05:00
commit e2e6ebd024
18 changed files with 2674 additions and 0 deletions
+274
View File
@@ -0,0 +1,274 @@
require('plugins')
-- General settings
require('options')
-- keymaps
require('keymaps')
--plugin short settings
-- require('lspConfig')
--############
-- # Autorun #
-- ###########
-- remove_trailing_whitespace on save
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*",
callback = function()
require('functions').remove_trailing_whitespace()
end,
})
-- set spelling on these files
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown", "text" },
callback = function()
vim.opt_local.spell = true
end,
})
--############
--# setup #
--###########
-- Font Icons
vim.g.WebDevIconsUnicodeDecorateFolderNodes = 1
-- telescope
require("telescope").setup {
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
},
},
},
}
require("telescope").load_extension("ui-select")
--"''''''''''''''''''nvim-colorizer'''''''''''''''''''''''''''''''''''''
require'colorizer'.setup()
-- this is an autocomand to force colorizer to attach to some files
vim.api.nvim_exec([[
augroup ColorizerAttach
autocmd!
autocmd BufRead,BufNewFile *.config,*.rasi,*.conf,*.qss,*.css :ColorizerAttachToBuffer
augroup END
]], false)
--'''''''''''''' Theme ''''''''''''''''''''''''''''''''''''''''''''''''
local function force_backgraund(color)
color = color or "catppuccin-mocha"
vim.cmd.colorscheme(color)
vim.api.nvim_set_hl(0, "Normal",{bg = "none"} )
vim.api.nvim_set_hl(0, "NormalFloat",{bg = "none"} )
end
force_backgraund()
--"''''''''Neotree''''''''''''''''''''''''''''''''''''''''''''''''''''''''
require("neo-tree").setup({
close_if_last_window = true,
})
--'''''''''''''''''' web-devicons ''''''''''''''''''''''''''''''''''
require('nvim-web-devicons').setup{}
--"''''''''''IndentBlankline''''''''''``````````````````````````````````
require("ibl").setup()
-- '''''''''''''' cmp ''''''''''''''''''''''''''''''''''''''''''''''''
-- Set up nvim-cmp.
local cmp = require'cmp'
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
formatting = {
format = function(_, vim_item)
vim_item.kind = (kind_icons[vim_item.kind] or '') .. vim_item.kind
return vim_item
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = {
['<Down>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
['<C-j>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
['<Up>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
['<C-k>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
},
sources = cmp.config.sources({
{ name = 'luasnip' }, -- For luasnip users.
{ name = 'path' }
},
{
{ name = 'buffer' },
})
})
--'''''''''''''nvim-ts-autotag'''''''''''''''''''''''''''''''''''''''''
require('nvim-ts-autotag').setup({
opts = {
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false -- Auto close on trailing </
},
})
--'''''''''''''''OIL'''''''''''''''''''''''''''''''''''''''''''''''
require("oil").setup({
lsp_file_methods = {
enabled = true,
timeout_ms = 1000,
autosave_changes = false,
}
})
--''''''''''''''''''''''''rainbow'''''''''''''''''''''''''''''''''''''''
require('rainbow-delimiters.setup').setup {
strategy = {
},
query = {
},
highlight = {
},
}
--''''''''''Lualine''''''''''''''''''''''''''''''''''''''''''''''''''''
require('lualine').setup {
options = {
theme = 'catppuccin',
icons_enabled = true,
component_separators = { left = ' ', right = ' ' },
section_separators = { left = '|', right = '|' },
globalstatus = true,
},
sections = {
lualine_z = {
function()
local line = vim.fn.line('.')
local total = vim.fn.line('$')
local percent = math.floor((line / total) * 100)
return string.format("%3d%%%% %d☰", percent, total)
end
}
}
}
--'''''''''Barbar'''''''''''''''''''''''''''''''''''''''''''''''''''
require('barbar').setup({
animation = false,
auto_hide = 1,
tabpages = false,
clickable = true,
icons = {
buffer_index = true,
buffer_number = false,
diagnostics = {
[vim.diagnostic.severity.ERROR] = { enabled = true, icon = '' },
[vim.diagnostic.severity.WARN] = { enabled = true, icon = '' },
[vim.diagnostic.severity.INFO] = { enabled = false },
[vim.diagnostic.severity.HINT] = { enabled = false },
},
filetype = {
enabled = true,
},
separator = { left = '', right = '' },
modified = { button = '' },
pinned = { button = '', filename = true },
},
})
-- ''''''''''''''autopairs'''''''''''''''''''''''''''''''''''''''
local npairs = require("nvim-autopairs")
npairs.setup({
check_ts = true,
ts_config = {
lua = {'string'},-- it will not add a pair on that treesitter node
javascript = {'template_string'},
java = false,-- don't check treesitter on java
},
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = [=[[%'%"%>%]%)%}%,]]=],
end_key = '$',
before_key = 'h',
after_key = 'l',
cursor_pos_before = true,
keys = 'qwertyuiopzxcvbnmasdfghjkl',
manual_position = true,
highlight = 'Search',
highlight_grey='Comment'
},
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
+35
View File
@@ -0,0 +1,35 @@
{
"barbar.nvim": { "branch": "master", "commit": "3a74402bdf04745a762de83d5c5e88e3e9b0e2e0" },
"buffer-vacuum": { "branch": "main", "commit": "33a454b76b2f2a7f51c27cb50ecc9f1d6327a275" },
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"local-highlight.nvim": { "branch": "master", "commit": "272f36f412c0a82c785c01256abf4eda4c1cb11d" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" },
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
"nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" },
"oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"undotree": { "branch": "master", "commit": "7a8b831e9bfb9f6fe05cc33294882648dd6801fb" },
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
"vim-devicons": { "branch": "master", "commit": "71f239af28b7214eebb60d4ea5bd040291fb7e33" },
"vim-floaterm": { "branch": "master", "commit": "fd4bdd66eca56c6cc59f2119e4447496d8cde2ea" },
"vim-signature": { "branch": "master", "commit": "6bc3dd1294a22e897f0dcf8dd72b85f350e306bc" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }
}
+43
View File
@@ -0,0 +1,43 @@
-- To avoid neotree from crashing all vim, closes the tab
local M = {}
function M.bufremove(buf)
buf = buf or 0
buf = buf == 0 and vim.api.nvim_get_current_buf() or buf
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
if choice == 0 or choice == 3 then -- 0 for <Esc>/<C-c> and 3 for Cancel
return
end
if choice == 1 then -- Yes
vim.cmd.write()
end
end
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
vim.api.nvim_win_call(win, function()
if not vim.api.nvim_win_is_valid(win) or vim.api.nvim_win_get_buf(win) ~= buf then
return
end
-- Try using alternate buffer
local alt = vim.fn.bufnr("#")
if alt ~= buf and vim.fn.buflisted(alt) == 1 then
vim.api.nvim_win_set_buf(win, alt)
return
end
-- Try using previous buffer
local has_previous = pcall(vim.cmd, "bprevious")
if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then
return
end
-- Create new listed buffer
local new_buf = vim.api.nvim_create_buf(true, false)
vim.api.nvim_win_set_buf(win, new_buf)
end)
end
if vim.api.nvim_buf_is_valid(buf) then
pcall(vim.cmd, "bdelete! " .. buf)
end
end
return M
+56
View File
@@ -0,0 +1,56 @@
local M = {}
function M.bufonly()
vim.cmd('silent! execute "%bd|e#|bd#"')
end
function M.remove_trailing_whitespace()
local saved_search = vim.fn.getreg('/')
vim.cmd([[%s/\s\+$//e]])
vim.fn.setreg('/', saved_search)
end
-- To avoid neotree from crashing all vim, closes the tab
function M.bufremove(buf)
buf = buf or 0
buf = buf == 0 and vim.api.nvim_get_current_buf() or buf
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel")
if choice == 0 or choice == 3 then -- 0 for <Esc>/<C-c> and 3 for Cancel
return
end
if choice == 1 then -- Yes
vim.cmd.write()
end
end
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
vim.api.nvim_win_call(win, function()
if not vim.api.nvim_win_is_valid(win) or vim.api.nvim_win_get_buf(win) ~= buf then
return
end
-- Try using alternate buffer
local alt = vim.fn.bufnr("#")
if alt ~= buf and vim.fn.buflisted(alt) == 1 then
vim.api.nvim_win_set_buf(win, alt)
return
end
-- Try using previous buffer
local has_previous = pcall(vim.cmd, "bprevious")
if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then
return
end
-- Create new listed buffer
local new_buf = vim.api.nvim_create_buf(true, false)
vim.api.nvim_win_set_buf(win, new_buf)
end)
end
if vim.api.nvim_buf_is_valid(buf) then
pcall(vim.cmd, "bdelete! " .. buf)
end
end
return M
+62
View File
@@ -0,0 +1,62 @@
local opts = { noremap = true, silent = true }
-- Require functions file
local functions = require('functions')
vim.keymap.set("n", "<leader><TAB>", ":bnext<CR>") -- Tab next
vim.keymap.set({"x",'v','n'}, "E", "ge") -- go back
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- move block
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") -- move block
vim.keymap.set("n", "<leader>r", [[:%s#\<<C-r><C-w>\>#<C-r><C-w>#gI<Left><Left><Left>]]) -- global remap
vim.keymap.set("n", "J", "mzJ`z") -- append line
vim.keymap.set("n", "<C-d>", "<C-d>zz") --move half page
vim.keymap.set("n", "<C-u>", "<C-u>zz") --move half page
-- Close all buffers (tabs) but the current one
vim.keymap.set('n', '<leader>b', functions.bufonly, opts)
-- ############################
-- Default behavior overrides #
-- ############################
vim.keymap.set("n", "x", [["_x]]) --void x
vim.keymap.set("x", "p", [["_dP]]) -- void paste
vim.keymap.set('n', 'Q', 'q', opts) -- Remap 'Q' to start recording macros
vim.keymap.set('x', 'W', 'iW', opts) -- remaps viW to just vW
vim.keymap.set('v', 'w', 'iw', opts) -- remaps viw to just vw
vim.keymap.set('n', 'P', 'o<Esc>p', opts) --void P
vim.keymap.set('n', 'd', '"_d', opts) --void d
vim.keymap.set('v', 'd', '"_d', opts)
vim.keymap.set('n', '<leader>d', 'daw', opts)
vim.keymap.set('n', 'cw', 'ciw', { noremap = true, nowait = true, silent = true }) -- cw = ciw
-- Disable
vim.keymap.set({'x','v','n'}, '<F1>', '<Nop>', opts)
vim.keymap.set('n', 's', '<Nop>', opts)
vim.keymap.set('n', 'S', '<Nop>', opts)
vim.keymap.set('n', 'q', '<Nop>', opts)
-- ############################
-- Plugins keymaps #
-- ############################
vim.cmd([[nnoremap \ :Neotree toggle<cr>]])
-- To avoid neotree from crashing all vim, closes the tab
vim.keymap.set("n", "<leader>q", functions.bufremove, { desc = "Delete buffer" })
--telescope
vim.keymap.set('n', '<leader>ff', "<cmd>lua require'telescope.builtin'.find_files({ find_command = {'rg', '--files', '--hidden', '-g', '!.git' }})<cr>")
vim.keymap.set('n', '<leader>fr', "<cmd>lua require'telescope.builtin'.buffers({ show_all_buffers = true })<cr>")
vim.keymap.set('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>")
vim.keymap.set('n', '<leader>u', ':UndotreeToggle<CR>', opts)
vim.keymap.set('n', '<leader>-', ':IBLToggle<CR>', opts)
-- ########
-- Macros #
-- ########
+59
View File
@@ -0,0 +1,59 @@
vim.diagnostic.config({
virtual_text = true,
signs = true,
update_in_insert = false,
underline = true,
severity_sort = false,
float = true,
})
--"'''''''''''''''''''Tree sitter highlight''''''''''''''''''''''''''''''
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = { "c", "lua","bash","python"},
sync_install = false,
indent = {
enable = true,
disable = function(lang, bufnr)
local enabled_langs = { "html", "javascript", "tsx" } -- Enable auto indent only for these languages
return not vim.tbl_contains(enabled_langs, lang)
end,
},
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
["as"] = { query = "@local.scope", query_group = "locals", desc = "Select language scope" },
},
selection_modes = {
['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
['@class.outer'] = '<c-v>', -- blockwise
},
include_surrounding_whitespace = true,
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["<C-f>"] = "@function.outer", -- jump to next function
},
goto_previous_start = {
["<A-f>"] = "@function.outer", -- jump to previous function
},
},
},
}
+25
View File
@@ -0,0 +1,25 @@
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.clipboard:append('unnamedplus')
vim.cmd('filetype plugin on')
vim.opt.swapfile = false
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
vim.opt.scrolloff = 7
vim.opt.backspace = { 'indent', 'eol', 'start' }
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.autoindent = true
vim.g.mapleader = ' '
vim.opt.encoding = 'utf-8'
vim.opt.termguicolors = true
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
-- Spell generall options
vim.opt.spelllang = 'en_us'
vim.opt.spell = false
vim.opt.hlsearch = false
vim.opt.showmode = false
vim.opt.showtabline = 2
+152
View File
@@ -0,0 +1,152 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
local plugins = {
-- Indent guides
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {},
},
-- Color highlighting
{ "catgoose/nvim-colorizer.lua"},
-- Undo tree viewer
{ "mbbill/undotree" },
-- Devicons
{ "nvim-tree/nvim-web-devicons", opts = {} },
-- Neo-tree file explorer
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
lazy = false,
opts = { },
},
-- Telescope fuzzy finder
{
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' }
},
-- Treesitter
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
{ "nvim-treesitter/nvim-treesitter-textobjects" },
-- Autopairs
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = true
},
-- Commenting utility
{ "tpope/vim-commentary" },
-- Catppuccin theme
{ "catppuccin/nvim",
name = "catppuccin",
priority = 1000 },
-- Surround plugin
{ "tpope/vim-surround" },
-- Treesitter auto-closing tags
{ "windwp/nvim-ts-autotag" },
-- Signature marks
{ "kshenoy/vim-signature" },
-- Oil file explorer
{
'stevearc/oil.nvim',
opts = {},
dependencies = { { "echasnovski/mini.icons", opts = {} } },
lazy = false,
},
-- Rainbow delimiters
{ "HiPhish/rainbow-delimiters.nvim" },
-- Completion engine
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "saadparwaiz1/cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
-- Lualine
{ 'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' } },
-- File icons
{ "ryanoasis/vim-devicons" },
-- barbar
{
'romgrk/barbar.nvim',
dependencies = {
'nvim-tree/nvim-web-devicons'
},
init = function()
vim.g.barbar_auto_setup = false -- disable auto-setup
end,
opts = {},
},
-- highlight
{
'tzachar/local-highlight.nvim',
},
-- buffer vacuum
{
'ChuufMaster/buffer-vacuum',
opts = {
max_buffers = 2,
count_pinned_buffers = false,
enable_messages = false,
},
},
-- telescope pluggin
{'nvim-telescope/telescope-ui-select.nvim' },
}
local opts = {}
require('lazy').setup(plugins, opts)
+37
View File
@@ -0,0 +1,37 @@
require'nvim-web-devicons'.setup {
-- DevIcon will be appended to `name`
override = {
zsh = {
icon = "",
color = "#428850",
cterm_color = "65",
name = "Zsh"
}
};
color_icons = true;
default = true;
strict = true;
variant = "light|dark";
override_by_filename = {
[".gitignore"] = {
icon = "",
color = "#f1502f",
name = "Gitignore"
}
};
override_by_extension = {
["log"] = {
icon = "",
color = "#81e043",
name = "Log"
}
};
override_by_operating_system = {
["apple"] = {
icon = "",
color = "#A2AAAD",
cterm_color = "248",
name = "Apple",
},
};
}
+2
View File
@@ -0,0 +1,2 @@
dnf
lsp
Binary file not shown.