include i3 and nvim configuration in the central repository, rather than keep them in their seperate respective ones.

This commit is contained in:
2025-11-19 10:06:30 +01:00
parent 9ece4e28de
commit ab5ff2bffc
41 changed files with 1409 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
[*]
charset = UTF-8
end_of_line = LF
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = tab
[*.lua]
indent_style = tab
indent_size = tab

5
.config/nvim/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
.luarc.json
nvim
*.vim
lazy-lock.json

19
.config/nvim/LICENSE.md Normal file
View File

@@ -0,0 +1,19 @@
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

13
.config/nvim/README.md Normal file
View File

@@ -0,0 +1,13 @@
# Quinn's NeoVim configuration
### Required/Recommended tools:
- cURL
- git
- C compiler
- Rust toolchain
- lf
- fd
- clang-format
- rustfmt
- shfmt
- yq
- lua5.1

10
.config/nvim/docs/TODO.md Normal file
View File

@@ -0,0 +1,10 @@
# TODO
- [X] keybind to edit multiple lines at once (have multiple cursors)
- [ ] keybind to rename symbol
- [ ] have TAB in insert mode automatically bring me up to the right indentation.
- [X] debugger
- [X] launch on f5
- [x] breakpoints
- [X] can set breakpoints
- [X] breakpoints look nice
- [ ] plugin for markdown to make taking notes like these easier?

11
.config/nvim/init.lua Normal file
View File

@@ -0,0 +1,11 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
Autocmd = vim.api.nvim_create_autocmd
Map = vim.keymap.set
---@class userdata
---@field palette GruvboxPalette
_G.userdat = {}
require('config')

View File

@@ -0,0 +1,73 @@
-- highlight when yanking text
Autocmd('TextYankPost', {
desc = 'highlight when yanking text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- disable new line comment
Autocmd("BufEnter", {
desc = "disable bew line comment",
callback = function()
vim.opt.formatoptions:remove({ "c", "r", "o" })
end,
})
-- go to last location when opening a buffer
Autocmd("BufReadPost", {
desc = "go to last location when opening a buffer",
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
-- close certain windows with q
Autocmd('FileType', {
desc = 'close certain windows with q',
pattern = { 'help', 'man', 'qf', 'query', 'messages', 'netrw' },
callback = function(evt)
vim.bo[evt.buf].buflisted = false
Map('n', 'q', '<cmd>close<cr>')
end
})
-- disable spellcheck in terminal
Autocmd('TermOpen', {
callback = function()
vim.opt.spell = false
end,
})
-- closes the first buffer if it is empty
Autocmd('BufEnter', {
pattern = '*',
callback = function()
local bufs = vim.api.nvim_list_bufs()
-- check if the first buffer is an empty one
if #bufs == 0 and vim.api.nvim_get_option_value('buftype', { buf = bufs[1] }) and vim.api.nvim_buf_get_name(bufs[1]) then
vim.api.nvim_buf_delete(bufs[1], {})
end
end,
})
---@type table<string, string>
local filemap = {
['*.h'] = 'c',
['*/i3/**.conf'] = 'i3config'
}
for pat, file in pairs(filemap) do
Autocmd('BufRead', {
pattern = pat,
callback = function()
vim.bo.filetype = file
end
})
end

View File

@@ -0,0 +1,4 @@
require('config.opts')
require('config.maps')
require('config.autocmds')
require('config.lazy')

View File

@@ -0,0 +1,24 @@
-- bootstrap lazy
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' },
}, true, {})
return 1
end
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
change_detection = { enabled = false },
defaults = {
lazy = true,
},
spec = { { import = 'plugin' } },
})
Map('n', '<leader>L', '<cmd>Lazy<cr>', { desc = 'open Lazy' })

View File

