From 31ef1b6103b743ea27dab1cdb8d03e12ff44c20a Mon Sep 17 00:00:00 2001 From: vx-clutch Date: Mon, 22 Dec 2025 20:14:52 -0500 Subject: [PATCH] new nvim conf --- nvim/.config/nvim/ftplugin/text.lua | 1 + nvim/.config/nvim/init.lua | 171 +------------------------- nvim/.config/nvim/lazy-lock.json | 14 --- nvim/.config/nvim/lsp/bashls.lua | 11 ++ nvim/.config/nvim/lsp/clangd.lua | 6 + nvim/.config/nvim/lsp/gopls.lua | 6 + nvim/.config/nvim/lsp/lua_ls.lua | 34 +++++ nvim/.config/nvim/lua/configs.lua | 8 ++ nvim/.config/nvim/lua/keymaps.lua | 12 ++ nvim/.config/nvim/lua/lsp.lua | 8 ++ nvim/.config/nvim/lua/plugins.lua | 10 ++ nvim/.config/nvim/nvim-pack-lock.json | 16 +++ 12 files changed, 116 insertions(+), 181 deletions(-) create mode 100644 nvim/.config/nvim/ftplugin/text.lua delete mode 100644 nvim/.config/nvim/lazy-lock.json create mode 100644 nvim/.config/nvim/lsp/bashls.lua create mode 100644 nvim/.config/nvim/lsp/clangd.lua create mode 100644 nvim/.config/nvim/lsp/gopls.lua create mode 100644 nvim/.config/nvim/lsp/lua_ls.lua create mode 100644 nvim/.config/nvim/lua/configs.lua create mode 100644 nvim/.config/nvim/lua/keymaps.lua create mode 100644 nvim/.config/nvim/lua/lsp.lua create mode 100644 nvim/.config/nvim/lua/plugins.lua create mode 100644 nvim/.config/nvim/nvim-pack-lock.json diff --git a/nvim/.config/nvim/ftplugin/text.lua b/nvim/.config/nvim/ftplugin/text.lua new file mode 100644 index 0000000..98f1b5a --- /dev/null +++ b/nvim/.config/nvim/ftplugin/text.lua @@ -0,0 +1 @@ +vim.opt.wrap = true diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 7c7a2e4..ae7516c 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,167 +1,4 @@ -vim.g.mapleader = " " - -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.swapfile = false -vim.opt.wrap = false -vim.opt.splitright = true -vim.opt.splitbelow = true - -vim.keymap.set("n", "", ":nohlsearch") -vim.keymap.set("n", "en", ":edit $MYVIMRC") -vim.keymap.set("n", "ez", ":edit ~/.zshrc") - -vim.keymap.set("v", "J", ":m '>+1gv=gv") -vim.keymap.set("v", "K", ":m '<-2gv=gv") - -for _, k in ipairs({ "h", "j", "k", "l" }) do - vim.keymap.set({ "n", "i", "v" }, "", "") -end - -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", - "--branch=stable", - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - { - "blazkowolf/gruber-darker.nvim", - priority = 1000, - config = function() - vim.cmd.colorscheme("gruber-darker") - end, - }, - { - "williamboman/mason.nvim", - build = ":MasonUpdate", - config = function() - require("mason").setup() - end, - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" }, - config = function() - local ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") - local capabilities = ok and cmp_nvim_lsp.default_capabilities() or - vim.lsp.protocol.make_client_capabilities() - - local servers = { "lua_ls", "clangd" } - - require("mason").setup() - require("mason-lspconfig").setup({ - ensure_installed = servers, - }) - - for _, name in ipairs(servers) do - local cfg = { capabilities = capabilities } - - if name == "lua_ls" then - cfg.settings = { - Lua = { - diagnostics = { globals = { "vim" } }, - workspace = { library = vim.api.nvim_get_runtime_file("", true) }, - }, - } - end - - local server_cfg = vim.lsp.config[name] - if not server_cfg then - vim.notify("LSP server config not found: " .. name, vim.log.levels.WARN) - else - local cmd = server_cfg.cmd or { name } - vim.lsp.start(vim.tbl_extend("force", cfg, { - name = name, - cmd = cmd, - root_dir = vim.fs.root(0, { ".git", "Makefile", "main.c", "go.mod" }), - settings = cfg.settings, - })) - end - end - end, - }, - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - }, - config = function() - local cmp = require("cmp") - cmp.setup({ - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "path" }, - }), - }) - end, - }, - { - "folke/snacks.nvim", - priority = 1000, - lazy = false, - opts = { - bigfile = { enabled = true }, - picker = { enabled = true }, - quickfile = { enabled = true }, - terminal = { - enabled = true, - float = { - border = "rounded", - width = 0.8, - height = 0.8, - }, - }, - }, - config = function(_, opts) - require("snacks").setup(opts) - vim.keymap.set("n", "", function() - require("snacks.terminal").toggle(nil, { float = true }) - end) - vim.keymap.set("t", "", function() - require("snacks.terminal").toggle(nil, { float = true }) - end) - end, - }, - { - 'nvim-telescope/telescope.nvim', - tag = '0.1.8', - dependencies = { 'nvim-lua/plenary.nvim' }, - config = function() - local builtin = require("telescope.builtin") - require("telescope").setup {} - vim.keymap.set("n", "g", builtin.live_grep) - vim.keymap.set("n", "f", builtin.find_files) - end - }, - { - "https://github.com/tpope/vim-fugitive" - }, -}) - -vim.api.nvim_create_autocmd('FileType', { - pattern = 'python', - callback = function() - vim.bo.expandtab = false - vim.bo.shiftwidth = 4 - vim.bo.tabstop = 4 - vim.bo.softtabstop = 4 - end, -}) - -vim.diagnostic.config { virtual_text = true, underline = true, signs = false } +require 'plugins' +require 'configs' +require 'lsp' +require 'keymaps' diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json deleted file mode 100644 index 204687f..0000000 --- a/nvim/.config/nvim/lazy-lock.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, - "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, - "gruber-darker.nvim": { "branch": "main", "commit": "98a2e141981cbd5a194a97eae024bf55af854579" }, - "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "f760507df8c49a4bf46a4d12e1fc616797508979" }, - "mason.nvim": { "branch": "main", "commit": "b3689a41dd77e5294498dba9757fb22cc80cbebd" }, - "nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" }, - "nvim-lspconfig": { "branch": "master", "commit": "336b388c272555d2ae94627a50df4c2f89a5e257" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "snacks.nvim": { "branch": "main", "commit": "5e0e8698526f350f1280ad1ef7a8670f857c9445" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" } -} diff --git a/nvim/.config/nvim/lsp/bashls.lua b/nvim/.config/nvim/lsp/bashls.lua new file mode 100644 index 0000000..0131205 --- /dev/null +++ b/nvim/.config/nvim/lsp/bashls.lua @@ -0,0 +1,11 @@ +---@type vim.lsp.Config +return { + cmd = { 'bash-language-server', 'start' }, + settings = { + bashIde = { + globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)', + }, + }, + filetypes = { 'bash', 'sh' }, + root_markers = { '.git' }, +} diff --git a/nvim/.config/nvim/lsp/clangd.lua b/nvim/.config/nvim/lsp/clangd.lua new file mode 100644 index 0000000..59b330a --- /dev/null +++ b/nvim/.config/nvim/lsp/clangd.lua @@ -0,0 +1,6 @@ +---@type vim.lsp.Config +return { + cmd = { 'clangd' }, + filetypes = { 'c', 'h' }, + root_markers = { 'Makefile', '.git' }, +} diff --git a/nvim/.config/nvim/lsp/gopls.lua b/nvim/.config/nvim/lsp/gopls.lua new file mode 100644 index 0000000..3e95fb5 --- /dev/null +++ b/nvim/.config/nvim/lsp/gopls.lua @@ -0,0 +1,6 @@ +---@type vim.lsp.Config +return { + cmd = { 'gopls' }, + filetypes = { 'go', 'gomod', 'gosum' }, + root_markers = { 'go.mod', 'go.sum' }, +} diff --git a/nvim/.config/nvim/lsp/lua_ls.lua b/nvim/.config/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..e35ad57 --- /dev/null +++ b/nvim/.config/nvim/lsp/lua_ls.lua @@ -0,0 +1,34 @@ +---@type vim.lsp.Config +return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { + '.luarc.json', + '.luarc.jsonc', + '.luacheckrc', + '.stylua.toml', + 'stylua.toml', + 'selene.toml', + 'selene.yml', + '.git', + }, + settings = { + Lua = { + runtime = { + version = "Lua 5.4", + }, + completion = { + enable = true, + }, + diagnostics = { + enable = true, + globals = { "vim" }, + }, + workspace = { + library = { vim.env.VIMRUNTIME }, + checkThirdParty = false, + }, + }, + }, +} + diff --git a/nvim/.config/nvim/lua/configs.lua b/nvim/.config/nvim/lua/configs.lua new file mode 100644 index 0000000..f07e562 --- /dev/null +++ b/nvim/.config/nvim/lua/configs.lua @@ -0,0 +1,8 @@ +local opt = vim.opt + +opt.number = true +opt.relativenumber = true +opt.swapfile = false +opt.wrap = false +opt.splitright = true +opt.splitbelow = true diff --git a/nvim/.config/nvim/lua/keymaps.lua b/nvim/.config/nvim/lua/keymaps.lua new file mode 100644 index 0000000..c875f93 --- /dev/null +++ b/nvim/.config/nvim/lua/keymaps.lua @@ -0,0 +1,12 @@ +local keymap = vim.keymap.set + +keymap("n", "", ":nohlsearch") +keymap("n", "en", ":edit $MYVIMRC") +keymap("n", "ez", ":edit ~/.zshrc") + +keymap("v", "J", ":m '>+1gv=gv") +keymap("v", "K", ":m '<-2gv=gv") + +for _, k in ipairs({ "h", "j", "k", "l" }) do + keymap({ "n", "i", "v" }, "", "") +end diff --git a/nvim/.config/nvim/lua/lsp.lua b/nvim/.config/nvim/lua/lsp.lua new file mode 100644 index 0000000..f5520b5 --- /dev/null +++ b/nvim/.config/nvim/lua/lsp.lua @@ -0,0 +1,8 @@ +vim.lsp.enable { + "bashls", + "gopls", + "lua_ls", + "clangd", +} + +vim.diagnostic.config { virtual_text = true, underline = true, signs = false } diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..98066de --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.lua @@ -0,0 +1,10 @@ +vim.g.mapleader = " " + +vim.pack.add { + { src = "https://github.com/mason-org/mason.nvim" }, + { src = "https://github.com/scottmckendry/cyberdream.nvim" }, +} + +require("mason").setup {} + +vim.cmd("colorscheme cyberdream") diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..a1cd5fb --- /dev/null +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,16 @@ +{ + "plugins": { + "cyberdream.nvim": { + "rev": "a43b45423e8494898c353c0604e0b2e4e99bd056", + "src": "https://github.com/scottmckendry/cyberdream.nvim" + }, + "mason.nvim": { + "rev": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800", + "src": "https://github.com/mason-org/mason.nvim" + }, + "simplyfile.nvim": { + "rev": "c4dfc0f3431898c3abbef267b226f6cdd2a67b38", + "src": "https://github.com/Rizwanelansyah/simplyfile.nvim" + } + } +} \ No newline at end of file