This commit is contained in:
2026-01-16 22:15:49 +03:00
parent 29938c53db
commit 1005194679
38 changed files with 364 additions and 1937 deletions

View File

@@ -0,0 +1,43 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
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 luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}),
})

View File

@@ -0,0 +1,41 @@
--local lspconfig = require("lspconfig")
local cmp_nvim_lsp = require("cmp_nvim_lsp")
-- Setup capabilities for nvim-cmp completion
local capabilities = cmp_nvim_lsp.default_capabilities()
-- Common on_attach function to map keys after LSP attaches to buffer
local on_attach = function(client, bufnr)
local bufmap = function(mode, lhs, rhs)
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, { noremap = true, silent = true })
end
-- LSP-related keymaps
bufmap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>")
bufmap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>")
bufmap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>")
bufmap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>")
bufmap("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>")
bufmap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>")
bufmap("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>")
end
-- List of servers to setup
local servers = {
"pyright",
"clangd",
"zls",
"lua_ls",
"vimls",
"marksman",
"texlab",
}
for _, server in ipairs(servers) do
vim.lsp.config(server, {
on_attach = on_attach,
capabilities = capabilities,
})
-- Enable the server configuration
vim.lsp.enable(server)
end

View File

@@ -0,0 +1,8 @@
require("lualine").setup({
options = {
theme = "auto",
section_separators = "",
component_separators = "",
},
})

View File

@@ -0,0 +1,9 @@
require("nvim-tree").setup({
sort = { sorter = "case_sensitive" },
view = { width = 30 },
renderer = { group_empty = true },
filters = { dotfiles = true },
})
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { noremap = true, silent = true })

View File

@@ -0,0 +1,41 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "zig" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (or "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}

View File

@@ -0,0 +1,29 @@
-- Function to toggle venn keymaps
function _G.Toggle_venn()
local venn_enabled = vim.inspect(vim.b.venn_enabled)
if venn_enabled == "nil" then
vim.b.venn_enabled = true
vim.cmd([[setlocal ve=all]])
-- Draw a line on HJKL keystrokes
vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", { noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", { noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", { noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", { noremap = true, silent = true })
-- Draw a box with visual selection
vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", { noremap = true, silent = true })
else
vim.cmd([[setlocal ve=]])
vim.api.nvim_buf_del_keymap(0, "n", "J")
vim.api.nvim_buf_del_keymap(0, "n", "K")
vim.api.nvim_buf_del_keymap(0, "n", "L")
vim.api.nvim_buf_del_keymap(0, "n", "H")
vim.api.nvim_buf_del_keymap(0, "v", "f")
vim.b.venn_enabled = nil
end
end
-- Toggle venn with <leader>v globally
vim.api.nvim_set_keymap("n", "<leader>v", ":lua Toggle_venn()<CR>", { noremap = true, silent = true })