From 21debd959b20fe4396d4b31e64f48f542722eb63 Mon Sep 17 00:00:00 2001 From: maxscout Date: Mon, 30 Jun 2025 21:21:27 -0400 Subject: [PATCH] add nvim config --- init.lua | 1 + lazy-lock.json | 21 ++++++ lua/config/init.lua | 60 ++++++++++++++++ lua/config/lazy-lock.json | 3 + lua/config/lazy.lua | 14 ++++ lua/config/plugins/autoclose.lua | 7 ++ lua/config/plugins/comment.lua | 7 ++ lua/config/plugins/indent-blankline.lua | 1 + lua/config/plugins/lsp.lua | 95 +++++++++++++++++++++++++ lua/config/plugins/telescope.lua | 29 ++++++++ lua/config/plugins/theme.lua | 1 + lua/config/plugins/tree.lua | 11 +++ lua/config/plugins/treesitter.lua | 46 ++++++++++++ lua/config/plugins/undotree.lua | 7 ++ lua/config/plugins/whichkey.lua | 13 ++++ 15 files changed, 316 insertions(+) create mode 100755 init.lua create mode 100755 lazy-lock.json create mode 100755 lua/config/init.lua create mode 100755 lua/config/lazy-lock.json create mode 100755 lua/config/lazy.lua create mode 100755 lua/config/plugins/autoclose.lua create mode 100755 lua/config/plugins/comment.lua create mode 100755 lua/config/plugins/indent-blankline.lua create mode 100755 lua/config/plugins/lsp.lua create mode 100755 lua/config/plugins/telescope.lua create mode 100755 lua/config/plugins/theme.lua create mode 100755 lua/config/plugins/tree.lua create mode 100755 lua/config/plugins/treesitter.lua create mode 100755 lua/config/plugins/undotree.lua create mode 100755 lua/config/plugins/whichkey.lua diff --git a/init.lua b/init.lua new file mode 100755 index 0000000..dbc863e --- /dev/null +++ b/init.lua @@ -0,0 +1 @@ +require("config") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100755 index 0000000..f4fe71b --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,21 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" }, + "autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" }, + "catppuccin": { "branch": "main", "commit": "18bab5ec4c782cdf7d7525dbe89c60bfa02fc195" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "indent-blankline.nvim": { "branch": "master", "commit": "dddb5d21811c319eb6e51a993d8fb44b193aae3f" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "56db3d5ce5476b183783160e6045f7337ba12b83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f2acd4a21db1ca0a12559e7a9f7cdace3bdbfb09" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-lspconfig": { "branch": "master", "commit": "ad32182cc4a03c8826a64e9ced68046c575fdb7d" }, + "nvim-tree.lua": { "branch": "master", "commit": "ad0b95dee55955817af635fa121f6e2486b10583" }, + "nvim-treesitter": { "branch": "master", "commit": "3de418e73d5b912096229aaeea8bb7aef5094e0d" }, + "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, + "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" } +} diff --git a/lua/config/init.lua b/lua/config/init.lua new file mode 100755 index 0000000..8c435e4 --- /dev/null +++ b/lua/config/init.lua @@ -0,0 +1,60 @@ +vim.g.mapleader = " " + +require("config.lazy") +require('lspconfig').gdscript.setup({}) +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.laststatus = 3 +vim.cmd.colorscheme "catppuccin-macchiato" + +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.autoindent = true + +vim.opt.wrap = false +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.termguicolors = true +vim.opt.background = "dark" +vim.cmd "set noshowmode" +vim.cmd "set nowrap" + +vim.opt.backspace = "indent,eol,start" +vim.opt.clipboard:append("unnamedplus") +vim.opt.splitright = true +vim.opt.splitbelow = true +-- vim.api.nvim_command('autocmd VimEnter * :set laststatus=3') + +vim.keymap.set("n", "e", ":Tex") + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +local pipepath = vim.fn.stdpath("cache") .. "/server.pipe" +if not vim.loop.fs_stat(pipepath) then + vim.fn.serverstart(pipepath) +end + +vim.keymap.set("n", "t", ":split:term") +vim.keymap.set("n", "f", ":Telescope find_files") +vim.keymap.set("n", "e", ":NvimTreeToggle") +vim.keymap.set("n", "n", ":tabnew:Telescope find_files") +vim.keymap.set("n", "v", ":vsplit") +vim.keymap.set("n", "h", ":split") +vim.keymap.set("n", "m", ":Mason") +vim.keymap.set('t', "", "h") +vim.keymap.set("n", "", ":tabn") +vim.keymap.set("n", "", ":tabp") + +-- vim.keymap.set("", "j", "") +-- vim.keymap.set("", "k", "") +-- vim.keymap.set("", "l", "") +-- vim.keymap.set("", ";", "") +-- vim.keymap.set("n", "", "h") +-- vim.keymap.set("n", "", "k") +-- vim.keymap.set("n", "", "j") +-- vim.keymap.set("n", "", "l") +vim.keymap.set("n", "F", ":%s//") +vim.keymap.set("n", "f", ":%s//g") + diff --git a/lua/config/lazy-lock.json b/lua/config/lazy-lock.json new file mode 100755 index 0000000..0e0dcd2 --- /dev/null +++ b/lua/config/lazy-lock.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100755 index 0000000..34e4d8f --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,14 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({spec = "config.plugins"}) diff --git a/lua/config/plugins/autoclose.lua b/lua/config/plugins/autoclose.lua new file mode 100755 index 0000000..f3ea2fa --- /dev/null +++ b/lua/config/plugins/autoclose.lua @@ -0,0 +1,7 @@ +return { + "m4xshen/autoclose.nvim", + lazy = false, + init = function () + require("autoclose").setup() + end +} diff --git a/lua/config/plugins/comment.lua b/lua/config/plugins/comment.lua new file mode 100755 index 0000000..0ac6a27 --- /dev/null +++ b/lua/config/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + "numtoStr/Comment.nvim", + lazy = false, + init = function () + require('Comment').setup() + end +} diff --git a/lua/config/plugins/indent-blankline.lua b/lua/config/plugins/indent-blankline.lua new file mode 100755 index 0000000..ef71fa4 --- /dev/null +++ b/lua/config/plugins/indent-blankline.lua @@ -0,0 +1 @@ +return { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} } diff --git a/lua/config/plugins/lsp.lua b/lua/config/plugins/lsp.lua new file mode 100755 index 0000000..2c42d19 --- /dev/null +++ b/lua/config/plugins/lsp.lua @@ -0,0 +1,95 @@ +return { + { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v3.x', + lazy = true, + config = false, + init = function() + -- Disable automatic setup, we are doing it manually + vim.g.lsp_zero_extend_cmp = 0 + vim.g.lsp_zero_extend_lspconfig = 0 + end, + }, + { + 'williamboman/mason.nvim', + lazy = false, + config = true, + }, + + -- Autocompletion + { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + {'L3MON4D3/LuaSnip'}, + }, + config = function() + -- Here is where you configure the autocompletion settings. + local lsp_zero = require('lsp-zero') + lsp_zero.extend_cmp() + + -- And you can configure cmp even more, if you want to. + local cmp = require('cmp') + local cmp_action = lsp_zero.cmp_action() + + cmp.setup({ + formatting = lsp_zero.cmp_format({details = true}), + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.confirm({select = false}), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp_action.luasnip_jump_forward(), + [''] = cmp_action.luasnip_jump_backward(), + }), + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + }) + end + }, + + -- LSP + { + 'neovim/nvim-lspconfig', + cmd = {'LspInfo', 'LspInstall', 'LspStart'}, + event = {'BufReadPre', 'BufNewFile'}, + dependencies = { + {'hrsh7th/cmp-nvim-lsp'}, + {'williamboman/mason-lspconfig.nvim'}, + }, + config = function() + -- This is where all the LSP shenanigans will live + local lsp_zero = require('lsp-zero') + lsp_zero.extend_lspconfig() + + --- if you want to know more about lsp-zero and mason.nvim + --- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guides/integrate-with-mason-nvim.md + lsp_zero.on_attach(function(client, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + lsp_zero.default_keymaps({buffer = bufnr}) + end) + + require('mason-lspconfig').setup({ + ensure_installed = {'rust_analyzer', 'lua_ls'}, + handlers = { + -- this first function is the "default handler" + -- it applies to every language server without a "custom handler" + function(server_name) + require('lspconfig')[server_name].setup({}) + end, + + -- this is the "custom handler" for `lua_ls` + lua_ls = function() + -- (Optional) Configure lua language server for neovim + local lua_opts = lsp_zero.nvim_lua_ls() + require('lspconfig').lua_ls.setup(lua_opts) + end, + } + }) + end + } +} diff --git a/lua/config/plugins/telescope.lua b/lua/config/plugins/telescope.lua new file mode 100755 index 0000000..3b861b9 --- /dev/null +++ b/lua/config/plugins/telescope.lua @@ -0,0 +1,29 @@ +return { + "nvim-telescope/telescope.nvim", + + tag = "0.1.5", + + dependencies = { + "nvim-lua/plenary.nvim" + }, + + config = function() + require('telescope').setup({}) + + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'pf', builtin.find_files, {}) + vim.keymap.set('n', '', builtin.git_files, {}) + vim.keymap.set('n', 'pws', function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + vim.keymap.set('n', 'pWs', function() + local word = vim.fn.expand("") + builtin.grep_string({ search = word }) + end) + vim.keymap.set('n', 'ps', function() + builtin.grep_string({ search = vim.fn.input("Grep > ") }) + end) + vim.keymap.set('n', 'vh', builtin.help_tags, {}) + end +} diff --git a/lua/config/plugins/theme.lua b/lua/config/plugins/theme.lua new file mode 100755 index 0000000..19df104 --- /dev/null +++ b/lua/config/plugins/theme.lua @@ -0,0 +1 @@ +return { "catppuccin/nvim", name = "catppuccin", priority = 1000 } diff --git a/lua/config/plugins/tree.lua b/lua/config/plugins/tree.lua new file mode 100755 index 0000000..93604bb --- /dev/null +++ b/lua/config/plugins/tree.lua @@ -0,0 +1,11 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("nvim-tree").setup {} + end, +} diff --git a/lua/config/plugins/treesitter.lua b/lua/config/plugins/treesitter.lua new file mode 100755 index 0000000..7fa2917 --- /dev/null +++ b/lua/config/plugins/treesitter.lua @@ -0,0 +1,46 @@ +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + -- A list of parser names, or "all" + ensure_installed = { + "vimdoc", "javascript", "typescript", "c", "lua", "rust", + "jsdoc", "bash", + }, + + -- 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, + + indent = { + enable = true + }, + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- 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 = { "markdown" }, + }, + }) + + local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs() + treesitter_parser_config.templ = { + install_info = { + url = "https://github.com/vrischmann/tree-sitter-templ.git", + files = {"src/parser.c", "src/scanner.c"}, + branch = "master", + }, + } + + vim.treesitter.language.register("templ", "templ") + end +} diff --git a/lua/config/plugins/undotree.lua b/lua/config/plugins/undotree.lua new file mode 100755 index 0000000..224af0f --- /dev/null +++ b/lua/config/plugins/undotree.lua @@ -0,0 +1,7 @@ +return { + "mbbill/undotree", + + config = function() + vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + end +} diff --git a/lua/config/plugins/whichkey.lua b/lua/config/plugins/whichkey.lua new file mode 100755 index 0000000..6f820e0 --- /dev/null +++ b/lua/config/plugins/whichkey.lua @@ -0,0 +1,13 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } +}