update nvim

This commit is contained in:
hhhh hgfh 2025-11-08 02:12:26 +03:00
parent c1de9ef4ff
commit af02e31fe9
25 changed files with 957 additions and 133 deletions

View file

@ -1,41 +1,13 @@
vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/"
-- Default my settings
vim.g.mapleader = " "
vim.wo.number = true
vim.wo.relativenumber = true
vim.opt.wrap = false
-- bootstrap lazy and all plugins
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
-- Add basic configs
require("configs.lazy")
require("mappings")
require("options")
require("custom.init")
if not vim.uv.fs_stat(lazypath) then
local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
local lazy_config = require "configs.lazy"
-- load plugins
require("lazy").setup({
{
"NvChad/NvChad",
lazy = false,
branch = "v2.5",
import = "nvchad.plugins",
},
{ import = "plugins" },
}, lazy_config)
-- load theme
dofile(vim.g.base46_cache .. "defaults")
dofile(vim.g.base46_cache .. "statusline")
require "options"
require "autocmds"
require "custom.init"
vim.schedule(function()
require "mappings"
end)
vim.cmd[[colorscheme darcula-dark]]

View file

@ -1,36 +1,36 @@
{
"LuaSnip": { "branch": "master", "commit": "f958d9837c8fa7816bb8fb54977e658affc63c31" },
"NvChad": { "branch": "v2.5", "commit": "f107fabe11ac8013dc3435ecd5382bee872b1584" },
"base46": { "branch": "v3.0", "commit": "db58475d3fd2a16f9b1467d6895e3c4c195ed7dd" },
"cmp-async-path": { "branch": "main", "commit": "0ed1492f59e730c366d261a5ad822fa37e44c325" },
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"cmp-async-path": { "branch": "main", "commit": "b8aade3a0626f2bc1d3cd79affcd7da9f47f7ab1" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" },
"conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" },
"darcula-dark.nvim": { "branch": "main", "commit": "5e8edf8b2aff3bf3d5110799713d29649cb87bbb" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" },
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
"marks.nvim": { "branch": "master", "commit": "f353e8c08c50f39e99a9ed474172df7eddd89b72" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" },
"minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" },
"mini.pairs": { "branch": "main", "commit": "b316e68f2d242d5bd010deaab645daa27ed86297" },
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
"nvim-cmp": { "branch": "main", "commit": "a7bcf1d88069fc67c9ace8a62ba480b8fe879025" },
"nvim-dap": { "branch": "master", "commit": "881f7dc17c0b4204a1d844732f95539575350e5b" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
"nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-tree.lua": { "branch": "master", "commit": "e397756d2a79d74314ea4cd3efc41300e91c0ff0" },
"nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" },
"nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" },
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
"nvim-tree.lua": { "branch": "master", "commit": "64e2192f5250796aa4a7f33c6ad888515af50640" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
"nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
"persisted.nvim": { "branch": "main", "commit": "5063ee8e3589a43eefadcca57496aea01b6170fa" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"ui": { "branch": "v3.0", "commit": "03b9718140375e7f3f5e4f3e04bc2b6c907440ec" },
"vim-devicons": { "branch": "master", "commit": "71f239af28b7214eebb60d4ea5bd040291fb7e33" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"snacks.nvim": { "branch": "main", "commit": "9a15b317495cda991d3b4990f18aed47a9a9a891" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"vim-highlightedyank": { "branch": "master", "commit": "285a61425e79742997bbde76a91be6189bc988fb" },
"volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" },
"which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View file

@ -0,0 +1,64 @@
local bufferline = require('bufferline')
bufferline.setup {
options = {
mode = "buffers", -- set to "tabs" to only show tabpages instead
style_preset = bufferline.style_preset.default,
themable = true,
indicator = {
icon = '▎',
style = 'icon',
},
buffer_close_icon = '󰅖',
modified_icon = '● ',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
max_name_length = 18,
max_prefix_length = 15,
truncate_names = true,
tab_size = 18,
custom_filter = function(buf_number, buf_numbers)
if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
return true
end
if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
return true
end
if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
return true
end
if buf_numbers[1] ~= buf_number then
return true
end
end,
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",
text_align = "left",
separator = true
}
},
color_icons = true,
get_element_icon = function(element)
local icon, hl = require('nvim-web-devicons').get_icon_by_filetype(element.filetype, { default = false })
return icon, hl
end,
show_buffer_icons = true,
show_buffer_close_icons = true,
show_close_icon = true,
show_tab_indicators = true,
separator_style = "slant",
enforce_regular_tabs = false,
always_show_bufferline = true,
auto_toggle_bufferline = true,
hover = {
enabled = true,
delay = 200,
reveal = {'close'}
},
pick = {
alphabet = "abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ1234567890",
},
}
}

56
nvim/lua/configs/cmp.lua Normal file
View file

@ -0,0 +1,56 @@
local cmp = require "cmp"
local options = {
completion = { completeopt = "menu,menuone" },
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<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()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "async_path" },
},
}
return vim.tbl_deep_extend("force", options, {})