@@ -0,0 +1,45 @@
-- unmap arrow keys in non-insert modes
Map({ 'n', 'v' }, '<up>', '<nop>')
Map({ 'n', 'v' }, '<down>', '<nop>')
Map({ 'n', 'v' }, '<left>', '<nop>')
Map({ 'n', 'v' }, '<right>', '<nop>')
-- tab management / navigation
Map('n', '<c-t>', '<cmd>enew<cr>', { desc = 'create a new tab' })
-- for help exiting certain modes
Map({ 'n', 'i' }, '<esc>', '<cmd>nohlsearch<cr><esc>', { desc = 'cancel search highlighting and escape' })
Map('t', '<c-esc>', '<c-\\><c-n>', { desc = 'exit terminal mode' })
-- window management
Map('n', '<m-s>', '<cmd>wincmd s<cr>', { desc = 'horizontal split' })
Map('n', '<m-v>', '<cmd>wincmd v<cr>', { desc = 'vertical split' })
Map('n', '<c-h>', '<cmd>wincmd h<cr>', { desc = 'move focus to the left window' })
Map('n', '<c-l>', '<cmd>wincmd l<cr>', { desc = 'move focus to the right window' })
Map('n', '<c-j>', '<cmd>wincmd j<cr>', { desc = 'move focus to the lower window' })
Map('n', '<c-k>', '<cmd>wincmd k<cr>', { desc = 'move focus to the upper window' })
Map('n', '<m-H>', '<cmd>wincmd H<cr>', { desc = 'move window to left' })
Map('n', '<m-L>', '<cmd>wincmd L<cr>', { desc = 'move window to right' })
Map('n', '<m-K>', '<cmd>wincmd K<cr>', { desc = 'move window to top' })
Map('n', '<m-J>', '<cmd>wincmd J<cr>', { desc = 'move window to bottom' })
-- diagnostic / lsp key bindings
Map('n', 'K', vim.lsp.buf.hover, { desc = 'symbol hover' })
Map('n', '<F2>', vim.lsp.buf.rename, { desc = 'rename symbol' })
Map('n', '<leader>lm', vim.diagnostic.open_float, { desc = 'view line\'s diagnostic messages' })
Map('n', '<leader>q', vim.lsp.buf.code_action, { desc = 'view quickfix list' })
-- smart tabulation
Map('i', '<tab>', function()
local _, col = unpack(vim.api.nvim_win_get_cursor(0)) -- get cursor position
local isindent = vim.api.nvim_get_current_line():sub(1, col):match('^%s*$')
local tabexpnd = vim.bo.expandtab
local tabwidth = vim.bo.shiftwidth > 0 and vim.bo.shiftwidth or vim.bo.tabstop
if not tabexpnd and isindent then
return '\t'
else
local spaces = tabwidth - col % tabwidth
return string.rep(' ', spaces == 0 and tabwidth or spaces)
end
end, { expr = true, desc = "smart tabulation" })

View File

@@ -0,0 +1,59 @@
local o = vim.opt
-- set options
o.clipboard = "unnamedplus" -- keep the clipboard in sync with the one provided by the OS
o.termguicolors = true -- allows for colour in the terminal
o.number = true -- show line numbers
o.cursorline = true -- highlight the current line
o.cursorcolumn = false -- highlight the current column
o.dir = vim.fn.stdpath('cache') .. '/swp' -- swap directory location for recovery
o.sessionoptions = 'buffers,curdir,folds,help,localoptions,tabpages,terminal'
o.expandtab = false -- whether tabs are expanded to spaces (overridden by .editorconfig)
o.diffopt = 'internal,filler,closeoff,linematch:60' -- diff visualisation
o.foldenable = true -- whether folding is enabled
o.wrap = false -- whether to wrap text to a new line when it goes off-screen
o.breakindent = true -- wrapped lines start at the same location as the start of the line
o.list = true -- shows invisible characters
o.listchars = { -- whitespace characters
eol = nil,
trail = '~',
extends = nil,
precedes = '<',
tab = '•-',
space = '·',
nbsp = '',
}
o.mouse = 'nv' -- which modes the mouse is enabled in 'a:all'
o.relativenumber = true -- whether line numbers are relative to the cursor
o.scrolloff = 10 -- minimal number of screen lines to keep above and below the cursor
o.showtabline = 2 -- whether to show the tab line
o.signcolumn = 'yes' -- always show the signcolumn, otherwise it shifts text all the time
o.tabstop = 8 -- visual spaces per tab
o.softtabstop = 8 -- spaces inserted per tab in insert mode
o.shiftwidth = 8 -- spaces for auto-indent
o.smartindent = true -- behave a bit more nuanced with when to indent
o.ignorecase = true -- whether case should be ignored whilst searching
o.smartcase = true -- overrides the above option if contains capital letters
o.inccommand = 'split' -- split|nosplit whether substitutions should appear whilst typing.
o.splitbelow = true -- force all horizontal splits below the current window
o.splitright = true -- force all vertical splits to the right of this window
o.showmode = false -- don't show mode as this is already in the status line
o.undodir = vim.fn.stdpath('cache') .. '/undo' -- directory for undo files
o.undofile = true -- for saving the undo history
o.undolevels = 1024 -- the amount of changes that can be undone
o.timeoutlen = 300 -- number of MS to wait for a mapped sequence to complete
o.ttimeoutlen = 0 -- number of MS to wait for a key sequence to complete
o.updatetime = 250 -- number of MS of nothing typed to write a swap file to disk.
o.spell = true -- whether spell checking is enabled
o.spelllang = 'en_gb,nl' -- set the spell languages
o.spellfile = vim.fn.stdpath('config') .. '/spell/user.utf-8.add'
vim.diagnostic.config({
underline = true, -- use underline for diagnostics
virtual_text = true, -- shows diagnostics at the end of the line
virtual_lines = false, -- shows one diagnostic per line
severity_sort = true, -- sort diagnostics by severity
update_in_insert = true, -- update diagnostics whilst in insert mode
float = true, -- options for floating windows
signs = true,
})

View File

@@ -0,0 +1,44 @@
---@type LazySpec
return {
"rmagatti/auto-session",
lazy = false,
priority = 100,
---@module "auto-session"
---@type AutoSession.Config
opts = {
enabled = true,
auto_save = true,
auto_create = true,
auto_restore = true,
auto_restore_last_session = false,
cwd_change_handling = true,
single_session_mode = false,
close_unsupported_windows = true,
suppressed_dirs = { '~/', '~/software/', '~/downloads/', '~/desktop/', '/etc/' },
close_filetypes_on_save = { 'checkhealth', 'man', 'oil' },
bypass_save_filetypes = { 'netrw', 'oil' },
auto_delete_empty_sessions = true,
purge_after_minutes = 14 * 24 * 60,
lazy_support = true,
legacy_cmds = false,
args_allow_single_directory = true,
args_allow_files_auto_save = false,
-- log_level = 'debug',
show_auto_restore_notif = true,
},
init = function()
local path = vim.fn.argv(0)
if not path or type(path) ~= 'string' then return end
local realpath = vim.uv.fs_realpath(path)
if not realpath then return end
if vim.fn.isdirectory(realpath) ~= 1 then return end
vim.fn.chdir(realpath)
vim.notify("loaded directory: '" .. realpath .. "'", vim.log.levels.INFO)
end,
}

View File

@@ -0,0 +1,32 @@
---@type LazySpec
return { {
'windwp/nvim-autopairs', -- automatically inserts closing brackets
event = { 'BufReadPre', 'BufNewFile' },
opts = {
enable_moveright = true, -- moves the cursor over existing pairs instead of inserting duplicates
check_ts = true, -- whether to check treesitter for specific nodes
ts_config = {}
},
config = function(_, opts)
local autopairs = require 'nvim-autopairs'
autopairs.setup(opts)
-- customise the rule for [] brackets so it doesn't close when typing ANSI escape codes
local rule = autopairs.get_rule '['
if rule then
rule:with_pair(function(opt)
local ei = math.max(1, opt.col - 1) -- get the end-index
local prev_oct = opt.line:sub(math.max(1, opt.col - 4), ei) -- get the range of an octal escape code
local prev_hex = opt.line:sub(math.max(1, opt.col - 4), ei) -- get the range of a hexadecimal escape code
local prev_cha = opt.line:sub(math.max(1, opt.col - 2), ei) -- get the range of a character escape code
-- check whether we can't match any of the patterns,
-- if so return true, otherwise return false (whether to insert a pair)
return (prev_oct ~= [[\033]] and prev_hex ~= [[\x1b]] and prev_cha ~= [[\e]])
end)
else
vim.notify('could not add a rule for not auto-closing [ when typing an ANSI escape code',
vim.log.levels.WARN)
end
end,
} }

View File

@@ -0,0 +1,69 @@
---@module 'lazy'
---@type LazySpec
return { {
'saghen/blink.cmp',
event = 'InsertEnter',
version = '*',
build = 'cargo build --release',
dependencies = {
'saghen/blink.compat',
},
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
keymap = {
preset = 'none',
['<tab>'] = { 'accept', 'fallback' }, -- accept the snippet
['<c-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, -- toggle auto-cmp manually
['<c-k>'] = { 'show_signature', 'hide_signature', 'fallback' }, -- toggle signature
['<c-n>'] = { 'select_next', 'fallback' }, -- next item
['<c-p>'] = { 'select_prev', 'fallback' }, -- previous item
['<c-f>'] = { 'scroll_documentation_down', 'fallback' }, -- forwards into the docs
['<c-b>'] = { 'scroll_documentation_up', 'fallback' }, -- backwards into the docs
['<c-e>'] = { 'cancel', 'fallback' }, -- keybind for cancelling completion
},
snippets = { preset = 'luasnip' },
sources = {
default = { 'lsp', 'path', 'snippets' },
},
completion = {
menu = {
auto_show = true, -- whether to automatically show the window when new completion items are available
border = 'rounded',
draw = {
columns = { { "kind_icon" }, { "label", "label_description", gap = 1 }, { 'kind' } },
treesitter = { 'lsp', 'snippets' },
},
},
documentation = {
auto_show = true, -- whether documentation is automatically shown when selecting a completion item
auto_show_delay_ms = 250,
treesitter_highlighting = true,
window = { border = "rounded" },
},
list = { selection = { preselect = true, auto_insert = true } },
trigger = {
show_on_insert_on_trigger_character = true,
show_on_accept_on_trigger_character = true,
show_in_snippet = false,
},
ghost_text = {
enabled = true,
show_with_selection = false, -- whether the ghost text is shown when an item is selected
show_without_selection = true, -- whether the ghost text is shown when no item is selected
show_with_menu = true, -- show ghost text when the menu is open
show_without_menu = true, -- show ghost text when the menu is closed
}
},
fuzzy = {
use_proximity = true,
frecency = { enabled = true, },
prebuilt_binaries = {
download = false, -- we are building from source
}
}
},
config = function(_, opts)
require("blink.cmp").setup(opts)
end
} }

View File

