This commit is contained in:
2025-05-31 03:32:58 -04:00
parent ef678f31fd
commit e830931ff4
41 changed files with 253 additions and 268 deletions

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local auto, augroup = misc.auto, misc.augroup
local auto, augroup = core.misc.auto, core.misc.augroup
-- auto commands which interact with bufferes without modifying them
local bufcheck = augroup("bufcheck")

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map = core.misc.map
-- vim binds
vim.g.mapleader = " " -- set leader key
@ -25,20 +24,20 @@ map("n", "<leader>x", function() -- execute order 111
local perm = vim.fn.getfperm(fn)
if string.match(perm, "x", 3) then
vim.notify("Removed executable flags", vim.log.levels.INFO, {
title = misc.appid
title = core.misc.appid
})
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."-"..string.sub(fn, 4, 5).."-"
..string.sub(fn, 7, 8).."-")
else
vim.notify("Add executable flags", vim.log.levels.INFO, {
title = misc.appid
title = core.misc.appid
})
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."x"..string.sub(fn, 4, 5).."x"
..string.sub(fn, 7, 8).."x")
end
else
vim.notify("File doesn't exist", vim.log.levels.INFO, {
title = misc.appid
title = core.misc.appid
})
end
end, { desc = "toggle executable flag of the file" })

3
lua/conf/init.lua Normal file
View File

@ -0,0 +1,3 @@
require("conf.opts") -- setup options
require("conf.binds") -- setup keybinds
require("conf.autos") -- setup autos

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local auto = misc.auto
local auto = core.misc.auto
-- color stuff
if vim.fn.has("termguicolors") then
@ -84,8 +83,7 @@ do -- folding
vim.opt.foldenable = true
vim.o.fillchars = "fold: "
_G.Fold_text = require("core.folding")
vim.opt.foldtext = "v:lua.Fold_text()"
vim.opt.foldtext = "v:lua.core.folding()"
end
do -- statusline

View File

@ -1,18 +1,4 @@
local misc = require("core.misc")
local map = misc.map
--- select a program to execute
---@return thread coroutine containing the picker
local function select_program()
return coroutine.create(function(coro)
---@diagnostic disable-next-line: param-type-mismatch
local entries = vim.fn.readdir(".", [[v:val !~ '^\.']])
vim.ui.select(entries, { prompt = "Select the executable to run:" },
function(choice)
coroutine.resume(coro, choice)
end)
end)
end
local map = core.misc.map
local keymap_restore = {}
--- make the default hover binding work for nvim-dap instead of lsp
@ -66,7 +52,9 @@ return { "mfussenegger/nvim-dap",
name = "Launch file",
type = "codelldb",
request = "launch",
program = select_program,
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd()..'/', 'file')
end,
cwd = "${workspaceFolder}",
stopOnEntry = false

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map = core.misc.map
return { "lewis6991/gitsigns.nvim",
disable = not vim.fn.has("nvim-0.9.0"),

View File

@ -1,5 +1,7 @@
local misc = require("core.misc")
local map = misc.map
-- TODO: might end up writing my own because I like harpoon, but I hate that it
-- doesn't work properly without being pinned to a specific commit
local map = core.misc.map
return { "ThePrimeagen/harpoon",
disable = not vim.fn.has("nvim-0.8.0"),
@ -14,7 +16,7 @@ return { "ThePrimeagen/harpoon",
map("n", "<leader>a", function()
harpoon:list():add()
vim.notify("added "..vim.fn.expand("%:t").." to quickmarks",
vim.log.levels.INFO, { title = misc.appid })
vim.log.levels.INFO, { title = core.misc.appid })
end, { desc = "add current file to quickmarks" })
map("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)

View File

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

View File

@ -1,17 +0,0 @@
return { "kawre/leetcode.nvim",
requires = {
"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
vim.cmd("TSUpdate html")
end,
function()
require("leetcode").setup {
lang = "java"
}
end
}

View File

@ -5,7 +5,7 @@ return { "neovim/nvim-lspconfig",
"mason-org/mason-lspconfig.nvim"
},
function()
require("core.lsp.functions").setup()
core.lsp.setup()
require("mason-lspconfig").setup {
ensure_added = {
"clangd",

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map, auto = core.misc.map, core.misc.auto
return { "L3MON4D3/LuaSnip",
branch = "v2.4.0",
@ -55,14 +54,21 @@ return { "L3MON4D3/LuaSnip",
end
end)
-- load all snippets from snippet directory
-- collect all snippets and add them when in the correct file type
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)
if type(ret) ~= "boolean" then
luasnip.add_snippets(fn, ret, { key = fn })
end
auto("FileType", {
pattern = fn,
once = true,
callback = function()
local ret = require("snippets."..fn)
if type(ret) ~= "boolean" then
luasnip.add_snippets(fn, ret, { key = fn })
end
end
})
end
end
}

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map = core.misc.map
return { "danymat/neogen",
requires = {

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map = core.misc.map
-- helper function to parse output
local function parse_output(proc)

View File

@ -0,0 +1,9 @@
return { "ThePrimeagen/refactoring.nvim",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter"
},
function()
require('refactoring').setup {}
end
}

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map = core.misc.map
--- get the root directory for telescope to search
---@return string the root directory

View File

@ -1,3 +1,6 @@
-- TODO: gotta rewrite this cause it's actual dogshit, and I don't want to deal
-- with nerd fonts or folke anymore also add support for TODO(name):
return { "folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim",
disable = not vim.fn.has("nvim-0.8.0"),

View File

@ -0,0 +1,10 @@
return { "nvim-treesitter/nvim-treesitter-context",
requires = "nvim-treesitter/nvim-treesitter",
function()
require("treesitter-context").setup {
max_lines = 2,
line_numbers = true,
trim_scope = 'inner'
}
end
}

View File

@ -1,12 +1,3 @@
table.contains = function(self, string)
for _, v in pairs(self) do
if v == string then
return true
end
end
return false
end
return { "nvim-treesitter/nvim-treesitter",
disable = not vim.fn.has("nvim-0.10.0"),
config = function()
@ -47,8 +38,7 @@ return { "nvim-treesitter/nvim-treesitter",
end
-- disable in big files
-- TODO: update before nvim 1.0 when vim.loop is removed
local ok, stats = pcall(vim.loop.fs_stat,
local ok, stats = pcall(vim.uv.fs_stat,
vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > (1024 * 100 * 10) --[[1MB]] then
return true

View File

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

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map = misc.map
local map = core.misc.map
return { "mbbill/undotree",
function()