add nvim config

This commit is contained in:
2025-08-28 17:00:42 +01:00
parent 82ef255396
commit d234aca8e4
12 changed files with 230 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
require("config.options")
require("config.lazy")

View File

@@ -0,0 +1,16 @@
{
"catppuccin": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "cea666ef965884414b1b71f6b39a537f9238bdb2" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-lspconfig": { "branch": "master", "commit": "cb33dea610b7eff240985be9f6fe219920e630ef" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "4ae47f4fb18e85b80e84b729974fe65483b06aaf" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
}

View File

@@ -0,0 +1,35 @@
-- 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)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View File

@@ -0,0 +1,5 @@
vim.cmd("set expandtab")
vim.cmd("set tabstop=2")
vim.cmd("set softtabstop=2")
vim.cmd("set shiftwidth=2")
vim.cmd("set number")

View File

@@ -0,0 +1,5 @@
{
"diagnostics.globals": [
"vim"
]
}

View File

@@ -0,0 +1,10 @@
return {
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
config = function()
vim.cmd.colorscheme("catppuccin-mocha")
end,
},
}

View File

@@ -0,0 +1,32 @@
return {
{
"mason-org/mason.nvim",
version = "^1.0.0",
config = function()
require('mason').setup()
end
},
{
"mason-org/mason-lspconfig.nvim",
version = "^1.0.0",
opts = {},
config = function()
require('mason-lspconfig').setup({
ensure_installed = { "lua_ls", "ts_ls" }
})
end
},
{
"neovim/nvim-lspconfig",
version = "^1.0.0",
config = function()
local lspconfig = require('lspconfig')
lspconfig.lua_ls.setup({})
lspconfig.ts_ls.setup({})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, {})
end
}
}

View File

@@ -0,0 +1,12 @@
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
lazy = false,
config = function()
require('lualine').setup({
options = {
theme = 'dracula'
}
})
end
}

View File

@@ -0,0 +1,48 @@
return {
{
"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
opts = {
filesystem = {
filtered_items = {
visible = true,
hide_dotfiles = false
}
}
},
config = function(_, opts)
require('neo-tree').setup(opts)
vim.keymap.set('n', '<C-n>', '<CMD>Neotree toggle<CR>', {})
-- Option 2: More targeted - only when opening actual files
vim.api.nvim_create_autocmd({"BufReadPost", "BufNewFile"}, {
callback = function()
-- Check if it's a real file (has a name and isn't a special buffer)
local bufname = vim.api.nvim_buf_get_name(0)
if bufname == "" or vim.bo.buftype ~= "" then
return
end
-- Skip if neo-tree is already visible
local manager = require("neo-tree.sources.manager")
local state = manager.get_state("filesystem")
if state.tree and state.tree.visible then
return
end
require("neo-tree.command").execute({ action = "show", source = "filesystem" })
end,
})
end,
}
}

View File

@@ -0,0 +1,14 @@
return {
"folke/snacks.nvim",
opts = {
dashboard = {
sections = {
{ section = "header" },
{ icon = "", title = "Keymaps", section = "keys", indent = 2, padding = 1 },
{ icon = "", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
{ icon = "", title = "Projects", section = "projects", indent = 2, padding = 1 },
{ section = "startup" },
}
}
}
}

View File

@@ -0,0 +1,34 @@
return {
{
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {
defaults = {
layout_strategy = 'flex',
layout_config = { width = 0.95 },
path_display = { 'smart' },
},
},
config = function()
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<C-p>', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
end,
},
{
"nvim-telescope/telescope-ui-select.nvim",
config = function()
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
})
require("telescope").load_extension("ui-select")
end
}
}

View File

@@ -0,0 +1,16 @@
return {
{
"nvim-treesitter/nvim-treesitter",
branch = 'master',
lazy = false,
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = {"c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "javascript", "typescript", "python", "html", "css"},
highlight = { enabled = true },
indent = { enabled = true },
})
end,
}
}