@@ -0,0 +1,29 @@
---@type LazySpec
return { {
'akinsho/bufferline.nvim', -- shows the opened buffers
event = 'VeryLazy',
dependencies = { 'nvim-tree/nvim-web-devicons', },
---@type bufferline.UserConfig
opts = {
options = {
mode = 'buffers',
separator_style = '',
sort_by = 'directory',
diagnostics = 'nvim_lsp',
diagnostics_indicator = function(c, _, _, _)
return '(' .. c .. ')'
end,
},
},
config = function(_, opts)
require('bufferline').setup(opts)
Map('n', '<tab>', '<cmd>BufferLineCycleNext<cr>', { desc = 'switch to the next tab' })
Map('n', '<s-tab>', '<cmd>BufferLineCyclePrev<cr>', { desc = 'switch to the previous tab' })
Map('n', '<leader>wch', '<cmd>BufferLineCloseLeft<cr>', { desc = 'close the tabs on the left' })
Map('n', '<leader>wcl', '<cmd>BufferLineCloseRight<cr>', { desc = 'close the tabs on the right' })
Map('n', '<leader>wcw', '<cmd>BufferLineCloseOthers<cr>',
{ desc = 'close all tabs except the current one' })
end,
} }

View File

@@ -0,0 +1,38 @@
---@module 'lazy'
---@type LazySpec
return { {
'stevearc/conform.nvim', -- allows you to format a buffer
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' } -- execute the formatter
-- vim.cmd [[keepjumps keeppatterns %s/\s\+$//e]] -- removes trailing whitespace
end,
mode = 'n',
desc = '[f]ormat buffer',
},
},
---@type conform.setupOpts
opts = {
notify_on_error = true,
formatters_by_ft = {
c = { 'clang-format' },
h = { 'clang-format' },
cpp = { 'clang-format' },
hpp = { 'clang-format' },
glsl = { 'clang-format', lsp_format = "first" },
typescript = { 'clang-format', lsp_format = "first" },
css = { 'clang-format' },
rust = { 'rustfmt' },
sh = { 'shfmt' },
python = { 'isort' },
-- json = { 'jq' },
-- yaml = { 'yq' },
toml = { 'yq' },
xml = { 'yq' },
},
}
} }

View File

@@ -0,0 +1,54 @@
---@type LazySpec
return { {
'lewis6991/gitsigns.nvim', -- adds git signs to the signcolumn
event = 'VeryLazy',
opts = {
signs_staged_enable = true, -- whether staged statuses are enabled
signcolumn = true, -- the signs enable/disable based on the signcolumn state
current_line_blame = true, -- show the blame of the current line
current_line_blame_opts = {
delay = 50, -- delay in MS before blame is shown
ignore_whitespace = true, -- whether to ignore whitespace
use_focus = true, -- whether to only enable when the buffer is in focus
},
signs = { -- signs when working
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signs_staged = { -- signs when staged
add = { text = 'A' },
change = { text = 'M' },
delete = { text = 'D' },
topdelete = { text = 'D' },
changedelete = { text = 'M' },
untracked = { text = 'U' },
},
attach_to_untracked = true, -- shows untracked files' signcolumn
},
config = function(_, opts)
require('gitsigns').setup(opts)
local palette = _G.userdat.palette
local bg = vim.api.nvim_get_hl(0, { name = 'SignColumn' }).bg
for n, fg in pairs {
GitSignsAdd = palette.bright_green,
GitSignsChange = palette.bright_orange,
GitSignsDelete = palette.bright_red,
GitSignsTopdelete = palette.bright_red,
GitSignsChangedelete = palette.bright_orange,
GitSignsUntracked = palette.bright_aqua,
GitSignsStagedAdd = palette.neutral_green,
GitSignsStagedChange = palette.neutral_orange,
GitSignsStagedDelete = palette.neutral_red,
GitSignsStagedTopDelete = palette.neutral_red,
GitSignsStagedChangedelete = palette.neutral_orange,
GitSignsStagedUntracked = palette.neutral_aqua,
} do
vim.api.nvim_set_hl(0, n, { fg = fg, bg = bg })
end
end,
} }

View File

@@ -0,0 +1,31 @@
---@type LazySpec
return { {
'ellisonleao/gruvbox.nvim',
lazy = false,
dependencies = { 'johnfrankmorgan/whitespace.nvim' },
priority = 1000,
---@type GruvboxConfig
opts = {
styles = {
comments = { italic = true }
}
},
config = function(_, opts)
local colour = require('gruvbox')
colour.setup(opts)
vim.cmd.colorscheme('gruvbox')
_G.userdat.palette = colour.palette
-- non-essential configuration should be put in here
Autocmd('VimEnter', {
callback =
function()
-- spell highlight must be grey
for _, spell in pairs { 'SpellBad', 'SpellCap', 'SpellRare', 'SpellLocal' } do
vim.api.nvim_set_hl(0, spell,
{ fg = nil, bg = nil, sp = _G.userdat.palette.gray, undercurl = true })
end
end
})
end
} }

View File

@@ -0,0 +1,12 @@
---@module 'lazy'
---@type LazySpec
return { {
'folke/lazydev.nvim', -- provides the lua LSP for the neovim config.
event = 'VeryLazy',
ft = 'lua',
opts = {
library = {
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } }, -- load luvit types when the `vim.uv` word is found
},
},
}, }

View File

