Compare commits

...

5 Commits

Author SHA1 Message Date
cole-maxwell1 92e6109ab6 Add: x12 AST 2026-04-22 12:16:06 -05:00
cole-maxwell1 0c59342399 Refactor: switch from packer to lazy.vim
- Packer is no longer maintained (as of August, 2023)
2026-04-22 09:27:59 -05:00
cole-maxwell1 b8c25c7bc1 Add: diff colors and dynamic diff window width sizing 2026-04-22 09:26:02 -05:00
cole-maxwell1 63568c466a Ignore: nvim plugin dir 2026-04-22 08:18:34 -05:00
cole-maxwell1 f151eae7e7 Remove: nvim plugin dir 2026-04-22 08:15:47 -05:00
12 changed files with 175 additions and 238 deletions
+13 -21
View File
@@ -1,34 +1,26 @@
local lsp_zero = require('lsp-zero') local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr) lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings -- see :help lsp-zero-keybindings
-- to learn the available actions -- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr}) lsp_zero.default_keymaps({
buffer = bufnr
})
end) end)
lsp_zero.set_sign_icons({ lsp_zero.set_sign_icons({
error = '', error = '',
warn = '', warn = '',
hint = '', hint = '',
info = '»' info = '»'
}) })
-- to learn how to use mason.nvim -- to learn how to use mason.nvim
-- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guide/integrate-with-mason-nvim.md -- read this: https://github.com/VonHeikemen/lsp-zero.nvim/blob/v3.x/doc/md/guide/integrate-with-mason-nvim.md
require('mason').setup({}) require('mason').setup({})
require('mason-lspconfig').setup({ require('mason-lspconfig').setup({
ensure_installed = { ensure_installed = {'lua_ls', 'ts_ls', 'eslint', 'gopls', 'rust_analyzer'},
'lua_ls', handlers = {function(server_name)
'tsserver', require('lspconfig')[server_name].setup({})
'eslint', end}
'gopls',
'rust_analyzer',
},
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({})
end,
},
}) })
+46
View File
@@ -0,0 +1,46 @@
-- Configure nvim-treesitter with defaults
require("nvim-treesitter").setup()
-- Register the custom x12 parser for the nvim-treesitter main branch API
vim.api.nvim_create_autocmd("User", {
pattern = "TSUpdate",
callback = function()
require("nvim-treesitter.parsers").x12 = {
install_info = {
url = "https://github.com/hugginsio/tree-sitter-x12",
files = {"src/parser.c"},
branch = "main",
generate_requires_npm = false,
requires_generate_from_grammar = false
},
filetype = "x12"
}
end
})
-- Explicitly trigger installation for the required parsers
require("nvim-treesitter").install({"bash", "c", "c_sharp", "diff", "go", "html", "javascript", "jsdoc", "json", "lua",
"luadoc", "luap", "markdown", "markdown_inline", "python", "query", "regex", "toml",
"tsx", "typescript", "vim", "vimdoc", "xml", "yaml", "x12"})
-- Automatically enable treesitter features for all buffers
local ts_group = vim.api.nvim_create_augroup("TreesitterStart", {
clear = true
})
vim.api.nvim_create_autocmd("FileType", {
group = ts_group,
callback = function(args)
-- Bypass treesitter if the file exceeds 200 MiB
local max_filesize = 200 * 1024 * 1024
local filepath = vim.api.nvim_buf_get_name(args.buf)
local ok, stats = pcall(vim.uv.fs_stat, filepath)
if ok and stats and stats.size > max_filesize then
return
end
-- Start treesitter highlighting
-- Using pcall prevents errors if a parser is missing for the current filetype
pcall(vim.treesitter.start, args.buf)
end
})
-27
View File
@@ -1,27 +0,0 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "javascript", "typescript", "go", "rust", "c", "lua", "vim", "vimdoc", "query" },
-- 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,
-- List of parsers to ignore installing (or "all")
-- ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
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 = false,
},
}
+7
View File
@@ -1 +1,8 @@
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("cole") require("cole")
+13
View File
@@ -0,0 +1,13 @@
{
"LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" },
"mason.nvim": { "branch": "main", "commit": "12ddd182d9efbdc848b540f16484a583d52da0fb" },
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
"nvim-lspconfig": { "branch": "master", "commit": "e146efacbafed3789ac568abcc5a981c5decaa58" },
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }
}
+7
View File
@@ -0,0 +1,7 @@
-- Register custom filetypes for EDI documents
vim.filetype.add({
extension = {
edi = "x12",
dat = "x12"
}
})
+2 -1
View File
@@ -1,4 +1,5 @@
require("cole.remap") require("cole.remap")
require("cole.set") require("cole.set")
require("cole.packer") require("cole.filetype")
require("cole.lazy")
+16
View File
@@ -0,0 +1,16 @@
require("lazy").setup({ -- Fuzzy finder
{
'nvim-telescope/telescope.nvim',
tag = '0.1.5',
dependencies = {'nvim-lua/plenary.nvim'}
}, -- syntax highlighting
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate'
}, -- LSP support
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
dependencies = {{'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'neovim/nvim-lspconfig'},
{'hrsh7th/nvim-cmp'}, {'hrsh7th/cmp-nvim-lsp'}, {'L3MON4D3/LuaSnip'}}
}})
-34
View File
@@ -1,34 +0,0 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Fuzzy finder
use {
'nvim-telescope/telescope.nvim',
tag = '0.1.5',
-- or, branch = '0.1.x',
requires = {{'nvim-lua/plenary.nvim'}}
}
-- syntax highlighting
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
-- LSP support
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
requires = {{'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'neovim/nvim-lspconfig'},
{'hrsh7th/nvim-cmp'}, {'hrsh7th/cmp-nvim-lsp'}, {'L3MON4D3/LuaSnip'}}
}
use {"williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim"}
end)
+61 -6
View File
@@ -1,21 +1,76 @@
--Line numbers -- Line numbers
vim.opt.nu = true vim.opt.nu = true
vim.opt.relativenumber = true vim.opt.relativenumber = true
--Formatting -- Formatting
vim.opt.tabstop = 4 vim.opt.tabstop = 4
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4
vim.opt.expandtab = true vim.opt.expandtab = true
vim.opt.smartindent = true vim.opt.smartindent = true
--Search -- Search
vim.opt.hlsearch = false vim.opt.hlsearch = false
vim.opt.incsearch = true vim.opt.incsearch = true
--Scroll settings -- Scroll settings
vim.opt.scrolloff = 8 --Always 8 lines above vim.opt.scrolloff = 8 -- Always 8 lines above
--Color scheme -- Color scheme
vim.cmd.colorscheme("habamax") vim.cmd.colorscheme("habamax")
-- Diff: Muted Red on Crimson
vim.api.nvim_set_hl(0, "DiffAdd", {
bg = "#1e3a1e",
fg = "NONE"
}) -- added lines: muted green
vim.api.nvim_set_hl(0, "DiffDelete", {
bg = "#3d1a1a",
fg = "#6b3a3a"
}) -- deleted lines: muted red
vim.api.nvim_set_hl(0, "DiffChange", {
bg = "#3a1c1c",
fg = "NONE"
}) -- changed lines: light red wash
vim.api.nvim_set_hl(0, "DiffText", {
bg = "#8b2035",
fg = "NONE",
bold = true
}) -- char diff: saturated red (crimson)
-- Dynamic diff window width sizing
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
if not vim.wo.diff then
return
end
-- Calculate the longest display-width line in the left (current) buffer.
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
local max_len = 0
for _, line in ipairs(lines) do
local len = vim.fn.strdisplaywidth(line)
if len > max_len then
max_len = len
end
end
-- Account for gutter columns (line numbers, sign column, fold column).
local gutter = 0
if vim.wo.number or vim.wo.relativenumber then
gutter = gutter + vim.wo.numberwidth
end
if vim.wo.signcolumn ~= "no" then
gutter = gutter + 2
end
gutter = gutter + vim.wo.foldcolumn
local desired = max_len + gutter + 1 -- +1 for the right edge padding
-- Cap at exactly half the terminal width.
local half = math.floor(vim.o.columns / 2)
local width = math.min(desired, half)
vim.api.nvim_win_set_width(0, width)
end
})
-149
View File
@@ -1,149 +0,0 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/Users/cole/.cache/nvim/packer_hererocks/2.1.1713773202/share/lua/5.1/?.lua;/Users/cole/.cache/nvim/packer_hererocks/2.1.1713773202/share/lua/5.1/?/init.lua;/Users/cole/.cache/nvim/packer_hererocks/2.1.1713773202/lib/luarocks/rocks-5.1/?.lua;/Users/cole/.cache/nvim/packer_hererocks/2.1.1713773202/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/cole/.cache/nvim/packer_hererocks/2.1.1713773202/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
LuaSnip = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["lsp-zero.nvim"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["nvim-cmp"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-treesitter"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["packer.nvim"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/Users/cole/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
}
}
time([[Defining packer_plugins]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end
+10
View File
@@ -0,0 +1,10 @@
(segment_header) @keyword
[
(element_separator)
(component_element_separator)
(segment_separator)
] @comment
(alphanumeric) @string
(numeric) @number