nvim, i3 config and new zed settings

This commit is contained in:
2025-12-11 15:21:12 +01:00
parent 467588a604
commit 0d6cfd7781
24 changed files with 862 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
-- Set leader key to Space
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Load basic settings
require("config.options")
require("config.keymaps")
-- Load plugins (lazy.nvim will be auto-installed)
require("config.plugins")
-- Plugin-specific configuration
require("config.lsp")
require("config.treesitter")
require("config.telescope")
require("config.cmp")
+23
View File
@@ -0,0 +1,23 @@
{
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
"barbar.nvim": { "branch": "master", "commit": "fb4369940a07dda35fa4d7f54cf4a36aa00440e6" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" },
"nvim-lspconfig": { "branch": "master", "commit": "b34fbdffdcb6295c7a25df6ba375452a2e73c32e" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"sonokai": { "branch": "master", "commit": "ec07018013b4683cf33f80ee4bdf3eca2621da33" },
"telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" },
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }
}
+74
View File
@@ -0,0 +1,74 @@
-- Completion setup for Neovim using nvim-cmp and LuaSnip
-- Safely import modules
local cmp_status, cmp = pcall(require, "cmp")
if not cmp_status then
return
end
local snip_status, luasnip = pcall(require, "luasnip")
if not snip_status then
return
end
-- Load friendly-snippets (optional, prebuilt snippets)
require("luasnip.loaders.from_vscode").lazy_load()
-- Setup nvim-cmp
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(), -- Trigger completion menu
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Confirm selection
["<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" }, -- LSP completion
{ name = "luasnip" }, -- Snippets
}, {
{ name = "buffer" }, -- Words in current buffer
{ name = "path" }, -- File system paths
}),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
luasnip = "[Snip]",
buffer = "[Buf]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
},
})
+67
View File
@@ -0,0 +1,67 @@
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
-- Tabs shortcuts
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
map('n', '<C-s-p>', '<Cmd>BufferPickDelete<CR>', opts)
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
map('n', '<Space>bn', '<Cmd>BufferOrderByName<CR>', opts)
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
-- Toggle Neotree
map('n', '<leader>e', ':Neotree toggle<CR>', opts)
-- Terminal
map('n', '<leader>t', ':terminal<CR>', opts)
--[[
-- Turn off arrow keys
vim.keymap.set("n", "<Up>", "<Nop>", opts)
vim.keymap.set("n", "<Down>", "<Nop>", opts)
vim.keymap.set("n", "<Left>", "<Nop>", opts)
vim.keymap.set("n", "<Right>", "<Nop>", opts)
vim.keymap.set("i", "<Up>", "<Nop>", opts)
vim.keymap.set("i", "<Down>", "<Nop>", opts)
vim.keymap.set("i", "<Left>", "<Nop>", opts)
vim.keymap.set("i", "<Right>", "<Nop>", opts)
-- To move around in insert mode with hjkl
vim.keymap.set("i", "<C-h>", "<Left>", opts)
vim.keymap.set("i", "<C-j>", "<Down>", opts)
vim.keymap.set("i", "<C-k>", "<Up>", opts)
vim.keymap.set("i", "<C-l>", "<Right>", opts)
vim.keymap.set("v", "<Up>", "<Nop>", opts)
vim.keymap.set("v", "<Down>", "<Nop>", opts)
vim.keymap.set("v", "<Left>", "<Nop>", opts)
vim.keymap.set("v", "<Right>", "<Nop>", opts)
vim.keymap.set("o", "<Up>", "<Nop>", opts)
vim.keymap.set("o", "<Down>", "<Nop>", opts)
vim.keymap.set("o", "<Left>", "<Nop>", opts)
vim.keymap.set("o", "<Right>", "<Nop>", opts)
vim.keymap.set("t", "<Up>", "<Nop>", opts)
vim.keymap.set("t", "<Down>", "<Nop>", opts)
vim.keymap.set("t", "<Left>", "<Nop>", opts)
vim.keymap.set("t", "<Right>", "<Nop>", opts)
--]]
+34
View File
@@ -0,0 +1,34 @@
-- Common on_attach handler
local on_attach = function(client, bufnr)
local opts = { buffer = bufnr }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
end
-- Configure all your servers
vim.lsp.config("lua_ls", {
on_attach = on_attach,
settings = {
Lua = { diagnostics = { globals = { "vim" } } },
},
})
vim.lsp.config("pyright", { on_attach = on_attach })
vim.lsp.config("gopls", { on_attach = on_attach })
vim.lsp.config("clangd", { on_attach = on_attach })
vim.lsp.config("omnisharp", { on_attach = on_attach })
vim.lsp.config("jdtls", { on_attach = on_attach })
vim.lsp.config("ts_ls", { on_attach = on_attach })
vim.lsp.config("jsonls", { on_attach = on_attach })
vim.lsp.config("yamlls", { on_attach = on_attach })
-- Enable them all
for _, server in ipairs({
"lua_ls", "pyright", "gopls", "clangd",
"omnisharp", "jdtls", "ts_ls", "jsonls", "yamlls",
}) do
vim.lsp.enable(server)
end
+9
View File
@@ -0,0 +1,9 @@
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.opt.mouse = "a"
vim.opt.clipboard:append('unnamedplus')
+93
View File
@@ -0,0 +1,93 @@
-- Bootstrap lazy.nvim if not installed
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
lazypath
})
end
vim.opt.rtp:prepend(lazypath)
-- Plugins
require("lazy").setup({
-- Core
"nvim-lua/plenary.nvim",
-- UI
"nvim-lualine/lualine.nvim",
"nvim-tree/nvim-web-devicons",
-- Treesitter
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
-- Telescope
"nvim-telescope/telescope.nvim",
-- LSP
"neovim/nvim-lspconfig",
-- Themes
"folke/tokyonight.nvim",
{
'sainnhe/sonokai',
lazy = false,
priority = 1000,
config = function()
-- Optionally configure and load the colorscheme
-- directly inside the plugin declaration.
vim.g.sonokai_enable_italic = true
vim.cmd.colorscheme('sonokai')
end
},
-- Autocomplete
{
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
},
--[[ Markdown Render Page
{
'MeanderingProgrammer/render-markdown.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.nvim'}, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
},
--]]
-- Tabs
{ 'romgrk/barbar.nvim',
dependencies = {
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
},
init = function() vim.g.barbar_auto_setup = false end,
opts = {
-- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
-- animation = true,
-- insert_at_start = true,
-- …etc.
},
},
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons", -- optional, but recommended
},
lazy = false, -- neo-tree will lazily load itself
},
})
+25
View File
@@ -0,0 +1,25 @@
local telescope = require("telescope")
telescope.setup({
defaults = {
prompt_prefix = "🔍 ",
selection_caret = "",
path_display = { "smart" },
sorting_strategy = "ascending",
layout_config = { prompt_position = "top" },
},
pickers = {
find_files = {
hidden = true, -- show hidden files
},
},
})
-- Optional: keymaps for quick access
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find files" })
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Grep text" })
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Find buffers" })
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Find help" })
vim.keymap.set("n", "<leader>fr", builtin.oldfiles, { desc = "Recent files" })
+16
View File
@@ -0,0 +1,16 @@
require("nvim-treesitter.configs").setup({
ensure_installed = {
-- Programming Languages
"lua", "python", "bash", "javascript", "typescript",
"go", "java", "c", "cpp", "c_sharp", "rust",
-- Web Languages
"html", "css", "scss", "json", "yaml", "toml", "xml",
-- Other formats
"markdown", "markdown_inline", "sql", "dockerfile", "gitignore"
},
highlight = { enable = true },
indent = { enable = true },
})