View file

@ -2,14 +2,12 @@ local options = {
formatters_by_ft = {
lua = { "stylua" },
cpp = { "clang-format" },
-- html = { "prettier" },
},
-- format_on_save = {
-- -- These options will be passed to conform.format()
-- timeout_ms = 500,
-- lsp_fallback = true,
-- },
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
}
return options

View file

@ -0,0 +1,53 @@
return {
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(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc, silent = true })
end
-- stylua: ignore start
map("n", "]h", function()
if vim.wo.diff then
vim.cmd.normal({ "]c", bang = true })
else
gs.nav_hunk("next")
end
end, "Next Hunk")
map("n", "[h", function()
if vim.wo.diff then
vim.cmd.normal({ "[c", bang = true })
else
gs.nav_hunk("prev")
end
end, "Prev Hunk")
map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk")
map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk")
map({ "n", "x" }, "<leader>ghs", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
map({ "n", "x" }, "<leader>ghr", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
map("n", "<leader>ghp", gs.preview_hunk_inline, "Preview Hunk Inline")
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
map("n", "<leader>ghB", function() gs.blame() end, "Blame Buffer")
map("n", "<leader>ghd", gs.diffthis, "Diff This")
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
end,
}

View file

@ -1,47 +1,26 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
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)
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
require("lazy").setup({
spec = {
{ import = "plugins" },
},
}
install = { colorscheme = { "darcula-dark" } },
checker = { enabled = true },
})

View file

@ -0,0 +1,34 @@
local M = {}
local api = vim.api
local function check_triggeredChars(triggerChars)
local cur_line = api.nvim_get_current_line()
local pos = api.nvim_win_get_cursor(0)[2]
local prev_char = cur_line:sub(pos - 1, pos - 1)
local cur_char = cur_line:sub(pos, pos)
for _, char in ipairs(triggerChars) do
if cur_char == char or prev_char == char then
return true
end
end
end
M.setup = function(client, bufnr)
local group = api.nvim_create_augroup("LspSignature", { clear = false })
api.nvim_clear_autocmds { group = group, buffer = bufnr }
local triggerChars = client.server_capabilities.signatureHelpProvider.triggerCharacters
api.nvim_create_autocmd("TextChangedI", {
group = group,
buffer = bufnr,
callback = function()
if check_triggeredChars(triggerChars) then
vim.lsp.buf.signature_help { focus = false, silent = true, max_height = 7, border = "single" }
end
end,
})
end
return M

View file

