From 300b177d0dd629e4c8078a8aa9fab703cd3f18e2 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Fri, 16 Jan 2026 16:55:21 +0100 Subject: [PATCH] First attempt at my own neovim setup, with inspiration from jcorbin --- .config/nvim/init.lua | 1 + .config/nvim/lua/config/lazy.lua | 37 +++++++++++ .config/nvim/lua/plugins/colorizer.lua | 3 + .config/nvim/lua/plugins/colorscheme.lua | 8 +++ .config/nvim/lua/plugins/python.lua | 16 +++++ .config/nvim/lua/plugins/treesitter.lua | 80 ++++++++++++++++++++++++ 6 files changed, 145 insertions(+) create mode 100644 .config/nvim/init.lua create mode 100644 .config/nvim/lua/config/lazy.lua create mode 100644 .config/nvim/lua/plugins/colorizer.lua create mode 100644 .config/nvim/lua/plugins/colorscheme.lua create mode 100644 .config/nvim/lua/plugins/python.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..55b8979 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1 @@ +require("config.lazy") diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..80b2a17 --- /dev/null +++ b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,37 @@ +-- 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 = "," + +vim.wo.number = true + +-- 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 = { "kanagawa" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/.config/nvim/lua/plugins/colorizer.lua b/.config/nvim/lua/plugins/colorizer.lua new file mode 100644 index 0000000..db4b1bf --- /dev/null +++ b/.config/nvim/lua/plugins/colorizer.lua @@ -0,0 +1,3 @@ +return { + 'norcalli/nvim-colorizer.lua' +}; diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..bf39614 --- /dev/null +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,8 @@ +return { + + 'folke/tokyonight.nvim', + + 'rebelot/kanagawa.nvim', + + 'Shatur/neovim-ayu', +} diff --git a/.config/nvim/lua/plugins/python.lua b/.config/nvim/lua/plugins/python.lua new file mode 100644 index 0000000..9bfd5d4 --- /dev/null +++ b/.config/nvim/lua/plugins/python.lua @@ -0,0 +1,16 @@ +return { + "linux-cultist/venv-selector.nvim", + dependencies = { + "neovim/nvim-lspconfig", + "nvim-telescope/telescope.nvim", + }, + ft = "python", -- Load when opening Python files + opts = { + search = {}, -- if you add your own searches, they go here. + options = {} -- if you add plugin options, they go here. + }, + event = 'VeryLazy', -- Optional: needed only if you want to type `:VenvSelect` without a keymapping + keys = { + { "V", "VenvSelect" }, -- Open picker on keymap + }, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..21c9ec0 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,80 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/nvim-treesitter-refactor', + }, + + opts = { + ensure_installed = {}, + sync_install = 'false', + auto_install = 'true', + + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + + indent = { enable = true }, + + textobjects = { + select = { + enable = true, + lookahead = true, + + keymaps = { + + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + + -- You can optionally set descriptions to the mappings (used in the desc parameter of + -- nvim_buf_set_keymap) which plugins like which-key display + ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" }, + + -- You can also use captures from other query groups like `locals.scm` + ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, + }, + }, + + swap = { + enable = true, + swap_previous = { ["[."] = "@parameter.inner", }, + swap_next = { ["]."] = "@parameter.inner", }, + }, + }, + + refactor = { + highlight_definitions = { + enable = true, + -- Set to false if you have an `updatetime` of ~100. + clear_on_cursor_move = true, + }, + highlight_current_scope = { enable = false }, + smart_rename = { + enable = true, + -- Assign keymaps to false to disable them, e.g. `smart_rename = false`. + keymaps = { + smart_rename = "grr", + }, + }, + }, + + }, + }, + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/nvim-treesitter-refactor', +}