kitchen sink again :(

This commit is contained in:
2025-05-06 16:51:24 -05:00
parent 3094bf2a39
commit 7c3289fded
51 changed files with 544 additions and 792 deletions

View File

@ -1,37 +1,37 @@
local misc = require('core.misc')
local misc = require("core.misc")
local auto, augroup = misc.auto, misc.augroup
-- auto commands which interact with bufferes without modifying them
local bufcheck = augroup('bufcheck')
local bufcheck = augroup("bufcheck")
-- auto commands which modify things on the filesystem
local fsmod = augroup('fsmod')
local fsmod = augroup("fsmod")
auto('FocusGained', {
auto("FocusGained", {
group = bufcheck,
desc = 'Update contents of file.',
command = 'checktime'
desc = "Update contents of file.",
command = "checktime"
})
auto('TextYankPost', {
auto("TextYankPost", {
group = bufcheck,
desc = 'Highlight on yank.',
desc = "Highlight on yank.",
callback = function()
vim.highlight.on_yank { timeout = 250 }
end
})
auto('BufRead', {
auto("BufRead", {
group = bufcheck,
desc = 'Return to the last place the buffer was closed in.',
desc = "Return to the last place the buffer was closed in.",
callback = function()
vim.fn.setpos('.', vim.fn.getpos("'\""))
vim.fn.setpos(".", vim.fn.getpos("'\""))
vim.cmd("norm! zz")
end
})
auto('BufWritePre', {
auto("BufWritePre", {
group = fsmod,
desc = 'remove trailing spaces on file save',
desc = "remove trailing spaces on file save",
callback = function()
local pos = vim.api.nvim_win_get_cursor(0)
vim.cmd([[%s/\s\+$//e]])
@ -39,12 +39,12 @@ auto('BufWritePre', {
end
})
auto('BufWritePre', {
auto("BufWritePre", {
group = fsmod,
desc = 'Basically mkdir -p.',
desc = "Basically mkdir -p.",
callback = function(ctx)
if ctx.match:match("^%w%w+://") then return end
local dir = vim.fn.fnamemodify(ctx.file, ':p:h')
vim.fn.mkdir(dir, 'p')
local dir = vim.fn.fnamemodify(ctx.file, ":p:h")
vim.fn.mkdir(dir, "p")
end
})

View File

@ -1,23 +1,25 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
-- vim binds
vim.g.mapleader = ' ' -- set leader key
vim.g.mapleader = " " -- set leader key
map('x', '<leader>p', [["_dP]], { desc = 'Greatest remap of all time.' })
map('n', '<esc>', ':nohlsearch<Bar>:echo<CR>', { desc = 'Clear search.' })
map("x", "<leader>p", [["_dP]], { desc = "Greatest remap of all time." })
map("n", "<esc>", ":nohlsearch<Bar>:echo<CR>", { desc = "Clear search." })
-- move selected text up/down
map('v', '<S-k>', ":m '<-2<CR>gv=gv", { desc = 'Move selected text up.' })
map('v', '<S-j>', ":m '>+1<CR>gv=gv", { desc = 'Move selected text down.' })
map("v", "<S-k>", ":m '<-2<CR>gv=gv", { desc = "Move selected text up." })
map("v", "<S-j>", ":m '>+1<CR>gv=gv", { desc = "Move selected text down." })
-- the cursor STAYS IN THE MIDDLE
map('n', '<S-j>', 'mzJ`z<cmd>delm z<CR>') -- when combining lines
map('n', 'n', 'nzzzv') -- when searching
map('n', 'N', 'Nzzzv')
map('n', '<C-d>', '<C-d>zzzv') -- half page jumping
map('n', '<C-u>', '<C-u>zzzv')
map("n", "<S-j>", "mzJ`z<cmd>delm z<CR>") -- when combining lines
map("n", "n", "nzzzv") -- when searching
map("n", "N", "Nzzzv")
map("n", "<C-d>", "<C-d>zzzv") -- half page jumping
map("n", "<C-u>", "<C-u>zzzv")
map('n', '<leader>x', function() -- execute order 111
map({ "n", "i" }, "<C-c>", "<Esc>")
map("n", "<leader>x", function() -- execute order 111
local fn = vim.fn.expand("%:p")
if vim.fn.getftype(fn) == "file" then
local perm = vim.fn.getfperm(fn)
@ -31,14 +33,14 @@ map('n', '<leader>x', function() -- execute order 111
else
vim.notify("File doesn't exist", vim.log.levels.INFO, { title = misc.appid })
end
end, { desc = 'toggle executable flag of the file' })
end, { desc = "toggle executable flag of the file" })
-- good spell suggestion ui
-- (stolen from https://github.com/neovim/neovim/pull/25833)
vim.keymap.set('n', 'z=', function()
vim.keymap.set("n", "z=", function()
local spell_on_choice = vim.schedule_wrap(function(_, idx)
if type(idx) == 'number' then
vim.cmd('normal! '..idx..'z=')
if type(idx) == "number" then
vim.cmd("normal! "..idx.."z=")
end
end)
@ -46,15 +48,15 @@ vim.keymap.set('n', 'z=', function()
spell_on_choice(nil, vim.v.count)
return
end
local cword = vim.fn.expand('<cword>')
local prompt = 'Change '..vim.inspect(cword)..' to:'
local cword = vim.fn.expand("<cword>")
local prompt = "Change "..vim.inspect(cword).." to:"
vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt }, spell_on_choice)
end, { desc = 'Shows spelling suggestions' })
end, { desc = "Shows spelling suggestions" })
-- quickfix
map('n', '<M-j>', '<cmd>cnext<CR>')
map('n', '<M-k>', '<cmd>cprev<CR>')
map('n', '<M-c>', '<cmd>cclose<CR>')
map("n", "<M-j>", "<cmd>cnext<CR>")
map("n", "<M-k>", "<cmd>cprev<CR>")
map("n", "<M-c>", "<cmd>cclose<CR>")
-- man pages
map('n', '<C-k>', '<cmd>Man<CR>')
map("n", "<C-k>", "<cmd>Man<CR>")

View File

@ -1,20 +0,0 @@
-- clear menu
vim.cmd([[:aunmenu PopUp]])
-- add menu items
vim.cmd([[:amenu PopUp.Save\ Buffer <cmd>:w<CR>]])
vim.cmd([[:amenu PopUp.Save\ All\ Buffers <cmd>:wa<CR>]])
vim.cmd([[:nmenu PopUp.Select\ All ggVG]])
vim.cmd([[:nmenu PopUp.Undo u]])
vim.cmd([[:nmenu PopUp.Redo <C-r>]])
vim.cmd([[:nmenu PopUp.Inspect <cmd>Inspect<CR>]])
vim.cmd([[:amenu PopUp.-1- <nop>]]) -- dividers
vim.cmd([[:nmenu PopUp.Copy\ Line yy]])
vim.cmd([[:vmenu PopUp.Copy\ Selection y]])
vim.cmd([[:amenu PopUp.Paste p]])
vim.cmd([[:vmenu PopUp.Cut d]])
vim.cmd([[:nmenu PopUp.Cut dd]])
vim.cmd([[:vmenu PopUp.-2- <nop>]]) -- dividers
vim.cmd([[:nmenu PopUp.-2- <nop>]]) -- dividers
vim.cmd([[:vmenu PopUp.Format\ Selection =]])
vim.cmd([[:nmenu PopUp.Format\ Line ==]])

View File

@ -1,4 +1,4 @@
local misc = require('core.misc')
local misc = require("core.misc")
local auto = misc.auto
-- color stuff
@ -17,6 +17,7 @@ vim.opt.scrolloff = 5
vim.opt.wrap = true -- wraping lines
vim.opt.linebreak = true -- fix where line is wraped
vim.opt.cursorline = true
vim.opt.colorcolumn = { 80 }
-- indents + tabs
local tabwidth = 2
@ -31,7 +32,7 @@ vim.opt.softtabstop = tabwidth
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- (yoinked from kickstart.nvim)
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus' -- system clipboard
vim.opt.clipboard = "unnamedplus" -- system clipboard
end)
vim.opt.updatetime = 200
@ -49,12 +50,12 @@ vim.opt.showmatch = true
vim.opt.incsearch = true
-- wild menus
vim.opt.wildoptions = 'pum'
vim.opt.wildoptions = "pum"
vim.opt.pumblend = 3
vim.opt.pumheight = 20
vim.opt.wildignorecase = true
vim.opt.wildignore = '*.o'
vim.opt.wildignore = "*.o"
-- netrw
vim.g.netrw_banner = 0
@ -63,26 +64,31 @@ vim.g.netrw_liststyle = 1
vim.g.netrw_sizestyle = "H"
vim.g.netrw_hide = 1
-- border (this doesn"t actually do anything within vim, I"m just setting it
-- here so it"s easy to find)
vim.g.border_style = "solid"
-- folding
auto("FileType", {
callback = function()
-- FIXME: it causes errors every once in a while
-- support lsp folding
if vim.fn.has("nvim-0.11") then
auto('LspAttach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client then
return
end
-- if vim.fn.has("nvim-0.11") then
-- auto("LspAttach", {
-- callback = function(args)
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
-- if not client then
-- return
-- end
if client:supports_method('textDocument/foldingRange') then
local win = vim.api.nvim_get_current_win()
vim.wo[win][0].foldmethod = "expr"
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
end
end,
})
end
-- if client:supports_method("textDocument/foldingRange") then
-- local win = vim.api.nvim_get_current_win()
-- vim.wo[win][0].foldmethod = "expr"
-- vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()"
-- end
-- end,
-- })
-- end
-- or just rely on treesitter
if require("nvim-treesitter.parsers").has_parser() then
@ -96,7 +102,7 @@ auto("FileType", {
-- lsp folding: vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()"
-- waiting on https://github.com/neovim/neovim/pull/31311 to hit a release
require('core.lsp.functions').add_capabilities({
require("core.lsp.functions").add_capabilities({
textDocument = {
foldingRange = {
dynamicRegistration = false,
@ -108,13 +114,29 @@ require('core.lsp.functions').add_capabilities({
vim.opt.foldlevelstart = 99
vim.opt.foldlevel = 99
vim.opt.foldenable = true
vim.o.fillchars = 'fold: '
vim.o.fillchars = "fold: "
_G.Fold_text = require('core.folding')
vim.opt.foldtext = 'v:lua.Fold_text()'
_G.Fold_text = require("core.folding")
vim.opt.foldtext = "v:lua.Fold_text()"
-- statusline
function _G.Status()
local function percentage()
local percent, line, lines
line = vim.api.nvim_win_get_cursor(0)[1]
lines = vim.api.nvim_buf_line_count(0)
percent = math.floor((line / lines) * 100)
if percent == 0 then
return "Top"
elseif percent == 100 then
return "Bot"
end
return percent.."%%"
end
return table.concat {
"%t", -- file name
" %h", -- help buffer tag
@ -125,8 +147,10 @@ function _G.Status()
-- print out the number of lsp clients attached
"λ"..#vim.lsp.get_clients({ bufnr = 0 }).." ",
"%<", -- we can start truncating here (I want to keep the file name)
"%l,%c%V", -- line, column-virtual column
" %P" -- percentage through display window
"%<", -- we can start truncating here
" "..percentage() -- percentage through the buffer
}
end
vim.o.statusline="%!v:lua.Status()"

View File

@ -1,38 +1,38 @@
local lsp = require('core.lsp.functions')
local lsp = require("core.lsp.functions")
return { 'hrsh7th/nvim-cmp',
return { "hrsh7th/nvim-cmp",
requires = {
'nvim-treesitter/nvim-treesitter',
'lukas-reineke/cmp-under-comparator', -- better results
'xzbdmw/colorful-menu.nvim' -- fancy colors
"nvim-treesitter/nvim-treesitter",
"lukas-reineke/cmp-under-comparator", -- better results
"xzbdmw/colorful-menu.nvim" -- fancy colors
},
-- suppliers for completions (they require nvim-cmp to be loaded before they are)
deps = {
'hrsh7th/cmp-buffer', -- buffers
'FelipeLema/cmp-async-path', -- path
{ 'hrsh7th/cmp-nvim-lsp',
"hrsh7th/cmp-buffer", -- buffers
"FelipeLema/cmp-async-path", -- path
{ "hrsh7th/cmp-nvim-lsp",
function()
-- add lsp capabilities
lsp.add_capabilities(require('cmp_nvim_lsp').default_capabilities())
lsp.add_capabilities(require("cmp_nvim_lsp").default_capabilities())
end
}, -- lsp
'hrsh7th/cmp-nvim-lsp-signature-help', -- completion information
{ 'L3MON4D3/cmp-luasnip-choice', -- luasnip
requires = 'L3MON4D3/LuaSnip'
"hrsh7th/cmp-nvim-lsp-signature-help", -- completion information
{ "L3MON4D3/cmp-luasnip-choice", -- luasnip
requires = "L3MON4D3/LuaSnip"
}
},
function()
local cmp = require('cmp')
local luasnip = require('luasnip')
local cmp = require("cmp")
local luasnip = require("luasnip")
-- setup cmp
cmp.setup {
-- disable when in comments
enabled = function()
local context = require('cmp.config.context')
if vim.api.nvim_get_mode().mode == 'c' then
local context = require("cmp.config.context")
if vim.api.nvim_get_mode().mode == "c" then
return true
else
return not context.in_treesitter_capture("comment")
@ -42,12 +42,12 @@ return { 'hrsh7th/nvim-cmp',
-- completion sources
sources = cmp.config.sources {
{ name = 'nvim_lsp', priority = 999 },
{ name = 'luasnip_choice', priority = 750 },
{ name = 'buffer', max_item_count = 3 },
{ name = 'async_path', max_item_count = 5 },
{ name = 'neorg' },
{ name = 'nvim_lsp_signature_help' }
{ name = "nvim_lsp", priority = 999 },
{ name = "luasnip_choice", priority = 750 },
{ name = "buffer", max_item_count = 3 },
{ name = "async_path", max_item_count = 5 },
{ name = "neorg" },
{ name = "nvim_lsp_signature_help" }
},
-- how to sort results
@ -56,7 +56,7 @@ return { 'hrsh7th/nvim-cmp',
cmp.config.compare.exact,
cmp.config.compare.offset,
cmp.config.compare.score,
require('cmp-under-comparator').under,
require("cmp-under-comparator").under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
@ -68,11 +68,11 @@ return { 'hrsh7th/nvim-cmp',
window = {
completion = {
scrollbar = false,
border = 'solid',
border = vim.g.border_style,
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
},
documentation = {
border = 'solid',
border = vim.g.border_style,
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
}
},
@ -80,22 +80,22 @@ return { 'hrsh7th/nvim-cmp',
-- position of window
view = {
entries = {
name = 'custom',
selection_order = 'near_cursor'
name = "custom",
selection_order = "near_cursor"
}
},
-- formatting of content
formatting = {
fields = { 'menu', 'abbr', 'kind' },
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local hl_info = require("colorful-menu").cmp_highlights(entry)
local menu_icon = {
nvim_lsp = 'λ',
luasnip = '%',
buffer = '@',
path = '#',
async_path = '#'
nvim_lsp = "λ",
luasnip = "%",
buffer = "@",
path = "#",
async_path = "#"
}
-- add a little icon

View File

@ -1,7 +1,7 @@
return { 'numToStr/Comment.nvim',
return { "numToStr/Comment.nvim",
function()
require('Comment').setup {
ignore = '^$'
require("Comment").setup {
ignore = "^$"
}
end
}

View File

@ -1,50 +1,50 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'mfussenegger/nvim-dap',
return { "mfussenegger/nvim-dap",
requires = {
'williamboman/mason.nvim',
'nvim-telescope/telescope.nvim',
"williamboman/mason.nvim",
"nvim-telescope/telescope.nvim",
},
disable = not vim.fn.has("nvim-0.8.0"),
branch = '0.8.0',
branch = "0.8.0",
function()
local dap = require("dap")
local codelldb_port = 13000
dap.adapters.codelldb = {
type = 'server',
host = '127.0.0.1',
type = "server",
host = "127.0.0.1",
port = codelldb_port,
executable = {
command = require('mason-registry').get_package('codelldb'):get_install_path()..'/codelldb',
args = { '--port', codelldb_port }
command = require("mason-registry").get_package("codelldb"):get_install_path().."/codelldb",
args = { "--port", codelldb_port }
}
}
dap.configurations.c = {
{
name = 'LLDB: Launch',
type = 'codelldb',
request = 'launch',
name = "LLDB: Launch",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd()..'/', 'file')
return vim.fn.input("Path to executable: ", vim.fn.getcwd().."/", "file")
end,
cwd = '${workspaceFolder}',
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
console = 'integratedTerminal'
console = "integratedTerminal"
}
}
map('n', '<Leader>ec', dap.continue, { desc = "dap continue " })
map('n', '<Leader>el', dap.run_last, { desc = "dap run last" })
map('n', '<Leader>et', dap.terminate, { desc = "dap terminate " })
map('n', '<Leader>eb', require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" })
map('n', '<Leader>e]', dap.step_over, { desc = "dap step over" })
map('n', '<Leader>e[', dap.step_back, { desc = "dap step back" })
map('n', '<Leader>er', dap.repl.toggle, { desc = "dap repl toggle" })
map('n', '<Leader>eR', dap.restart, { desc = "dap restart" })
map("n", "<Leader>ec", dap.continue, { desc = "dap continue " })
map("n", "<Leader>el", dap.run_last, { desc = "dap run last" })
map("n", "<Leader>et", dap.terminate, { desc = "dap terminate " })
map("n", "<Leader>eb", require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" })
map("n", "<Leader>e]", dap.step_over, { desc = "dap step over" })
map("n", "<Leader>e[", dap.step_back, { desc = "dap step back" })
map("n", "<Leader>er", dap.repl.toggle, { desc = "dap repl toggle" })
map("n", "<Leader>eR", dap.restart, { desc = "dap restart" })
end
}

View File

@ -1,19 +0,0 @@
local branch = nil
if vim.fn.has("nvim-0.7.0") then
branch = 'nvim-0.7'
elseif vim.fn.has("nvim-0.5.0") then
branch = 'nvim-0.5'
end
return { 'stevearc/dressing.nvim',
disable = true or not vim.fn.has("nvim-0.5.0"),
branch = branch,
requires = 'nvim-telescope/telescope.nvim',
function()
require('dressing').setup {
input = {
enabled = false
}
}
end
}

View File

@ -1,11 +1,11 @@
return { 'j-hui/fidget.nvim',
return { "j-hui/fidget.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
branch = "v1.5.0",
function()
local notification_defaults = require("fidget.notification").default_config
notification_defaults["icon"] = ""
require('fidget').setup {
require("fidget").setup {
progress = {
display = {
progress_icon = {

View File

@ -1,19 +1,19 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'lewis6991/gitsigns.nvim',
return { "lewis6991/gitsigns.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
function()
local gs = require("gitsigns")
gs.setup {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '-' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' }
add = { text = "" },
change = { text = "" },
delete = { text = "-" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" }
},
signcolumn = true,
@ -27,51 +27,51 @@ return { 'lewis6991/gitsigns.nvim',
},
attach_to_untracked = true,
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
preview_config = { border = 'solid' },
preview_config = { border = vim.g.border_style },
on_attach = function(bufnr)
local opts = { buffer = bufnr }
-- Navigation
map('n', ']c', function()
map("n", "]c", function()
if vim.wo.diff then
return ']c'
return "]c"
end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
return "<Ignore>"
end, { expr = true, buffer = bufnr })
map('n', '[c', function()
map("n", "[c", function()
if vim.wo.diff then
return '[c'
return "[c"
end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
return "<Ignore>"
end, { expr = true, buffer = bufnr })
-- Actions
map('n', '<leader>hs', gs.stage_hunk, opts)
map('n', '<leader>hr', gs.reset_hunk, opts)
map('v', '<leader>hs', function()
gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') }
map("n", "<leader>hs", gs.stage_hunk, opts)
map("n", "<leader>hr", gs.reset_hunk, opts)
map("v", "<leader>hs", function()
gs.stage_hunk { vim.fn.line("."), vim.fn.line("v") }
end, opts)
map('v', '<leader>hr', function()
gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') }
map("v", "<leader>hr", function()
gs.reset_hunk { vim.fn.line("."), vim.fn.line("v") }
end, opts)
map('n', '<leader>hS', gs.stage_buffer, opts)
map('n', '<leader>hu', gs.undo_stage_hunk, opts)
map('n', '<leader>hR', gs.reset_buffer, opts)
map('n', '<leader>hp', gs.preview_hunk, opts)
map('n', '<leader>hb', function() gs.blame_line { full=true } end, opts)
map('n', '<leader>tb', gs.toggle_current_line_blame, opts)
map('n', '<leader>hd', gs.diffthis, opts)
map('n', '<leader>hD', function() gs.diffthis('~') end, opts)
map('n', '<leader>td', gs.toggle_deleted, opts)
map("n", "<leader>hS", gs.stage_buffer, opts)
map("n", "<leader>hu", gs.undo_stage_hunk, opts)
map("n", "<leader>hR", gs.reset_buffer, opts)
map("n", "<leader>hp", gs.preview_hunk, opts)
map("n", "<leader>hb", function() gs.blame_line { full=true } end, opts)
map("n", "<leader>tb", gs.toggle_current_line_blame, opts)
map("n", "<leader>hd", gs.diffthis, opts)
map("n", "<leader>hD", function() gs.diffthis("~") end, opts)
map("n", "<leader>td", gs.toggle_deleted, opts)
-- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', opts)
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", opts)
end
}
end

View File

@ -1,11 +1,11 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'ThePrimeagen/harpoon',
return { "ThePrimeagen/harpoon",
disable = not vim.fn.has("nvim-0.8.0"),
commit = 'e76cb03',
branch = 'harpoon2',
requires = 'nvim-lua/plenary.nvim',
commit = "e76cb03",
branch = "harpoon2",
requires = "nvim-lua/plenary.nvim",
function()
local harpoon = require("harpoon")

View File

@ -1,21 +0,0 @@
return { 'lukas-reineke/headlines.nvim',
requires = 'nvim-treesitter/nvim-treesitter',
function()
require('headlines').setup {
norg = {
headline_highlights = {
"@neorg.headings.1.title",
"@neorg.headings.2.title",
"@neorg.headings.3.title",
"@neorg.headings.4.title",
"@neorg.headings.5.title",
"@neorg.headings.6.title"
},
bullets = { "", "", "", "" },
},
markdown = {
headline_highlights = false
}
}
end
}

View File

@ -0,0 +1 @@
return { "tweekmonster/helpful.vim" }

5
lua/conf/plugins/hml.lua Normal file
View File

@ -0,0 +1,5 @@
return { "mawkler/hml.nvim",
function()
require("hml").setup {}
end
}

View File

@ -1,4 +1,4 @@
return { 'jbyuki/instant.nvim',
return { "jbyuki/instant.nvim",
function()
vim.g.instant_username = "squibid"
end

View File

@ -1,64 +1,64 @@
local misc = require('core.misc')
local lsp = require('core.lsp.functions')
local misc = require("core.misc")
local lsp = require("core.lsp.functions")
local map, auto = misc.map, misc.auto
return { 'mfussenegger/nvim-jdtls',
return { "mfussenegger/nvim-jdtls",
disable = not vim.fn.has("nvim-0.6.0"),
requires = 'mfussenegger/nvim-dap',
requires = "mfussenegger/nvim-dap",
function()
auto("FileType", {
pattern = "java",
callback = function()
local jdtls = require('jdtls')
local jdtls_install = require('mason-registry').get_package('jdtls'):get_install_path()
local jdtls = require("jdtls")
local jdtls_install = require("mason-registry").get_package("jdtls"):get_install_path()
-- make sure to check if things with 💀 need updating
local config = {
cmd = {
'java', -- 💀
'-jar', vim.fn.glob(jdtls_install..'/plugins/org.eclipse.equinox.launcher_*.jar'), -- 💀
'-configuration', jdtls_install..'/config_linux',
'-data', vim.fn.stdpath('cache')..'/nvim-jdtls',
"/usr/lib/jvm/openjdk21/bin/java", -- 💀
"-jar", vim.fn.glob(jdtls_install.."/plugins/org.eclipse.equinox.launcher_*.jar"), -- 💀
"-configuration", jdtls_install.."/config_linux",
"-data", vim.fn.stdpath("cache").."/nvim-jdtls",
'--add-modules=ALL-SYSTEM',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.level=ALL',
'-Dlog.protocol=true',
'-Dosgi.bundles.defaultStartLevel=4',
'-Xmx1G',
"--add-modules=ALL-SYSTEM",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
"-Declipse.product=org.eclipse.jdt.ls.core.product",
"-Dlog.level=ALL",
"-Dlog.protocol=true",
"-Dosgi.bundles.defaultStartLevel=4",
"-Xmx1G",
},
root_dir = vim.fs.dirname(vim.fs.find({
'gradlew',
'.git',
'mvnw',
'settings.gradle', -- Gradle (multi-project)
'settings.gradle.kts', -- Gradle (multi-project)
'build.xml', -- Ant
'pom.xml', -- Maven
"gradlew",
".git",
"mvnw",
"settings.gradle", -- Gradle (multi-project)
"settings.gradle.kts", -- Gradle (multi-project)
"build.xml", -- Ant
"pom.xml", -- Maven
}, { upward = true })[1]),
-- don't print out status messages
-- don"t print out status messages
handlers = {
['language/status'] = function() end
["language/status"] = function() end
},
on_attach = function(_, bufnr)
-- add some jdtls specific mappings
local opts = { buffer = bufnr }
map('n', 'cri', jdtls.organize_imports, opts)
map('n', 'crv', jdtls.extract_variable, opts)
map('n', 'crc', jdtls.extract_constant, opts)
map('x', 'crv', function() jdtls.extract_variable(true) end, opts)
map('x', 'crc', function() jdtls.extract_constant(true) end, opts)
map('x', 'crm', function() jdtls.extract_method(true) end, opts)
map("n", "cri", jdtls.organize_imports, opts)
map("n", "crv", jdtls.extract_variable, opts)
map("n", "crc", jdtls.extract_constant, opts)
map("x", "crv", function() jdtls.extract_variable(true) end, opts)
map("x", "crc", function() jdtls.extract_constant(true) end, opts)
map("x", "crm", function() jdtls.extract_method(true) end, opts)
pcall(vim.lsp.codelens.refresh)
auto('BufWritePost', {
auto("BufWritePost", {
buffer = bufnr,
desc = 'refresh codelens',
desc = "refresh codelens",
callback = function()
pcall(vim.lsp.codelens.refresh)
end
@ -88,7 +88,7 @@ return { 'mfussenegger/nvim-jdtls',
end
-- compile our code
vim.system({ 'javac', src_path, '-d', vim.fn.stdpath("cache") }, {}, function(out)
vim.system({ "javac", src_path, "-d", vim.fn.stdpath("cache") }, {}, function(out)
if out.code ~= 0 then
cache_path = nil
end
@ -98,7 +98,7 @@ return { 'mfussenegger/nvim-jdtls',
-- check if we have a compiled version of JavaVersion
local f, _ = io.open(cache_path, "r")
if not f then -- if we don't have a cache
if not f then -- if we don"t have a cache
build_cache()
else
io.close(f)
@ -118,12 +118,15 @@ return { 'mfussenegger/nvim-jdtls',
on_exit = function(_, exit_code, _)
local v = vim.version.parse(table.concat(buffer))
-- if there's an error, no version info, or the java version is
-- if there"s an error, no version info, or the java version is
-- less than 17 stop the lsp from starting
if exit_code ~= 0 then
vim.notify(string.format(
"java version check failed: exit code %s", exit_code),
vim.log.levels.ERROR, { title = misc.appid })
vim.notify(string.format(
"%s", vim.inspect(buffer)),
vim.log.levels.ERROR, { title = misc.appid })
return
elseif not v then
vim.notify("no java version info found", vim.log.levels.ERROR,

View File

@ -1,16 +1,16 @@
return { 'kawre/leetcode.nvim',
return { "kawre/leetcode.nvim",
requires = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope.nvim',
'MunifTanjim/nui.nvim',
'nvim-treesitter/nvim-treesitter'
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"MunifTanjim/nui.nvim",
"nvim-treesitter/nvim-treesitter"
},
config = function()
-- because we're using treesitter make sure to install the html parser
-- because we"re using treesitter make sure to install the html parser
vim.cmd("TSUpdate html")
end,
function()
require('leetcode').setup {
require("leetcode").setup {
lang = "java"
}
end

View File

@ -1,4 +1,4 @@
return { 'whynothugo/lsp_lines',
url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
return { "whynothugo/lsp_lines",
url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
disable = not vim.fn.has("nvim-0.8.0")
}

View File

@ -1,14 +1,14 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'L3MON4D3/LuaSnip',
branch = 'v2.3.0',
return { "L3MON4D3/LuaSnip",
branch = "v2.3.0",
disable = not vim.fn.has("nvim-0.7.0"),
config = function()
vim.cmd('make install_jsregexp')
vim.cmd("make install_jsregexp")
end,
function()
local luasnip = require('luasnip')
local luasnip = require("luasnip")
local types = require("luasnip.util.types")
luasnip.config.set_config {
@ -57,8 +57,8 @@ return { 'L3MON4D3/LuaSnip',
-- load all snippets from snippet directory
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do
local fn = file:gsub('^.*/', ''):gsub('%.lua$', '')
local ret = misc.include('snippets.'..fn)
local fn = file:gsub("^.*/", ""):gsub("%.lua$", "")
local ret = misc.include("snippets."..fn)
if type(ret) ~= "boolean" then
luasnip.add_snippets(fn, ret, { key = fn })
end

View File

@ -1,11 +1,11 @@
local misc = require('core.misc')
local lsp = require('core.lsp.functions')
local misc = require("core.misc")
local lsp = require("core.lsp.functions")
local map = misc.map
return { 'williamboman/mason-lspconfig.nvim',
return { "williamboman/mason-lspconfig.nvim",
requires = {
'williamboman/mason.nvim',
{ 'neovim/nvim-lspconfig',
"williamboman/mason.nvim",
{ "neovim/nvim-lspconfig",
disable = not vim.fn.has("nvim-0.8.0"),
function()
lsp.setup()
@ -13,15 +13,15 @@ return { 'williamboman/mason-lspconfig.nvim',
},
-- these two update some lsp capabilities and therefore must be run first
-- 'hrsh7th/cmp-nvim-lsp',
-- 'kevinhwang91/nvim-ufo'
-- "hrsh7th/cmp-nvim-lsp",
-- "kevinhwang91/nvim-ufo"
},
function()
local lspconfig = require('lspconfig')
local util = require('lspconfig.util')
local lspconfig = require("lspconfig")
local util = require("lspconfig.util")
-- setup language servers
require('mason-lspconfig').setup {
require("mason-lspconfig").setup {
ensure_installed = {
"lua_ls",
"clangd",
@ -42,9 +42,9 @@ return { 'williamboman/mason-lspconfig.nvim',
-- setup luals
["lua_ls"] = function(server_name)
local root_files = { '.luarc.json', '.luarc.jsonc', '.luacheckrc',
'.stylua.toml', 'stylua.toml', 'selene.toml', 'selene.yml',
'README.md'
local root_files = { ".luarc.json", ".luarc.jsonc", ".luacheckrc",
".stylua.toml", "stylua.toml", "selene.toml", "selene.yml",
"README.md"
}
-- FIXME: luals seems to start up twice and sends back twice the
@ -53,10 +53,10 @@ return { 'williamboman/mason-lspconfig.nvim',
settings = {
Lua = {
diagnostics = {
globals = { "vim", 'mp' }
globals = { "vim", "mp" }
},
runtime = {
version = 'LuaJIT'
version = "LuaJIT"
},
format = {
enable = false
@ -76,7 +76,7 @@ return { 'williamboman/mason-lspconfig.nvim',
return root
end
root = util.root_pattern('lua/')(fname)
root = util.root_pattern("lua/")(fname)
if root then
return root
end
@ -107,7 +107,7 @@ return { 'williamboman/mason-lspconfig.nvim',
usePlaceholders = true,
clangdFileStatus = true,
fallback_flags = {
"-xc" -- makes clangd think we're using c instead of c++
"-xc" -- makes clangd think we"re using c instead of c++
}
}
}

View File

@ -1,11 +1,11 @@
return { 'williamboman/mason.nvim',
return { "williamboman/mason.nvim",
disable = not vim.fn.has("nvim-0.7.0"),
function()
local mason = require('mason')
local mason = require("mason")
mason.setup {
ui = {
border = "solid",
border = vim.g.border_style,
width = 0.8,
height = 0.9,

View File

@ -1,6 +1,6 @@
return { 'mellow-theme/mellow.nvim',
return { "mellow-theme/mellow.nvim",
disable = not vim.fn.has("nvim-0.8.0"),
requires = 'nvim-treesitter/nvim-treesitter',
requires = "nvim-treesitter/nvim-treesitter",
function()
vim.g.mellow_variant = "dark"
local c = require("mellow.colors")[vim.g.mellow_variant]
@ -10,26 +10,26 @@ return { 'mellow-theme/mellow.nvim',
["NormalNC"] = { link = "Normal" },
-- make floats darker
["NormalFloat"] = { fg = c.fg, bg = c.bg_dark },
["NormalFloat"] = { fg = c.fg, bg = "#111111" },
["FloatBorder"] = { link = "NormalFloat" },
-- neorg headings, looks extra good with lukas-reineke/headlines.nvim
["@neorg.headings.1.title"] = { fg = c.yellow, bg = "#2a211c" },
["@neorg.headings.1.icon"] = { link = "@neorg.headings.1.title" },
["@neorg.headings.2.title"] = { fg = c.blue, bg = '#201e25' },
["@neorg.headings.2.title"] = { fg = c.blue, bg = "#201e25" },
["@neorg.headings.2.icon"] = { link = "@neorg.headings.2.title" },
["@neorg.headings.3.title"] = { fg = c.cyan, bg = '#2b1b20' },
["@neorg.headings.3.title"] = { fg = c.cyan, bg = "#2b1b20" },
["@neorg.headings.3.icon"] = { link = "@neorg.headings.3.title" },
["@neorg.headings.4.title"] = { fg = c.green, bg = '#1d201e' },
["@neorg.headings.4.title"] = { fg = c.green, bg = "#1d201e" },
["@neorg.headings.4.icon"] = { link = "@neorg.headings.4.title" },
["@neorg.headings.5.title"] = { fg = c.magenta, bg = '#251a21' },
["@neorg.headings.5.title"] = { fg = c.magenta, bg = "#251a21" },
["@neorg.headings.5.icon"] = { link = "@neorg.headings.5.title" },
["@neorg.headings.6.title"] = { fg = c.white, bg = '#212126' },
["@neorg.headings.6.title"] = { fg = c.white, bg = "#212126" },
["@neorg.headings.6.icon"] = { link = "@neorg.headings.6.title" },
-- make blink actually look nice

View File

@ -1,52 +0,0 @@
return { 'echasnovski/mini.clue',
disable = true,
-- disable = not vim.fn.has("nvim-0.9.0"),
branch = "stable",
function()
local miniclue = require('mini.clue')
miniclue.setup({
triggers = {
-- Leader triggers
{ mode = 'n', keys = '<Leader>' },
{ mode = 'x', keys = '<Leader>' },
-- Built-in completion
{ mode = 'i', keys = '<C-x>' },
-- `g` key
{ mode = 'n', keys = 'g' },
{ mode = 'x', keys = 'g' },
-- Marks
{ mode = 'n', keys = "'" },
{ mode = 'n', keys = '`' },
{ mode = 'x', keys = "'" },
{ mode = 'x', keys = '`' },
-- Registers
{ mode = 'n', keys = '"' },
{ mode = 'x', keys = '"' },
{ mode = 'i', keys = '<C-r>' },
{ mode = 'c', keys = '<C-r>' },
-- Window commands
{ mode = 'n', keys = '<C-w>' },
-- `z` key
{ mode = 'n', keys = 'z' },
{ mode = 'x', keys = 'z' },
},
clues = {
-- Enhance this by adding descriptions for <Leader> mapping groups
miniclue.gen_clues.builtin_completion(),
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
miniclue.gen_clues.registers(),
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
},
})
end
}

View File

@ -1,19 +1,19 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'danymat/neogen',
return { "danymat/neogen",
requires = {
'nvim-treesitter/nvim-treesitter',
'L3MON4D3/LuaSnip'
"nvim-treesitter/nvim-treesitter",
"L3MON4D3/LuaSnip"
},
function()
local neogen = require('neogen')
local neogen = require("neogen")
neogen.setup {
enabled = true,
input_after_comment = true,
snippet_engine = "luasnip",
}
map('n', '<leader>d', neogen.generate)
map("n", "<leader>d", neogen.generate)
end
}

View File

@ -1,7 +1,7 @@
-- WARNING: neorg does some pretty stupid stuff when it comes to the plugins it
-- wants (using luarocks), in order to get around all that bullshit I've
-- manually added it's dependencies. Because I don't want this to randomly break
-- I've also pinned neorg to the latest working version that I've messed around
-- wants (using luarocks), in order to get around all that bullshit I"ve
-- manually added it"s dependencies. Because I don"t want this to randomly break
-- I"ve also pinned neorg to the latest working version that I"ve messed around
-- with.
--
-- NOTE: for my future self to update this thingy while not breaking
@ -36,7 +36,7 @@ local function populate_workspaces(path, cache)
if string.sub(n, 1, 1) == "." or (t ~= "directory" and t ~= "link") then
goto continue
end
-- make sure this still works if the last charachter in the path isn't a '/'
-- make sure this still works if the last charachter in the path isn"t a "/"
workspaces[n] = (string.sub(path, #path, #path) == "/") and path..n or path.."/"..n
::continue::
end
@ -61,32 +61,32 @@ local function populate_workspaces(path, cache)
return workspaces
end
return { 'nvim-neorg/neorg',
return { "nvim-neorg/neorg",
disable = not vim.fn.has("nvim-0.10.0"),
branch = 'v9.3.0',
branch = "v9.3.0",
requires = {
'nvim-lua/plenary.nvim',
'nvim-treesitter/nvim-treesitter',
'folke/zen-mode.nvim',
'hrsh7th/nvim-cmp',
{ 'nvim-neorg/neorg-telescope',
requires = 'nvim-telescope/telescope.nvim'
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"folke/zen-mode.nvim",
"hrsh7th/nvim-cmp",
{ "nvim-neorg/neorg-telescope",
requires = "nvim-telescope/telescope.nvim"
},
-- NOTE: these are usually installed by neorg via luarocks, the versions
-- were picked based on the neorg-scm-1.rockspec found in the root of the
-- neorg repo
{ 'nvim-neotest/nvim-nio',
branch = 'v1.7.0'
{ "nvim-neotest/nvim-nio",
branch = "v1.7.0"
},
{ 'nvim-neorg/lua-utils.nvim',
branch = 'v1.0.2'
{ "nvim-neorg/lua-utils.nvim",
branch = "v1.0.2"
},
{ 'MunifTanjim/nui.nvim',
branch = '0.3.0'
{ "MunifTanjim/nui.nvim",
branch = "0.3.0"
},
{ 'pysan3/pathlib.nvim',
branch = 'v2.2.2'
{ "pysan3/pathlib.nvim",
branch = "v2.2.2"
}
},
@ -94,7 +94,7 @@ return { 'nvim-neorg/neorg',
local wsphome = (os.getenv("XDG_DOCUMENTS_DIR") or
(os.getenv("HOME").."/Documents")).."/notes/"
require('neorg').setup {
require("neorg").setup {
load = {
-- not sure how to sort the modules so ima just put the empty ones first
["core.defaults"] = {},

View File

@ -1,7 +1,7 @@
return { 'norcalli/nvim-colorizer.lua',
return { "norcalli/nvim-colorizer.lua",
disable = not vim.fn.has("nvim-0.4.0") and not vim.fn.has("termguicolors"),
function()
require('colorizer').setup(nil, {
require("colorizer").setup(nil, {
names = false,
css = true
})

View File

@ -1,7 +1,7 @@
return { 'squibid/nyooom',
url = 'https://git.squi.bid/nyooom',
return { "squibid/nyooom",
url = "https://git.squi.bid/nyooom",
pin = true,
function()
require('nyooom').setup {}
require("nyooom").setup {}
end
}

View File

@ -1,16 +1,85 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
-- helper function to parse output
local function parse_output(proc)
local result = proc:wait()
local ret = {}
if result.code == 0 then
for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do
-- Remove trailing slash
line = line:gsub("/$", "")
ret[line] = true
end
end
return ret
end
-- build git status cache
local function new_git_status()
return setmetatable({}, {
__index = function(self, key)
local ignore_proc = vim.system(
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" },
{
cwd = key,
text = true,
}
)
local tracked_proc = vim.system({ "git", "ls-tree", "HEAD", "--name-only" }, {
cwd = key,
text = true,
})
local ret = {
ignored = parse_output(ignore_proc),
tracked = parse_output(tracked_proc),
}
rawset(self, key, ret)
return ret
end,
})
end
local git_status = new_git_status()
local permission_hlgroups = {
['-'] = 'NonText',
['r'] = 'DiagnosticSignWarn',
['w'] = 'DiagnosticSignHint',
['x'] = 'DiagnosticSignOk',
["-"] = "NonText",
["r"] = "DiagnosticSignWarn",
["w"] = "DiagnosticSignHint",
["x"] = "DiagnosticSignOk",
}
return { 'stevearc/oil.nvim',
return { "stevearc/oil.nvim",
disable = not vim.fn.has("nvim-0.8.0"),
deps = {
{ "refractalize/oil-git-status.nvim",
function()
require("oil-git-status").setup {
symbols = { -- customize the symbols that appear in the git status columns
index = {
["A"] = "+",
["D"] = "-",
["M"] = "~",
},
working_tree = {
["A"] = "+",
["D"] = "-",
["M"] = "~",
}
}
}
end
}
},
function()
-- Clear git status cache on refresh
local refresh = require("oil.actions").refresh
local orig_refresh = refresh.callback
refresh.callback = function(...)
git_status = new_git_status()
orig_refresh(...)
end
require("oil").setup {
-- ID is automatically added at the beginning, and name at the end
-- See :help oil-columns
@ -26,7 +95,7 @@ return { 'stevearc/oil.nvim',
return hls
end,
},
{ "size", highlight = '@number' }
{ "size", highlight = "@number" }
},
-- Window-local options to use for oil buffers
@ -34,7 +103,7 @@ return { 'stevearc/oil.nvim',
number = false,
relativenumber = false,
wrap = false,
signcolumn = "no",
signcolumn = "yes:2",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
@ -100,11 +169,16 @@ return { 'stevearc/oil.nvim',
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
if name == ".." then -- show previous directory
return false
local dir = require("oil").get_current_dir(bufnr)
local is_dotfile = vim.startswith(name, ".") and name ~= ".."
-- if no local directory (e.g. for ssh connections), just hide dotfiles
if not dir then
return is_dotfile
end
-- dotfiles are considered hidden unless tracked
if is_dotfile then
return not git_status[dir].tracked[name]
end
local m = name:match("^%.")
return m ~= nil
end,
-- This function defines what will never be shown, even when `show_hidden` is set
@ -134,27 +208,27 @@ return { 'stevearc/oil.nvim',
-- Configuration for the floating window in oil.open_float
float = {
border = "solid"
border = vim.g.border_style
},
-- Configuration for the floating action confirmation window
confirmation = {
border = "solid"
border = vim.g.border_style
},
-- Configuration for the floating progress window
progress = {
border = "solid"
border = vim.g.border_style
},
-- Configuration for the floating SSH window
ssh = {
border = "solid"
border = vim.g.border_style
},
-- Configuration for the floating keymaps help window
keymaps_help = {
border = "solid"
border = vim.g.border_style
}
}
map('n', '-', '<cmd>Oil<CR>')
map("n", "-", "<cmd>Oil<CR>")
end
}

View File

@ -1,18 +0,0 @@
return { 'ahmedkhalf/project.nvim',
disable = true,
-- disable = vim.fn.has("nvim-0.5.0"),
function()
require('project_nvim').setup {
patterns = {
".git",
"Makefile",
"_darcs",
".hg",
".bzr",
".svn",
"package.json",
"README.md"
}
}
end
}

View File

@ -1,55 +1,48 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'nvim-telescope/telescope.nvim',
return { "nvim-telescope/telescope.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
requires = {
'nvim-lua/plenary.nvim',
{ 'nvim-telescope/telescope-fzf-native.nvim',
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim",
config = function()
vim.cmd("make")
end
}
},
"mollerhoj/telescope-recent-files.nvim",
"nvim-telescope/telescope-ui-select.nvim"
},
function()
local telescope = require("telescope")
local actions = require('telescope.actions')
local action_layout = require("telescope.actions.layout")
local function telescopew()
if vim.o.columns <= 80 then
return vim.o.columns
else
return 0.8
end
end
local actions = require("telescope.actions")
telescope.setup {
defaults = {
borderchars = {
prompt = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
results = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
preview = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
prompt = { " ", " ", " ", " ", " ", " ", " ", " " },
results = { " ", " ", " ", " ", " ", " ", " ", " " },
preview = { " ", " ", " ", " ", " ", " ", " ", " " },
},
winblend = 0,
layout_strategy = 'horizontal',
sorting_strategy = 'descending',
scroll_strategy = 'limit',
layout_strategy = "horizontal",
sorting_strategy = "descending",
scroll_strategy = "limit",
layout_config = {
horizontal = {
width = telescopew(),
height = 20,
prompt_position = 'bottom',
anchor = 'N',
prompt_position = "bottom",
anchor = "N",
}
},
mappings = {
i = {
["<esc>"] = actions.close,
['<C-j>'] = actions.move_selection_next,
['<C-k>'] = actions.move_selection_previous,
['<C-u>'] = actions.preview_scrolling_up,
['<C-d>'] = actions.preview_scrolling_down,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
}
}
},
@ -59,29 +52,31 @@ return { 'nvim-telescope/telescope.nvim',
}
-- load in the fzf extension
telescope.load_extension('fzf')
telescope.load_extension("fzf")
telescope.load_extension("recent-files")
telescope.load_extension("ui-select")
-- keymaps
local telebuilt = require('telescope.builtin')
map('n', '<leader>f', function()
telebuilt.fd { follow = true }
end, { desc = 'Find files.' })
map('n', '<leader>s', telebuilt.live_grep, { desc = 'Find string in project.' })
map('n', '<leader>b', telebuilt.current_buffer_fuzzy_find, {
desc = 'Find string in current buffer.',
local telebuilt = require("telescope.builtin")
map("n", "<leader>f", function()
telescope.extensions["recent-files"].recent_files { follow = true }
end, { desc = "Find files." })
map("n", "<leader>s", telebuilt.live_grep, { desc = "Find string in project." })
map("n", "<leader>b", telebuilt.current_buffer_fuzzy_find, {
desc = "Find string in current buffer.",
})
map('n', '<leader>i', telebuilt.help_tags, {
desc = 'find help tags.',
map("n", "<leader>i", telebuilt.help_tags, {
desc = "find help tags.",
})
-- find over specific directories
map('n', '<leader>tc', function()
require('telescope.builtin').find_files {
map("n", "<leader>tc", function()
require("telescope.builtin").find_files {
cwd = vim.fn.stdpath("config")
}
end, { desc = "find config files" })
map('n', '<leader>tp', function()
require('telescope.builtin').find_files {
map("n", "<leader>tp", function()
require("telescope.builtin").find_files {
cwd = vim.fs.joinpath(vim.fn.stdpath("data"), "site/pack/deps/opt")
}
end, { desc = "find files in plugin directory" })

View File

@ -1,8 +1,8 @@
return { 'folke/todo-comments.nvim',
requires = 'nvim-lua/plenary.nvim',
return { "folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim",
disable = not vim.fn.has("nvim-0.8.0"),
function()
require('todo-comments').setup {
require("todo-comments").setup {
keywords = {
FIX = {
icon = "# ",

View File

@ -7,13 +7,13 @@ table.contains = function(self, string)
return false
end
return { 'nvim-treesitter/nvim-treesitter',
return { "nvim-treesitter/nvim-treesitter",
disable = not vim.fn.has("nvim-0.10.0"),
config = function()
vim.cmd("TSUpdate")
end,
function()
require('nvim-treesitter.configs').setup {
require("nvim-treesitter.configs").setup {
-- good default parsers
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown",
"markdown_inline", "java", "bash", "css", "html", "luadoc",
@ -25,7 +25,7 @@ return { 'nvim-treesitter/nvim-treesitter',
enable = true,
disable = function(lang, _)
-- disable indenting in php (it's more broken with than without)
-- disable indenting in php (it"s more broken with than without)
return table.contains(({
"php"
}), lang)
@ -39,7 +39,7 @@ return { 'nvim-treesitter/nvim-treesitter',
additional_vim_regex_highlighting = true,
disable = function(lang, buf)
-- disable in some files where vim's builtin highlighting is better
-- disable in some files where vim"s builtin highlighting is better
if table.contains(({
"diff", "tex"
}), lang) then

View File

@ -1,14 +1,14 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'Wansmer/treesj',
return { "Wansmer/treesj",
disable = not vim.fn.has("nvim-0.9.0"),
requires = 'nvim-treesitter/nvim-treesitter',
requires = "nvim-treesitter/nvim-treesitter",
function()
require('treesj').setup {
require("treesj").setup {
use_default_keymaps = false,
}
map('n', '<leader>j', require('treesj').toggle, { desc = 'fold code' })
map("n", "<leader>j", require("treesj").toggle, { desc = "fold code" })
end
}

View File

@ -1,11 +1,8 @@
return { 'windwp/nvim-ts-autotag',
requires = {
'nvim-telescope/telescope.nvim',
'nvim-treesitter/nvim-treesitter'
},
return { "windwp/nvim-ts-autotag",
requires = "nvim-treesitter/nvim-treesitter",
disable = not vim.fn.has("nvim-0.9.5"),
function()
require('nvim-ts-autotag').setup {}
require("nvim-ts-autotag").setup {}
end
}

View File

@ -1,7 +1,7 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map = misc.map
return { 'mbbill/undotree',
return { "mbbill/undotree",
function()
if vim.g.loaded_undotree then
vim.g.undotree_DiffAutoOpen = 0

View File

@ -1,4 +1,4 @@
return { 'lervag/vimtex',
return { "lervag/vimtex",
setup = function()
vim.g.vimtex_view_method = "zathura"
end

View File

@ -1,24 +1,38 @@
local misc = require('core.misc')
local misc = require("core.misc")
local map, include = misc.map, misc.include
local M = {}
local function on_list(options)
vim.fn.setqflist({}, 'r', options)
if #options.items > 1 then
-- TODO: find a way to make the qflist current item be the one closest to the
-- cursor whenever we open it
local function on_list(opts)
vim.fn.setqflist({}, "r", opts)
if #opts.items > 1 then
vim.cmd.copen()
end
vim.cmd("cc! 1")
vim.cmd(".cc! 1")
end
local function _w(func)
return function()
func({
border = "solid",
max_width = math.floor(vim.o.columns * 0.7),
}, { on_list = on_list })
end
end
---@type vim.lsp.util.open_floating_preview.Opts
local popup_opts = {
border = vim.g.border_style
}
---@type vim.lsp.buf.hover.Opts
---@diagnostic disable-next-line: assign-type-mismatch
local hover_opts = vim.tbl_deep_extend("force", popup_opts, {})
---@type vim.lsp.buf.signature_help.Opts
---@diagnostic disable-next-line: assign-type-mismatch
local signature_opts = vim.tbl_deep_extend("force", popup_opts, {})
---@type vim.lsp.ListOpts
local list_opts = {
on_list = on_list
}
---@type vim.lsp.LocationOpts
---@diagnostic disable-next-line: assign-type-mismatch
local location_opts = vim.tbl_deep_extend("force", list_opts, {})
--- setup basic options on lsp attach
---@param bufnr number buffer number
@ -26,39 +40,35 @@ local function attach(bufnr)
local opts = { buffer = bufnr, nowait = true }
-- LSP actions
map('n', 'K', _w(vim.lsp.buf.hover), opts)
map('n', 'gd', _w(vim.lsp.buf.definition), opts)
map('n', 'gD', _w(vim.lsp.buf.declaration), opts)
map('n', 'gi', _w(vim.lsp.buf.implementation), opts)
map('n', 'gy', _w(vim.lsp.buf.type_definition), opts)
map('n', 'gr', _w(vim.lsp.buf.references), opts)
map('n', '<S-Tab>', _w(vim.lsp.buf.signature_help), opts)
map('n', { '<leader>r', '<F2>' }, _w(vim.lsp.buf.rename), opts)
map('n', 'gA', _w(vim.lsp.buf.code_action), {
map("n", "K", function() vim.lsp.buf.hover(hover_opts) end, opts)
map("n", "gd", function() vim.lsp.buf.definition(location_opts) end, opts)
map("n", "gD", function() vim.lsp.buf.declaration(location_opts) end, opts)
map("n", "gi", function() vim.lsp.buf.implementation(location_opts) end, opts)
map("n", "gy", function() vim.lsp.buf.type_definition(location_opts) end, opts)
map("n", "gr", function() vim.lsp.buf.references(nil, list_opts) end, opts)
map("n", "<S-Tab>", function() vim.lsp.buf.signature_help(signature_opts) end, opts)
map("n", { "<leader>r", "<F2>" }, vim.lsp.buf.rename, opts)
map("n", { "gA", "<F4>" }, vim.lsp.buf.code_action, {
buffer = bufnr,
desc = 'check code actions',
})
map('n', '<F4>', _w(vim.lsp.buf.code_action), {
buffer = bufnr,
desc = 'check code actions'
desc = "check code actions",
})
-- Diagnostics
map('n', '[d', function()
map("n", "[d", function()
if not vim.fn.has("nvim-0.11") then
vim.diagnostic.goto_prev()
else
vim.diagnostic.jump({ count = -1 })
end
end, opts)
map('n', ']d', function()
map("n", "]d", function()
if not vim.fn.has("nvim-0.11") then
vim.diagnostic.goto_next()
else
vim.diagnostic.jump({ count = 1 })
end
end, opts)
-- map('n', 'qD', vim.diagnostic.setqflist, opts)
-- map("n", "qD", vim.diagnostic.setqflist, opts)
end
function M.setup()
@ -81,18 +91,18 @@ function M.setup()
}
if not vim.fn.has("nvim-0.11") then
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, { border = 'solid' })
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, { border = vim.g.border_style })
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help, { border = 'solid' })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, { border = vim.g.border_style })
end
-- set default capabilities
include('lspconfig.util').default_config.capabilities = M.capabilities
include("lspconfig.util").default_config.capabilities = M.capabilities
-- run whenever a client attaches
vim.api.nvim_create_autocmd('LspAttach', {
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(event)
-- map keybinds
attach(event.buf)
@ -100,6 +110,8 @@ function M.setup()
})
end
-- FIXME: I don"t like this way of doing things, there has to be a better way
--- capabilities that are to be used in lsp servers, for those setup through
--- lspconfig, this is already set as the default. Incase there is a server
--- not setup through lspconfig this function may be called to receive the
@ -109,7 +121,7 @@ M.capabilities = vim.lsp.protocol.make_client_capabilities()
--- add capabilities to the default capabilities string
---@param new_capabilities lsp.ClientCapabilities
function M.add_capabilities(new_capabilities)
vim.tbl_deep_extend('force', M.capabilities, new_capabilities)
vim.tbl_deep_extend("force", M.capabilities, new_capabilities)
end
return M

View File

@ -9,7 +9,7 @@ M.appid = "Nvim Config"
function M.include(fn)
local ok, r = pcall(require, fn)
if not ok then
vim.notify('Could not find "'..fn..'": '..r, vim.log.levels.WARN, { title = M.appid })
vim.notify("Could not find '"..fn.."': "..r, vim.log.levels.WARN, { title = M.appid })
return ok
end
return r
@ -26,26 +26,6 @@ function M.loopf(path, body, ext)
end
end
--- set colorscheme
---@param name string name of colorscheme
function M.colorscheme(name)
-- only set the colorscheme if it exists
for _, v in pairs(vim.fn.getcompletion('', 'color')) do
if v == name then
vim.cmd("colorscheme "..name)
break
end
end
-- override with any addons
for _, v in pairs(vim.fn.getcompletion('', 'color')) do
if v == name..'.ext' then
vim.cmd("colorscheme"..name..'.ext')
break
end
end
end
--- extend vim.kemap.set
---@param mode string|table mode for the keymap
---@param bind string|table keymap
@ -53,26 +33,26 @@ end
---@param opts vim.keymap.set.Opts? keymap options
function M.map(mode, bind, cmd, opts)
opts = opts or {}
opts['noremap'] = true
opts['silent'] = true
opts["noremap"] = true
opts["silent"] = true
-- attempt to autogenerate a basic description
if not opts['desc'] then
if not opts["desc"] then
if type(cmd) == "string" then
opts['desc'] = cmd:gsub("<%a+>", "")
opts["desc"] = cmd:gsub("<%a+>", "")
elseif type(cmd) == "function" then
-- TODO: find a way to generate a better name
local file_name = vim.fn.fnamemodify(debug.getinfo(cmd, "S").short_src, ":t")
opts['desc'] = "origin@"..file_name
opts["desc"] = "origin@"..file_name
end
end
-- define the keybinds
if type(bind) == 'table' then
if type(bind) == "table" then
for i in pairs(bind) do
vim.keymap.set(mode, bind[i], cmd, opts)
end
elseif type(bind) == 'string' then
elseif type(bind) == "string" then
vim.keymap.set(mode, bind, cmd, opts)
end
end
@ -110,11 +90,11 @@ end
function M.highlight(group, opts, namespace)
namespace = namespace or 0
if type(group) == 'table' then
if type(group) == "table" then
for i in pairs(group) do
vim.api.nvim_set_hl(namespace, group[i], opts)
end
elseif type(group) == 'string' then
elseif type(group) == "string" then
vim.api.nvim_set_hl(namespace, group, opts)
end
end

View File

@ -1,4 +1,4 @@
ls = require('luasnip')
ls = require("luasnip")
s = ls.snippet
sn = ls.snippet_node
t = ls.text_node

View File

@ -1,31 +0,0 @@
local map = require('core.misc').map
return function(server_name, attach, capabilities)
require('lspconfig')[server_name].setup {
on_attach = function(client, bufnr)
attach(client, bufnr)
-- add some clangd specific mappings
local opts = { buffer = bufnr }
map("n", "<leader>o", "<cmd>ClangdSwitchSourceHeader<CR>", opts)
end,
capabilities = capabilities,
cmd = {
"clangd",
"--background-index",
"--clang-tidy",
"--header-insertion=iwyu",
"--completion-style=detailed",
"--function-arg-placeholders",
"--fallback-style=llvm"
},
init_options = {
usePlaceholders = true,
clangdFileStatus = true,
fallback_flags = {
"-xc" -- makes clangd think we're using c instead of c++
}
}
}
end

View File

@ -1,4 +1,4 @@
require('core.snippets.shorthands')
require("core.snippets.shorthands")
--- create a decleration of a function from it's definition using treesitter
---@param func string

View File

@ -1,5 +1,5 @@
require('core.snippets.shorthands')
require('core.snippets.functions')
require("core.snippets.shorthands")
require("core.snippets.functions")
--- shortcut to choose between java access modifiers
---@param idx number index of the node

View File

@ -1,47 +0,0 @@
require('core.snippets.shorthands')
return {
-- basic make template snippet
s("make", {
t({ "PKG_CONFIG = pkg-config", "CC = cc", "VERSION = " }),
i(1, "0.1"),
t({ "", "", "# flags and incs", "PKGS = " }),
i(2),
t({ "", "CFLAGS = -DVERSION=\\\"$(VERSION)\\\" -Wall" }),
i(3),
t({ "", "LIBS = `$(PKG_CONFIG) --libs --cflags $(PKGS)`" }),
i(4),
t({ "", "", "PREFIX = " }),
i(5, "/usr/local"),
t({ "", "MANDIR = $(PREFIX)/share/man" }),
t({ "", "", "all: " }),
i(6, "main"),
t({ "", "" }),
rep(6),
t(": "),
rep(6),
t({ ".o", "\t$(CC) *.o $(CFLAGS) $(LIBS) -o $@", "" }),
rep(6),
t(".o: "),
rep(6),
t({ ".c", "", "clean:", "\trm -f " }),
rep(6),
t({ " *.o", "", "install: " }),
rep(6),
t({ "", "\tmkdir -p $(PREFIX)/bin", "\tcp -f " }),
rep(6),
t({ " $(PREFIX)/bin", "\tchmod 755 $(PREFIX)/bin/" }),
rep(6),
t({ "", "\tmkdir -p $(MANDIR)/man1", "\tcp -f " }),
rep(6),
t({ ".1 $(MANDIR)/man1", "\tchmod 644 $(MANDIR)/man1/" }),
rep(6),
t({ ".1", "", "uninstall: " }),
rep(6),
t({ "", "\trm -f $(PREFIX)/bin/" }),
rep(6),
t(" $(MANDIR)/man1/"),
rep(6),
t(".1")
})
}

View File

@ -1,5 +1,5 @@
require('core.snippets.shorthands')
require('core.snippets.functions')
require("core.snippets.shorthands")
require("core.snippets.functions")
return {
-- header level 1, usually this has the same name as the file

View File

@ -1,4 +1,4 @@
require('core.snippets.shorthands')
require("core.snippets.shorthands")
return {
-- translate snippet

View File

@ -1,4 +1,4 @@
require('core.snippets.shorthands')
require("core.snippets.shorthands")
return {
s("php", {

View File

@ -1,5 +1,5 @@
require('core.snippets.shorthands')
require('core.snippets.functions')
require("core.snippets.shorthands")
require("core.snippets.functions")
return {
-- document snippet