@ -0,0 +1,65 @@
local on_attach = require("configs.lsp.e-lspconfig").on_attach
local on_init = require("configs.lsp.e-lspconfig").on_init
local capabilities = require("configs.lsp.e-lspconfig").capabilities
-- clangd lsp server
vim.lsp.config('clangd', {
on_attach = on_attach,
on_init = on_init,
capabilities = capabilities,
cmd = {
"clangd",
"--background-index",
"--background-index-priority=normal",
"--clang-tidy",
"--experimental-modules-support",
"--all-scopes-completion",
"--completion-style=detailed",
"--header-insertion=iwyu",
"--limit-references=5",
"--malloc-trim",
"--pch-storage=disk",
},
filetypes = { "c", "cpp", "objc", "objcpp" },
init_options = {
fallbackFlags = {'-std=c++20'},
}
})
vim.lsp.enable('clangd')
-- Lua
vim.lsp.config('lua_ls', {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_markers = { '.luarc.json', '.luarc.jsonc', '.git' },
single_file_support = true,
settings = {
Lua = {
telemetry = { enable = false },
runtime = { version = 'LuaJIT' },
diagnostics = { globals = { 'vim' } },
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
vim.fn.stdpath('config'),
},
},
},
}
})
vim.lsp.enable('lua_ls')
-- Bash
vim.lsp.config('bashls', {
cmd = { 'bash-language-server', 'start' },
filetypes = { 'sh', 'bash' },
root_markers = { '.git' },
single_file_support = true,
})
vim.lsp.enable('bashls')
-- For all
vim.diagnostic.config({
virtual_text = false,
})

View file

@ -0,0 +1,54 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
always_show_tabline = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
refresh_time = 16, -- ~60fps
events = {
'WinEnter',
'BufEnter',
'BufWritePost',
'SessionLoadPost',
'FileChangedShellPost',
'VimResized',
'Filetype',
'CursorMoved',
'CursorMovedI',
'ModeChanged',
},
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'fileformat', 'filetype'},
lualine_y = {'lsp_status'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View file

@ -0,0 +1,23 @@
-- vscode format
require("luasnip.loaders.from_vscode").lazy_load { exclude = vim.g.vscode_snippets_exclude or {} }
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
-- snipmate format
require("luasnip.loaders.from_snipmate").load()
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
-- lua format
require("luasnip.loaders.from_lua").load()
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
-- fix luasnip #258
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})

View file

@ -0,0 +1,32 @@
return {
filters = { dotfiles = false },
disable_netrw = true,
hijack_cursor = true,
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
width = 30,
preserve_window_proportions = true,
},
renderer = {
root_folder_label = false,
highlight_git = true,
indent_markers = { enable = true },
icons = {
glyphs = {
default = "󰈚",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
},
git = { unmerged = "" },
},
},
},
}

View file

@ -0,0 +1,22 @@
return {
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
sorting_strategy = "ascending",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
},
width = 0.87,
height = 0.80,
},
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" },
extensions = {},
}

View file

@ -0,0 +1,47 @@
return {
ensure_installed = {
"bash",
"c",
"cpp",
"cmake",
"diff",
"doxygen",
"git_config",
"gitcommit",
"gitignore",
"html",
"javadoc",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"make",
"markdown",
"markdown_inline",
"meson",
"printf",
"python",
"query",
"regex",
"sql",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = {
enable = true,
},
}

19
nvim/lua/configs/ufo.lua Normal file
View file

@ -0,0 +1,19 @@
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
vim.keymap.set('n', 'zP', function ()
local winid = require('ufo').peekFoldedLinesUnderCursor()
if not winid then
vim.lsp.buf.hover()
end
end, {desc = "Peek folder"})
require("ufo").setup({
provider_selector = function (bufnr, filetype, buftype)
return { 'lsp', 'indent' }
end
})

View file

@ -1,4 +1,8 @@
-- форматирование при сохранении для C/C++
-- ========== Formating =========== --
require("telescope").load_extension("noice")
require("telescope.themes").get_dropdown()
-- ========== Formating =========== --
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = { "*.c", "*.cpp", "*.h", "*.hpp" },
callback = function()
@ -6,15 +10,14 @@ vim.api.nvim_create_autocmd("BufWritePre", {
end,
})
-- настройки clipboard
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
-- ========== Formating =========== --
vim.o.clipboard ="unnamedplus"
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
local copy_to_unnamedplus = require("vim.ui.clipboard.osc52").copy("+")
copy_to_unnamedplus(vim.v.event.regcontents)
local copy_to_unnamed = require("vim.ui.clipboard.osc52").copy("*")
copy_to_unnamed(vim.v.event.regcontents)
end,
})

