From 569d1ef6983c7aa39f778513a9f8e4cd251f7d6a Mon Sep 17 00:00:00 2001 From: Spacedio Date: Sun, 22 Feb 2026 10:07:58 -0500 Subject: Initial commit --- nvim/.config/nvim/init.lua | 3 + nvim/.config/nvim/lazy-lock.json | 25 +++ nvim/.config/nvim/lua/config/keybinds.lua | 72 +++++++++ nvim/.config/nvim/lua/config/lazy.lua | 26 +++ nvim/.config/nvim/lua/config/options.lua | 55 +++++++ nvim/.config/nvim/lua/plugins/colors.lua | 20 +++ nvim/.config/nvim/lua/plugins/lsp.lua | 231 +++++++++++++++++++++++++++ nvim/.config/nvim/lua/plugins/one-liners.lua | 16 ++ nvim/.config/nvim/lua/plugins/telescope.lua | 15 ++ nvim/.config/nvim/lua/plugins/treesitter.lua | 35 ++++ 10 files changed, 498 insertions(+) create mode 100644 nvim/.config/nvim/init.lua create mode 100644 nvim/.config/nvim/lazy-lock.json create mode 100644 nvim/.config/nvim/lua/config/keybinds.lua create mode 100644 nvim/.config/nvim/lua/config/lazy.lua create mode 100644 nvim/.config/nvim/lua/config/options.lua create mode 100644 nvim/.config/nvim/lua/plugins/colors.lua create mode 100644 nvim/.config/nvim/lua/plugins/lsp.lua create mode 100644 nvim/.config/nvim/lua/plugins/one-liners.lua create mode 100644 nvim/.config/nvim/lua/plugins/telescope.lua create mode 100644 nvim/.config/nvim/lua/plugins/treesitter.lua (limited to 'nvim') diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..e7df95d --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1,3 @@ +require('config.options') +require('config.keybinds') +require('config.lazy') diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..baa0789 --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,25 @@ +{ + "LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "21c2a84ce368e99b18f52ab348c4c02c32c02fcf" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-highlight-colors": { "branch": "main", "commit": "e2cb22089cc2358b2b995c09578224f142de6039" }, + "nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" }, + "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, + "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" } +} diff --git a/nvim/.config/nvim/lua/config/keybinds.lua b/nvim/.config/nvim/lua/config/keybinds.lua new file mode 100644 index 0000000..0b1f345 --- /dev/null +++ b/nvim/.config/nvim/lua/config/keybinds.lua @@ -0,0 +1,72 @@ +-- KEYBINDS +vim.g.mapleader = " " +vim.keymap.set("n", "cd", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") -- Alt Up/Down in vscode +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") -- Remap joining lines +vim.keymap.set("n", "", "zz") -- Keep cursor in place while moving up/down page +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") -- center screen when looping search results +vim.keymap.set("n", "N", "Nzzzv") + +-- map for quick quit, save files using leader key +---- Normal mode +vim.keymap.set('n', 'w', ':write') +vim.keymap.set('n', 'a', ':wqa') +vim.keymap.set('n', 'x', ':wq') + +-- paste and don't replace clipboard over deleted text +vim.keymap.set("x", "p", [["_dP]]) +vim.keymap.set({ "n", "v" }, "d", [["_d]]) + + +-- sometimes in insert mode, control-c doesn't exactly work like escape +vim.keymap.set("i", "", "") + +-- add binds for Control J/K to scroll thru quickfix list +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") + +-- What the heck is Ex mode? +vim.keymap.set("n", "Q", "") + +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +-- getting Alex off my back :) +vim.keymap.set("n", "dg", "DogeGenerate") + +-- lint / format php files for LC +vim.keymap.set("n", "cc", "!php-cs-fixer fix % --using-cache=no") + +-- Replace all instances of whatever is under cursor (on line) +vim.keymap.set("n", "s", [[:s/\<\>//gI]]) + +-- make file executable +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) + +-- yank into clipboard even if on ssh +vim.keymap.set('n', 'y', 'OSCYankOperator') +vim.keymap.set('v', 'y', 'OSCYankVisual') + +-- reload without exiting vim +vim.keymap.set("n", "rl", "source ~/.config/nvim/init.lua") + +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) + +-- Quickfix list stuff +vim.keymap.set("n", "cl", ":cclose", { silent = true }) +vim.keymap.set("n", "co", ":copen", { silent = true }) +vim.keymap.set("n", "cn", ":cnextzz") +vim.keymap.set("n", "cp", ":cprevzz") +vim.keymap.set("n", "li", ":checkhealth vim.lsp", { desc = "LSP Info" }) + +-- run make in current working directory +vim.keymap.set("n", "mm", "make") + +-- source file +vim.keymap.set("n", "", function() + vim.cmd("so") +end) diff --git a/nvim/.config/nvim/lua/config/lazy.lua b/nvim/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..d37016f --- /dev/null +++ b/nvim/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,26 @@ +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) + +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + change_detection = {notify = false} +}) diff --git a/nvim/.config/nvim/lua/config/options.lua b/nvim/.config/nvim/lua/config/options.lua new file mode 100644 index 0000000..02c6ef6 --- /dev/null +++ b/nvim/.config/nvim/lua/config/options.lua @@ -0,0 +1,55 @@ +-- OPTIONS +local set = vim.opt + +--line nums +set.relativenumber = true +set.number = true + +-- indentation and tabs +set.tabstop = 4 +set.shiftwidth = 4 +set.autoindent = true +set.expandtab = true + +-- search settings +set.ignorecase = true +set.smartcase = true + +-- appearance +set.termguicolors = true +set.background = "dark" +set.signcolumn = "yes" + +-- cursor line +set.cursorline = true + +-- 80th column +-- set.colorcolumn = "80" + +-- clipboard +set.clipboard:append("unnamedplus") + +-- backspace +set.backspace = "indent,eol,start" + +-- split windows +set.splitbelow = true +set.splitright = true + +-- dw/diw/ciw works on full-word +set.iskeyword:append("-") + +-- keep cursor at least 8 rows from top/bot +set.scrolloff = 8 + +-- undo dir settings +set.swapfile = false +set.backup = false +set.undodir = os.getenv("HOME") .. "/.vim/undodir" +set.undofile = true + +-- incremental search +set.incsearch = true + +-- faster cursor hold +set.updatetime = 50 diff --git a/nvim/.config/nvim/lua/plugins/colors.lua b/nvim/.config/nvim/lua/plugins/colors.lua new file mode 100644 index 0000000..851d256 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/colors.lua @@ -0,0 +1,20 @@ +local function enable_transparency() + vim.api.nvim_set_hl(0, "Normal", {bg = "none"}) +end +return { + { + "folke/tokyonight.nvim", + config = function() + vim.cmd.colorscheme "tokyonight" + end + }, + { + "nvim-lualine/lualine.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + opts = { + theme = 'tokyonight', + }, + } +} diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..2e2c368 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,231 @@ +return { + 'neovim/nvim-lspconfig', + dependencies = { + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + -- Autocompletion + 'hrsh7th/nvim-cmp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-nvim-lua', + -- Snippets + 'L3MON4D3/LuaSnip', + 'rafamadriz/friendly-snippets', + }, + config = function() + local autoformat_filetypes = { + "lua", + } + -- Create a keymap for vim.lsp.buf.implementation + vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if not client then return end + if vim.tbl_contains(autoformat_filetypes, vim.bo.filetype) then + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ + formatting_options = { tabSize = 4, insertSpaces = true }, + bufnr = args.buf, + id = client.id + }) + end + }) + end + end + }) + + -- Add borders to floating windows + vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( + vim.lsp.handlers.hover, + { border = 'rounded' } + ) + vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( + vim.lsp.handlers.signature_help, + { border = 'rounded' } + ) + + -- Configure error/warnings interface + vim.diagnostic.config({ + virtual_text = true, + severity_sort = true, + float = { + style = 'minimal', + border = 'rounded', + header = '', + prefix = '', + }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = '✘', + [vim.diagnostic.severity.WARN] = '▲', + [vim.diagnostic.severity.HINT] = '⚑', + [vim.diagnostic.severity.INFO] = '»', + }, + }, + }) + + -- Add cmp_nvim_lsp capabilities settings to lspconfig + -- This should be executed before you configure any language server + local lspconfig_defaults = require('lspconfig').util.default_config + lspconfig_defaults.capabilities = vim.tbl_deep_extend( + 'force', + lspconfig_defaults.capabilities, + require('cmp_nvim_lsp').default_capabilities() + ) + + -- This is where you enable features that only work + -- if there is a language server active in the file + vim.api.nvim_create_autocmd('LspAttach', { + callback = function(event) + local opts = { buffer = event.buf } + + vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.keymap.set('n', 'go', 'lua vim.lsp.buf.type_definition()', opts) + vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()', opts) + vim.keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()', opts) + vim.keymap.set('n', 'gl', 'lua vim.diagnostic.open_float()', opts) + vim.keymap.set('n', '', 'lua vim.lsp.buf.rename()', opts) + vim.keymap.set({ 'n', 'x' }, '', 'lua vim.lsp.buf.format({async = true})', opts) + vim.keymap.set('n', '', 'lua vim.lsp.buf.code_action()', opts) + end, + }) + + require('mason').setup({}) + require('mason-lspconfig').setup({ + ensure_installed = { + "lua_ls", + "intelephense", + "ts_ls", + "eslint", + }, + 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() + require('lspconfig').lua_ls.setup({ + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = { vim.env.VIMRUNTIME }, + }, + }, + }, + }) + end, + }, + }) + + local cmp = require('cmp') + + require('luasnip.loaders.from_vscode').lazy_load() + + vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } + + cmp.setup({ + preselect = 'item', + completion = { + completeopt = 'menu,menuone,noinsert' + }, + window = { + documentation = cmp.config.window.bordered(), + }, + sources = { + { name = 'path' }, + { name = 'nvim_lsp' }, + { name = 'buffer', keyword_length = 3 }, + { name = 'luasnip', keyword_length = 2 }, + }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + formatting = { + fields = { 'abbr', 'menu', 'kind' }, + format = function(entry, item) + local n = entry.source.name + if n == 'nvim_lsp' then + item.menu = '[LSP]' + else + item.menu = string.format('[%s]', n) + end + return item + end, + }, + mapping = cmp.mapping.preset.insert({ + -- confirm completion item + [''] = cmp.mapping.confirm({ select = false }), + + -- scroll documentation window + [''] = cmp.mapping.scroll_docs(5), + [''] = cmp.mapping.scroll_docs(-5), + + -- toggle completion menu + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.abort() + else + cmp.complete() + end + end), + + -- tab complete + [''] = cmp.mapping(function(fallback) + local col = vim.fn.col('.') - 1 + + if cmp.visible() then + cmp.select_next_item({ behavior = 'select' }) + elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + fallback() + else + cmp.complete() + end + end, { 'i', 's' }), + + -- go to previous item + [''] = cmp.mapping.select_prev_item({ behavior = 'select' }), + + -- navigate to next snippet placeholder + [''] = cmp.mapping(function(fallback) + local luasnip = require('luasnip') + + if luasnip.jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, { 'i', 's' }), + + -- navigate to the previous snippet placeholder + [''] = cmp.mapping(function(fallback) + local luasnip = require('luasnip') + + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + }) + end +} + diff --git a/nvim/.config/nvim/lua/plugins/one-liners.lua b/nvim/.config/nvim/lua/plugins/one-liners.lua new file mode 100644 index 0000000..fe240f1 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/one-liners.lua @@ -0,0 +1,16 @@ +return { + { "tpope/vim-fugitive" }, + { "ojroques/nvim-osc52" }, + { + "norcalli/nvim-colorizer.lua", + config = function() + require("colorizer").setup() + end, + }, + { + "brenoprata10/nvim-highlight-colors", + config = function() + require('nvim-highlight-colors').setup({}) + end + }, +} diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..49d1276 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,15 @@ +return { + 'nvim-telescope/telescope.nvim', version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + -- optional but recommended + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + }, + config = function() + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) + vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) + vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) + vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) + end +} diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..e430504 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,35 @@ +return { + 'nvim-treesitter/nvim-treesitter', + branch = 'master', -- Important: Use the 'main' branch + build = ':TSUpdate', + config = function() + + -- Configure nvim-treesitter with ensure_installed + require("nvim-treesitter.configs").setup({ + ensure_installed = { + 'lua', + 'vim', + 'python', + 'javascript', + 'typescript', + 'go', + 'yaml', + 'bash', + 'html', + 'css', + 'markdown', + 'markdown_inline', + 'sql', + }, + highlight = { + enable = true, + }, + indent = { + enable = true, + }, +}) + + + + end, +} -- cgit v1.2.3