@@ -0,0 +1,21 @@
---@module 'lazy'
---@type LazySpec
return { {
'lmburns/lf.nvim',
lazy = false,
dependencies = { 'akinsho/toggleterm.nvim' },
---@module 'lf'
---@type Lf.Config
opts = {
direction = 'float',
border = 'rounded',
},
config = function(_, opts)
vim.g.lf_netrw = 1
local lf = require('lf')
lf.setup(opts)
Map({ 'n' }, '<leader>o', lf.start, { desc = 'Shows the LF window' })
end
} }

View File

@@ -0,0 +1,5 @@
---@type LazySpec
return { {
'ray-x/lsp_signature.nvim',
opts = { always_trigger = false }
} }

View File

@@ -0,0 +1,51 @@
---@module 'lazy'
---@type LazySpec
return { {
'neovim/nvim-lspconfig',
event = { "BufReadPre", "BufNewFile" },
dependencies = { 'saghen/blink.cmp' },
---@type table<string, boolean|vim.lsp.Config>
opts = {
['clangd'] = true,
['ccls'] = false,
['glsl_analyzer'] = true,
['rust_analyzer'] = true,
['omnisharp'] = false,
['lua_ls'] = true,
['html'] = true,
['cssls'] = true,
['ts_ls'] = true,
['jsonls'] = true,
['yamlls'] = {
settings = {
yaml = {
schemas = {
["https://json.schemastore.org/github-workflow.json"] =
"/.github/workflows/*",
["https://json.schemastore.org/clang-format"] = ".clang-format",
["https://json.schemastore.org/clang-tidy"] = ".clang-tidy",
},
},
},
},
},
---@param opts table<string,boolean|vim.lsp.Config>
config = function(_, opts)
-- store the default capabilities
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- enable the LSP
for server, config in pairs(opts) do
if type(config) == 'boolean' then
vim.lsp.enable(server, config)
else
vim.lsp.enable(server, true)
vim.lsp.config[server] = vim.tbl_deep_extend('force', {}, vim.lsp.config[server],
config or {})
end
vim.lsp.config[server].capabilities = capabilities
end
end
} }

View File

@@ -0,0 +1,5 @@
return { {
'L3MON4D3/LuaSnip',
build = 'make install_jsregexp',
version = "v2.*",
} }

View File

@@ -0,0 +1,71 @@
---@type LazySpec
return { {
'echasnovski/mini.nvim',
config = function()
require('mini.ai').setup()
require('mini.surround').setup()
require('mini.operators').setup()
require('mini.indentscope').setup({
symbol = '¦',
draw = {
delay = 50, -- delay in MS before writing the indicator
animation = require('mini.indentscope').gen_animation.none(),
},
options = {
try_as_border = false,
},
})
vim.api.nvim_set_hl(0, 'MiniIndentscopeSymbol', { fg = _G.userdat.palette.dark2, bg = nil })
require('mini.move').setup({
mappings = {
-- move visual selection in visual mode
left = '<m-h>',
down = '<m-j>',
up = '<m-k>',
right = '<m-l>',
-- move current line in normal mode
line_left = '<m-h>',
line_down = '<m-j>',
line_up = '<m-k>',
line_right = '<m-l>',
},
options = {
reindent_linewise = true, -- automatically re-indent selection during line vertical move
},
})
require('mini.statusline').setup({
content = {
active = function()
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
local git = MiniStatusline.section_git({ trunc_width = 40 })
local diff = MiniStatusline.section_diff({ trunc_width = 75 })
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
return MiniStatusline.combine_groups({
{ hl = mode_hl, strings = { mode } },
{ hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } },
'%<', -- general truncation point
{ hl = 'MiniStatuslineFilename', strings = { filename } },
'%=', -- align right
{ hl = 'MiniStatuslineFileInfo', strings = { fileinfo } },
{ hl = mode_hl, strings = { '%3l:%-3c' } }
})
end,
inactive = function()
return MiniStatusline.combine_groups({
{},
})
end
},
use_icons = true,
set_vim_settings = true,
})
end
} }

View File

@@ -0,0 +1,59 @@
---@module 'lazy'
---@type LazySpec
return { {
'mfussenegger/nvim-lint',
event = { 'BufWritePost', 'BufReadPost', 'TextChanged' },
---@module 'lint'
opts = {
---@type table<string, string[]>
linters_by_ft = {
c = { 'clangtidy' },
cpp = { 'clangtidy' },
sh = { 'shellcheck' },
glsl = { 'glslang' },
},
linters = {
glslang = {
cmd = 'glslangValidator',
stdin = false,
args = { '-C' },
ignore_exitcode = true,
parser = function(output)
local diags = {}
for _, line in ipairs(vim.split(output, '\n')) do
local f, lnum, sev, msg = line:match(
'^([^:]+):(%d+):%s+([^:]+):%s+(.+)$') -- file:line: severity: message
if not f then sev, f, lnum, msg = line:match(
'^(%w+):%s+([^:]+):(%d+):%s+(.+)$') end -- severity: file:line: message
if lnum then
local s = sev:lower() == 'error'
and vim.diagnostic.severity.ERROR
or vim.diagnostic.severity.WARN
table.insert(diags, {
lnum = tonumber(lnum) - 1,
col = 0,
message = msg,
source = 'glslang',
severity = s
})
end
end
return diags
end
}
}
},
config = function(_, opts)
local lint = require('lint')
lint.linters_by_ft = opts.linters_by_ft
for name, linter in pairs(opts.linters) do
lint.linters[name] = linter
end
-- autocommand for linting
Autocmd({ 'BufWritePost', 'BufWinEnter', 'TextChanged' },
{ callback = function() lint.try_lint() end });
end
} }