View file

@ -1,13 +1,10 @@
require "nvchad.mappings"
-- add yours here
local map = vim.keymap.set
-- ========== Basics =========== --
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
-- Debbuger mappings
-- ========== Debug =========== --
map('n', '<leader>db', '<cmd>DapToggleBreakpoint<CR>', { desc = 'Toggle breakpoint' })
map('n', '<leader>dr', '<cmd>DapContinue<CR>', { desc = 'Start/continue debug' })
map('n', '<leader>ds', '<cmd>DapStepOver<CR>', { desc = 'Step over' })
@ -16,14 +13,65 @@ map('n', '<leader>do', '<cmd>DapStepOut<CR>', { desc = 'Step out' })
map('n', '<leader>dq', '<cmd>DapTerminate<CR>', { desc = 'Stop debug' })
map('n', '<leader>du', '<cmd>lua require("dapui").toggle()<CR>', { desc = 'Toggle DAP UI' })
-- LSP
-- ========== LSP =========== --
map('n', '<leader>lo', '<cmd>lua vim.diagnostic.open_float()<CR>', { noremap = true, silent = true, desc = 'Open diagnostic' })
map('n', '[l', '<cmd>DapContinue<CR>', { noremap = true, silent = true, desc = 'Go to prev diagnostic' })
map('n', ']l', '<cmd>DapStepOver<CR>', { noremap = true, silent = true, desc = 'Go to next diagnostic' })
map('n', '<leader>lt', '<cmd>DapStepInto<CR>', { noremap = true, silent = true, desc = 'Open toggle' })
map("n", "<leader>ds", vim.diagnostic.setloclist, { desc = "LSP diagnostic loclist" })
map("n", "<Esc>", "<cmd>noh<CR>", { desc = "general clear highlights" })
-- Tabs
-- ========== Tabs ========== --
map('n', '<leader>tn', '<cmd>:tabnew<CR>', { noremap = true, silent = true, desc = 'Open new tab' })
map('n', '<leader>tc', '<cmd>:tabclose<CR>', { noremap = true, silent = true, desc = 'Close this tab' })
map('n', '<leader>tl', '<cmd>:tabnext<CR>', { noremap = true, silent = true, desc = 'Go to next tab' })
map('n', '<leader>th', '<cmd>:tabprevious<CR>', { noremap = true, silent = true, desc = 'Go to previous tab' })
-- ========== Sessions ============= --
map("n", "<leader>ss", "<cmd>:SessionSave<CR>", {noremap = true, silent = true})
map("n", "<leader>sl", "<cmd>:SessionLoad<CR>", {noremap = true, silent = true})
map("n", "<leader>st", "<cmd>:Telescope persisted<CR>", {noremap = true, silent = true})
-- ========== Window moves ============= --
map("n", "<C-h>", "<C-w>h", { desc = "switch window left" })
map("n", "<C-l>", "<C-w>l", { desc = "switch window right" })
map("n", "<C-j>", "<C-w>j", { desc = "switch window down" })
map("n", "<C-k>", "<C-w>k", { desc = "switch window up" })
-- ========== Line moves ============= --
map("i", "<C-b>", "<ESC>^i", { desc = "move beginning of line" })
map("i", "<C-e>", "<End>", { desc = "move end of line" })
map("i", "<C-h>", "<Left>", { desc = "move left" })
map("i", "<C-l>", "<Right>", { desc = "move right" })
map("i", "<C-j>", "<Down>", { desc = "move down" })
map("i", "<C-k>", "<Up>", { desc = "move up" })
-- ========== Comments ============= --
map("n", "<leader>/", "gcc", { desc = "toggle comment", remap = true })
map("v", "<leader>/", "gc", { desc = "toggle comment", remap = true })
-- ========== Nvim-tree ============= --
map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "nvimtree toggle window" })
map("n", "<leader>e", "<cmd>NvimTreeFocus<CR>", { desc = "nvimtree focus window" })
-- ========== Telescope ============= --
map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "telescope live grep" })
map("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { desc = "telescope find buffers" })
map("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", { desc = "telescope help page" })
map("n", "<leader>ma", "<cmd>Telescope marks<CR>", { desc = "telescope find marks" })
map("n", "<leader>fo", "<cmd>Telescope oldfiles<CR>", { desc = "telescope find oldfiles" })
map("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "telescope find in current buffer" })
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "telescope git status" })
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" })
map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" })
map("n", "<leader>fa", "<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>", { desc = "telescope find all files" })
-- ========== Which-key ============= --
map("n", "<leader>wK", "<cmd>WhichKey <CR>", { desc = "whichkey all keymaps" })
-- ========== Buffers ============= --
map("n", "<leader>x", "<cmd>bp | sp | bn | bd<CR>", {desc = "Close buffer"})
map("n", "<leader>e", "<cmd>enew<CR>", {desc = "Create buffer"})
map("n", "<tab>", "<cmd>BufferLineCycleNext<CR>", {desc = "Go to next buffer"})
map("n", "<S-tab>", "<cmd>BufferLineCyclePrev<CR>", {desc = "Go to prev buffer"})

