add nvim config

This commit is contained in:
maxscout
2025-06-30 21:21:27 -04:00
commit 21debd959b
15 changed files with 316 additions and 0 deletions

60
lua/config/init.lua Executable file
View File

@@ -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", "<leader>e", ":Tex<CR>")
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=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", "<Leader>t", ":split<CR>:term<CR>")
vim.keymap.set("n", "<Leader>f", ":Telescope find_files<CR>")
vim.keymap.set("n", "<Leader>e", ":NvimTreeToggle<CR>")
vim.keymap.set("n", "<Leader>n", ":tabnew<CR>:Telescope find_files<CR>")
vim.keymap.set("n", "<Leader>v", ":vsplit<CR>")
vim.keymap.set("n", "<Leader>h", ":split<CR>")
vim.keymap.set("n", "<Leader>m", ":Mason<CR>")
vim.keymap.set('t', "<C-q>", "<C-\\><C-n><C-w>h")
vim.keymap.set("n", "<Tab>", ":tabn<CR>")
vim.keymap.set("n", "<Tab>", ":tabp<CR>")
-- vim.keymap.set("", "j", "<Left>")
-- vim.keymap.set("", "k", "<Up>")
-- vim.keymap.set("", "l", "<Down>")
-- vim.keymap.set("", ";", "<Right>")
-- vim.keymap.set("n", "<C-j>", "<C-W>h")
-- vim.keymap.set("n", "<C-k>", "<C-W>k")
-- vim.keymap.set("n", "<C-l>", "<C-W>j")
-- vim.keymap.set("n", "<C-;>", "<C-W>l")
vim.keymap.set("n", "F", ":%s//<Left>")
vim.keymap.set("n", "f", ":%s//g<Left><Left>")

3
lua/config/lazy-lock.json Executable file
View File

@@ -0,0 +1,3 @@
{
}

14
lua/config/lazy.lua Executable file
View File

@@ -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"})

View File

@@ -0,0 +1,7 @@
return {
"m4xshen/autoclose.nvim",
lazy = false,
init = function ()
require("autoclose").setup()
end
}

7
lua/config/plugins/comment.lua Executable file
View File

@@ -0,0 +1,7 @@
return {
"numtoStr/Comment.nvim",
lazy = false,
init = function ()
require('Comment').setup()
end
}

View File

@@ -0,0 +1 @@
return { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }

95
lua/config/plugins/lsp.lua Executable file
View File

@@ -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({
['<Enter>'] = cmp.mapping.confirm({select = false}),
['<C-Space>'] = cmp.mapping.complete(),
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = 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
}
}

View File

@@ -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', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>pws', function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>pWs', function()
local word = vim.fn.expand("<cWORD>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
end
}

1
lua/config/plugins/theme.lua Executable file
View File

@@ -0,0 +1 @@
return { "catppuccin/nvim", name = "catppuccin", priority = 1000 }

11
lua/config/plugins/tree.lua Executable file
View File

@@ -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,
}

View File

@@ -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
}

View File

@@ -0,0 +1,7 @@
return {
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end
}

13
lua/config/plugins/whichkey.lua Executable file
View File

@@ -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
}
}