View File

@@ -0,0 +1,74 @@
---@module 'lazy'
---@type LazySpec
return { {
'nvim-treesitter/nvim-treesitter', -- highlight, edit, and navigate code
event = 'BufReadPre',
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- set main module to use for opts
opts = {
ensure_installed = {
'bash', 'c', 'make', 'rust', 'diff',
'markdown', 'markdown_inline', 'latex',
'vim', 'vimdoc', 'lua', 'luadoc', 'regex',
},
auto_install = true, -- auto-install languages that are not installed
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'ruby' }, -- some languages depend on vim's regex highlighting system for indent rules
},
indent = { enable = true, disable = { 'ruby' } },
},
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
-- set the keybind for appending in front of a comment, rather than behind.
Map('n', 'A', function()
local ts = vim.treesitter -- get reference to treesitter
local buf = vim.api.nvim_get_current_buf() -- get the current buffer id
local row, col = unpack(vim.api.nvim_win_get_cursor(0)) -- get cursor position
-- ensure the parser exists
local res = nil
repeat
-- get the parser
if not ts.language.get_lang(vim.bo[buf].filetype) then break end
local parser = ts.get_parser(buf, nil, { error = false })
if not parser then break end
-- query the buffer using the parser
local root = parser:parse()[1]:root()
local ok, dat = pcall(ts.query.parse, parser:lang(), [[(comment) @comment]])
if not ok or not dat then break end
-- set the result
res = { query = dat, root = root }
until true
-- check if we successfully made a query
if res then
-- loop through the captures from the query
for _, node in res.query:iter_captures(res.root, buf, row - 1, row) do
-- ensure the comment is on the same row as the cursor and after the cursor's column
local srow, scol, _, _ = node:range() -- extract the starting row and starting column
if srow ~= row - 1 or col >= scol then goto continue end
-- get the line text and remove trailing whitespace
local txt = vim.api.nvim_buf_get_lines(buf, srow, srow + 1, true)[1]:sub(0, scol)
txt = txt:gsub("%s*$", "")
local len = txt:len()
-- check if we found a match
if len > 0 then
vim.api.nvim_win_set_cursor(0, { row, len })
vim.cmd [[startinsert]]
return
end
::continue:: -- lua is stupid
end
end
-- no comment start was found, behave like normal (moves cursor to the end of the line)
vim.cmd [[startinsert!]]
end, { desc = 'append end of line' })
end,
} }

View File

@@ -0,0 +1,13 @@
---@module 'lazy'
---@type LazySpec
return { {
'MeanderingProgrammer/render-markdown.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' },
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {
completions = {
blink = { enabled = true }
}
}
} }

View File

@@ -0,0 +1,83 @@
---@module 'snacks'
---@module 'lazy'
---@type LazySpec
return { { -- provides quality of life features for neovim
'folke/snacks.nvim',
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
animate = { enabled = false }, -- efficient animations including over 45 easing functions (library)
bigfile = { enabled = false }, -- deal with big files
bufdelete = { enabled = false }, -- delete buffers without disrupting window layout
dashboard = { enabled = false }, -- beautiful declarative dashboards
debug = { enabled = false }, -- pretty inspect & backtraces for debugging
dim = { enabled = false }, -- focus on the active scope by dimming the rest
explorer = { enabled = false }, -- a file explorer (picker in disguise)
git = { enabled = false }, -- git utilities
gitbrowse = { enabled = false }, -- open the current file, branch, commit, or repo in a browser (e.g. github, gitlab, etc.)
image = { enabled = true }, -- image viewer using kitty graphics protocol
indent = { enabled = false }, -- indent guides and scopes
input = { enabled = false }, -- better vim.ui.input
layout = { enabled = false }, -- window layouts
lazygit = { enabled = false }, -- open lazygit in a float, auto-configure colour scheme and integration with neovim
notifier = { enabled = true }, -- pretty vim.notify
notify = { enabled = true }, -- utility functions to work with neovim's vim.notify
picker = { enabled = false }, -- picker for selecting items
profiler = { enabled = false }, -- neovim lua profiler
quickfile = { enabled = true }, -- when doing nvim somefile.txt, it will render the file as quickly as possible, before loading your plugins.
rename = { enabled = true }, -- LSP-integrated file renaming with support for plugins like and.
scope = { enabled = false }, -- scope detection, text objects and jumping based on treesitter or indent
scratch = { enabled = false }, -- scratch buffers with a persistent file
scroll = { enabled = false }, -- smooth scrolling
statuscolumn = { enabled = false }, -- pretty status column
terminal = { enabled = false }, -- create and toggle floating/split terminals
toggle = { enabled = false }, -- toggle keymaps integrated with which-key icons / colours
util = { enabled = false }, -- utility functions for Snacks (library)
win = { enabled = false }, -- create and manage floating windows or splits
words = { enabled = true }, -- auto-show LSP references and quickly navigate between them
zen = { enabled = false }, -- zen mode; distraction-free coding
},
keys = {
{ '*', function() Snacks.words.jump(-vim.v.count1) end, desc = 'next reference', nowait = true },
{ '#', function() Snacks.words.jump(vim.v.count1) end, desc = 'prev reference', nowait = true },
{ '<c-w>', function() Snacks.bufdelete() end, desc = 'delete buffer', nowait = true },
{ '<leader>N', function() Snacks.notifier.show_history() end, desc = 'show notification history' },
{ '<leader>U', function() Snacks.picker.undo() end, desc = 'undo tree' },
{ '<leader>gB', function() Snacks.git.blame_line() end, desc = 'git blame line' },
{ '<leader>gb', function() Snacks.picker.git_branches() end, desc = 'git branches' },
{ '<leader>@', function() Snacks.picker.lsp_symbols() end, desc = 'workspace symbols' },
{ '<leader>ld', function() Snacks.picker.lsp_definitions() end, desc = 'definition' },
{ '<leader>lr', function() Snacks.picker.lsp_references() end, desc = 'references' },
{ '<leader>li', function() Snacks.picker.lsp_implementations() end, desc = 'implementation' },
{ '<leader>lt', function() Snacks.picker.lsp_type_definitions() end, desc = 'type definition' },
{ '<leader>?', function() Snacks.picker.keymaps() end, desc = 'keymaps' },
{ 'gd', function() Snacks.picker.lsp_definitions() end, desc = 'definition' },
{ 'gr', function() Snacks.picker.lsp_references() end, desc = 'references' },
},
init = function()
Autocmd("User", {
pattern = 'VeryLazy',
callback = function()
local virt_lines = false;
Snacks.toggle.new({
id = "virtual_lines",
name = "diagnostics virtual lines",
get = function() return virt_lines end,
set = function(v)
virt_lines = v
vim.diagnostic.config({ virtual_lines = v })
end,
}):map('<leader>tl')
Snacks.toggle.option('wrap', { name = 'word wrap' }):map('<leader>tw')
Snacks.toggle.option('spell', { name = 'spelling' }):map('<leader>ts')
Snacks.toggle.inlay_hints():map('<leader>th')
end,
})
end,
---@param opts snacks.Config
config = function(_, opts)
require('snacks').setup(opts)
end
} }

View File

@@ -0,0 +1,71 @@
---@module 'lazy'
---@type LazySpec
return { {
'nvim-telescope/telescope.nvim', -- fuzzy finder (files, lsp, etc)
event = 'VeryLazy',
branch = '0.1.x',
dependencies = {
{ 'nvim-lua/plenary.nvim' }, -- contains lua functions for neovim, apparently
{ 'nvim-telescope/telescope-ui-select.nvim' }, -- allows neovim core stuff to enter the telescope picker
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make', -- used for when the plugin is installed/updated
cond = function() return vim.fn.executable 'make' == 1 end, -- condition for whether the plugin should be loaded / installed
},
},
opts = {
pickers = {
find_files = {
find_command = { 'fd', '-t', 'f', '-HE', '/.git', '--strip-cwd-prefix' },
},
},
extensions = {
file_browser = {
hijack_netrw = true,
},
},
},
config = function(_, opts)
local tel = require('telescope')
local std = require("telescope.builtin")
local ext = tel.extensions
require('telescope').setup(opts)
-- load telescope extensions, if they are installed
pcall(tel.load_extension, 'fzf')
pcall(tel.load_extension, 'ui-select')
-- set the telescope keymaps
Map({ 'n' }, '<C-g>', std.live_grep, { desc = 'Search by Grep' })
Map({ 'n' }, '<C-s>', std.resume, { desc = 'Search Resume' })
Map({ 'n', 'i' }, '<C-p>', std.find_files, { desc = 'Search Project' })
Map({ 'n' }, '<leader>p', std.find_files, { desc = 'Search Project' })
Map({ 'n' }, '<leader>gf', std.git_status, { desc = 'Search through Git status Files' })
Map({ 'n' }, '<leader>sq', std.quickfix, { desc = 'Search Quickfix' })
Map({ 'n' }, '<leader>sh', std.help_tags, { desc = 'Search Help' })
Map({ 'n' }, '<leader>sk', std.keymaps, { desc = 'Search Keymaps' })
Map({ 'n' }, '<leader>sf', std.find_files, { desc = 'Search Files' })
Map({ 'n' }, '<leader>ss', std.builtin, { desc = 'Sarch Select telescope' })
Map({ 'n' }, '<leader>sw', std.grep_string, { desc = 'Search current Word' })
Map({ 'n' }, '<leader>sg', std.live_grep, { desc = 'Search by Grep' })
Map({ 'n' }, '<leader>sd', std.diagnostics, { desc = 'Search Diagnostics' })
Map({ 'n' }, '<leader>sr', std.resume, { desc = 'Search Resume' })
Map({ 'n' }, '<leader>s.', std.oldfiles, { desc = 'Search recent Files ("." for repeat)' })
Map({ 'n' }, '<leader><leader>', std.buffers, { desc = 'find existing buffers' })
-- for fuzzily searching in the current buffer
Map('n', '<leader>/', function()
std.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, previewer = false })
end, { desc = 'fuzzily search in current buffer' })
-- for executing grep
Map('n', '<leader>s/', function()
std.live_grep { grep_open_files = true, prompt_title = 'Live Grep in Open Files' }
end, { desc = 'Search in open files' })
-- shortcut for searching neovim config files
Map('n', '<leader>sn', function()
std.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = 'Search Neovim files' })
end,
} }

View File

@@ -0,0 +1,22 @@
---@module 'lazy'
---@type LazySpec
return { {
'folke/todo-comments.nvim', -- for highlighting TODO and stuff comments
event = 'VeryLazy',
dependencies = { 'nvim-lua/plenary.nvim' },
---@module 'todo-comments'
---@type TodoOptions
opts = {
signs = false,
colors = {
hint = { "Comment" }
},
},
config = function(_, opts)
local todo = require 'todo-comments'
todo.setup(opts)
Map('n', '<leader>st', '<cmd>TodoTelescope keywords=TODO,FIX,BUG,WARN<cr>',
{ desc = '[S]earch [T]odos]' })
end,
} }

View File

@@ -0,0 +1,53 @@
---@module 'lazy'
---@type LazySpec
return { {
'akinsho/toggleterm.nvim', -- allows to toggle the terminal rather than open one in a separate window
event = 'VeryLazy',
---@type ToggleTermConfig
---@diagnostic disable-next-line: missing-fields
opts = { open_mapping = [[<C-\>]] },
config = function(_, opts)
local tt = require('toggleterm')
local term = require('toggleterm.terminal')
tt.setup(opts)
local term_lazygit = term.Terminal:new({ cmd = "lazygit", hidden = true, direction = 'float' })
-- Set mappings to toggle the above
Map({ 'n' }, '<leader>gg', function() term_lazygit:toggle() end)
-- Add a keymap for executing makefiles, or launch scripts
Map({ 'n', 't', 'v' }, '<c-b>', function()
local cwd = vim.fn.getcwd()
local cmd = nil
local launchcfg = cwd .. '/.launch.sh'
-- If the path is readable, the attached command is executed and no more is checked.
for _, obj in ipairs({
{ launchcfg, launchcfg },
{ cwd .. '/Makefile', 'make -C ' .. cwd },
{ cwd .. '/makefile', 'make -C ' .. cwd },
}) do
local pat = obj[1]
local exec = obj[2]
if (vim.fn.filereadable(pat) == 1) then
cmd = '\r' .. exec -- use \r to override text if it's present
break
end
end
-- If cmd still hasn't been set; edit the file
if (not cmd) then
local buf = vim.api.nvim_create_buf(true, false) -- listed, not scratch
vim.api.nvim_set_current_buf(buf)
vim.api.nvim_buf_set_name(buf, launchcfg)
vim.api.nvim_buf_set_text(0, 0, 0, 0, 0, { '#!/usr/bin/env sh', 'exec ' })
vim.bo.ft = 'sh'
return
end
-- Execute the command in terminal 1
tt.exec(cmd, 1, nil, nil, nil, nil, false, true)
end, { desc = 'compile the program using .buildcofig placed in PWD' })
end
} }

View File

@@ -0,0 +1,51 @@
---@type LazySpec
return { { -- displays pending keybinds, helps with remembering keybinds
'folke/which-key.nvim',
event = 'VeryLazy',
---@module 'which-key'
---@type wk.Opts
opts = {
delay = 0, -- delay in MS between pressing a key and opening which-key
icons = {
mappings = true,
keys = {
Up = '',
Down = '',
Left = '',
Right = '',
C = '󰘴',
M = '󰘵',
D = '󰘳',
S = '󰘶',
CR = '󰌑',
Esc = '󱊷',
ScrollWheelUp = '󱕑',
ScrollWheelDown = '󱕐',
NL = '󰌑',
BS = '󰁮',
Space = '󱁐',
Tab = '󰌒',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
spec = { -- document the key chains we know about
{ '<leader>g', group = 'git' },
{ '<leader>s', group = 'search' },
{ '<leader>t', group = 'toggle' },
{ '<leader>w', group = 'windows' },
{ '<leader>l', group = 'lsp' },
{ '<leader>wc', group = 'close' },
},
},
} }

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,56 @@
binary-formatted
calc
config
const
double-precision
editorconfig
entry-point
github
gitignore
gitlab
half-precision
if
init
inputted
JSON
keymap
LLM
lsp
malloc'd
neovim
non-zero
null-terminated
numlock
nvidia
nvidia-settings
nvim-cmp
OR'd
overworld
parsable
Quinn
re-enable
regex
res
SDL
shader
shaders
single-precision
startup
stderr
stdout
system-wide
TODO
undefine
whitespace
ˣ
xorg
zero-initialise
zero-out
θ
π
τ
φ
ψ
timestamp
tetromino
μs

Binary file not shown.