View file

@ -1,6 +1,57 @@
require "nvchad.options"
local opt = vim.opt
local o = vim.o
local g = vim.g
-- add yours here!
-------------------------------------- options ------------------------------------------
o.laststatus = 3
o.showmode = false
o.splitkeep = "screen"
-- local o = vim.o
-- o.cursorlineopt ='both' -- to enable cursorline!
o.clipboard = "unnamedplus"
o.cursorline = true
o.cursorlineopt = "number"
-- Indenting
o.expandtab = true
o.shiftwidth = 2
o.smartindent = true
o.tabstop = 2
o.softtabstop = 2
opt.fillchars = { eob = " " }
o.ignorecase = true
o.smartcase = true
o.mouse = "a"
-- Numbers
o.number = true
o.numberwidth = 2
o.ruler = false
-- disable nvim intro
opt.shortmess:append "sI"
o.signcolumn = "yes"
o.splitbelow = true
o.splitright = true
o.timeoutlen = 400
o.undofile = true
-- interval for writing swap file to disk, also used by gitsigns
o.updatetime = 250
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append "<>[]hl"
-- disable some default providers
g.loaded_node_provider = 0
g.loaded_python3_provider = 0
g.loaded_perl_provider = 0
g.loaded_ruby_provider = 0
-- add binaries installed by mason.nvim to path
local is_windows = vim.fn.has "win32" ~= 0
local sep = is_windows and "\\" or "/"
local delim = is_windows and ";" or ":"
vim.env.PATH = table.concat({ vim.fn.stdpath "data", "mason", "bin" }, sep) .. delim .. vim.env.PATH

View file

@ -0,0 +1,73 @@
return {
-- Dev icons
{
"nvim-tree/nvim-web-devicons",
opts = {},
},
-- Marks
{
"chentoast/marks.nvim",
event = "VeryLazy",
opts = {},
},
-- Gitsigns
{
"lewis6991/gitsigns.nvim",
event = {"BufReadPre", "BufNewFile"},
opts = function ()
require("configs.gitsigns")
end
},
-- Theme
{
"xiantang/darcula-dark.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
},
-- Nvim tree
{
"nvim-tree/nvim-tree.lua",
cmd = {'NvimTreeToggle', 'NvimTreeFocus'},
opts = function ()
require("configs.nvimtree")
end,
},
-- Pairs
{
'nvim-mini/mini.pairs',
event = {"BufReadPre", "BufNewFile"},
opts = {
modes = { insert = true, command = true, terminal = false },
skip_next = [=[[%w%%%'%[%"%.%`%$]]=],
skip_ts = { "string" },
skip_unbalanced = true,
markdown = true,
},
},
-- Formating
{
"stevearc/conform.nvim",
event = 'BufWritePre',
config = function ()
require("configs.nvimtree")
end,
},
-- Yank Highlight
{
"machakann/vim-highlightedyank",
event = "VeryLazy",
},
-- Sessions
{
"olimorris/persisted.nvim",
event = "BufReadPre",
opts = {
autostart = true,
autosave = true,
save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"),
use_git_branch = true,
autoload = false,
},
},
}

89
nvim/lua/plugins/dev.lua Normal file
View file

@ -0,0 +1,89 @@
return {
-- Nvim lspconfig
{
"neovim/nvim-lspconfig",
config = function()
require "configs.lsp.lspconfig"
end,
},
-- Mason
{
"mason-org/mason.nvim",
opts = {}
},
-- Mason lspconfig
{
"mason-org/mason-lspconfig.nvim",
opts = {},
dependencies = {
"mason-org/mason.nvim",
"neovim/nvim-lspconfig",
},
},
-- Nvim complete
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
config = function(_, opts)
require("luasnip").config.set_config(opts)
require "configs.luasnip"
end,
},
-- autopairing of (){}[] etc
{
"windwp/nvim-autopairs",
opts = {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
},
config = function(_, opts)
require("nvim-autopairs").setup(opts)
-- setup cmp for autopairs
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
end,
},
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"https://codeberg.org/FelipeLema/cmp-async-path.git"
}
},
opts = function()
return require "configs.cmp"
end,
},
-- Treesitter
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
opts = function()
return require "configs.treesitter"
end,
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
-- Ufo folders
{
'kevinhwang91/nvim-ufo',
dependencies = 'kevinhwang91/promise-async',
event = "VeryLazy",
config = function ()
end,
},
}

View file

@ -0,0 +1,17 @@
return {
{
'nvim-lualine/lualine.nvim',
dependencies = 'nvim-tree/nvim-web-devicons',
config = function ()
require("configs.lualine")
end,
},
{
'akinsho/bufferline.nvim',
version = "*",
dependencies = 'nvim-tree/nvim-web-devicons',
config = function ()
require("configs.bufferline")
end,
}
}

View file

@ -0,0 +1,30 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
opts = {
},
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
config = {
lsp = {
signature = {
enabled = false,
},
hover = {
enabled = false,
},
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
presets = {
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = false,
},
}
}

View file

@ -0,0 +1,19 @@
return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = { enabled = true },
indent = { enabled = true },
input = { enabled = true },
picker = { enabled = true },
notifier = { enabled = true },
quickfile = { enabled = true },
scope = { enabled = true },
scroll = { enabled = true },
statuscolumn = { enabled = true },
words = { enabled = true },
},
}

View file

@ -0,0 +1,9 @@
return {
'nvim-telescope/telescope.nvim',
tag = '0.1.8',
dependencies = {'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter'},
cmd = "Telescope",
configs =function ()
return require("configs.telescope")
end,
}

View file

@ -0,0 +1,67 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts_extend = { "spec" },
opts = {
preset = "helix",
defaults = {},
spec = {
{
mode = { "n", "x" },
{ "<leader><tab>", group = "tabs" },
{ "<leader>c", group = "code" },
{ "<leader>d", group = "debug" },
{ "<leader>dp", group = "profiler" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
{ "<leader>gh", group = "hunks" },
{ "<leader>q", group = "quit/session" },
{ "<leader>s", group = "search" },
{ "<leader>u", group = "ui" },
{ "<leader>x", group = "diagnostics/quickfix" },
{ "[", group = "prev" },
{ "]", group = "next" },
{ "g", group = "goto" },
{ "gs", group = "surround" },
{ "z", group = "fold" },
{
"<leader>b",
group = "buffer",
expand = function()
return require("which-key.extras").expand.buf()
end,
},
{
"<leader>w",
group = "windows",
proxy = "<c-w>",
expand = function()
return require("which-key.extras").expand.win()
end,
},
-- better descriptions
{ "gx", desc = "Open with system app" },
},
},
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Keymaps (which-key)",
},
{
"<c-w><space>",
function()
require("which-key").show({ keys = "<c-w>", loop = true })
end,
desc = "Window Hydra Mode (which-key)",
},
},
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
end,
}