Compare commits

...

10 Commits

Author SHA1 Message Date
9ea9d9f516 more!!! add python support and formatters and null ls to manage all...
that automatically also change my stylua.toml to ignore everything
cause I don't like the way it formats stuff
2025-06-11 03:21:25 -04:00
e830931ff4 wozers 2025-05-31 03:32:58 -04:00
ef678f31fd turns out neovim supports lsp line diagnostics natively 2025-05-19 02:22:49 -04:00
f9311db805 try and make everything confined to 80chars 2025-05-18 22:33:36 -04:00
d0155fcc7c make telescope work better in projects 2025-05-18 22:22:39 -04:00
df666dec0f fix dap
add showkeys thingy
remove nyooom
2025-05-18 14:28:57 -04:00
450750835a need I say what type of commit this is?
*kitchen sink*
2025-05-18 13:03:31 -05:00
77130d61af add a lil guy who provides git information on the current buffer 2025-05-09 17:58:06 -05:00
922dfb8c7e opts.lua 2025-05-09 00:17:42 -05:00
f3bd08968a formatting 2025-05-09 00:16:55 -05:00
51 changed files with 1520 additions and 424 deletions

View File

@ -1,3 +1,2 @@
indent_type = "Spaces" # Use spaces instead of tabs
indent_width = 2 # Number of spaces per indent level
quote_style = "ForceDouble" # Always use double quotes for strings
# I don't like stylua formatting in my config
ignore = [ "./" ]

View File

@ -1,5 +1,4 @@
local misc = require('core.misc')
local map_local = misc.map_local
local map_local = core.misc.map_local
-- sort #includes <> (very jank)
-- TODO: rewrite in a semi-sane way

View File

@ -0,0 +1 @@
core.misc.map("n", "q", "<cmd>q<CR>")

View File

@ -1,18 +1,24 @@
local misc = require("core.misc")
local map, auto = misc.map, misc.auto
-- FIXME: the following error is emmitted when starting up jdtls:
-- ERROR No LSP client found that supports vscode.java.resolveMainClass
local jdtls = require("jdtls")
local jdtls_install = vim.fs.joinpath(vim.fn.stdpath('data'),
"/mason/packages/jdtls")
local java_dap_install = vim.fs.joinpath(vim.fn.stdpath('data'),
"/mason/packages/java-debug-adapter")
local map, auto = core.misc.map, core.misc.auto
local ok, jdtls = pcall(require, "jdtls")
if not ok then
vim.notify("jdtls not loaded, can't setup jdtls lsp or dap")
return
end
local jdtls_install = core.mason.get_pkg_path("jdtls")
local java_dap_install = core.mason.get_pkg_path("java-debug-adapter")
-- make sure to check if things with 💀 need updating
local config = {
cmd = {
"/usr/lib/jvm/openjdk21/bin/java", -- 💀
"-jar", vim.fn.glob(jdtls_install.."/plugins/org.eclipse.equinox.launcher_*.jar"), -- 💀
"-configuration", jdtls_install.."/config_linux",
"-jar", -- 💀
vim.fn.glob(vim.fs.joinpath(jdtls_install, "plugins/org.eclipse.equinox.launcher_*.jar")),
"-configuration", jdtls_install.."config_linux",
"-data", vim.fn.stdpath("cache").."/nvim-jdtls",
"--add-modules=ALL-SYSTEM",
@ -23,7 +29,7 @@ local config = {
"-Dlog.level=ALL",
"-Dlog.protocol=true",
"-Dosgi.bundles.defaultStartLevel=4",
"-Xmx1G",
"-Xmx1G"
},
root_dir = vim.fs.dirname(vim.fs.find({
@ -48,6 +54,7 @@ local config = {
map("x", "crc", function() jdtls.extract_constant(true) end, opts)
map("x", "crm", function() jdtls.extract_method(true) end, opts)
-- do some refreshes often because I don't trust jdtls
pcall(vim.lsp.codelens.refresh)
auto("BufWritePost", {
buffer = bufnr,
@ -58,7 +65,13 @@ local config = {
})
-- setup nvim-dap
require("dap").adapters.java = nil -- remove any old java adapters
local ok, dap = pcall(require, "dap")
if not ok then
vim.notify("dap not loaded can't setup dap for jdtls")
return
end
dap.adapters.java = nil -- remove any old java adapters
jdtls.setup_dap({ hotcodereplace = "auto" })
require("jdtls.dap").setup_dap_main_class_configs()
end,
@ -71,7 +84,7 @@ local config = {
init_options = {
bundles = {
vim.fs.joinpath(java_dap_install,
vim.fn.glob("/extension/server/com.microsoft.java.debug.plugin-*.jar",
vim.fn.glob("extension/server/com.microsoft.java.debug.plugin-*.jar",
true)
)
}
@ -79,10 +92,12 @@ local config = {
}
-- generate the path to the java file(s)
---@type string|nil
local cache_path = vim.fs.joinpath(vim.fn.stdpath("cache"), "/JavaVersion.class")
---@type string|nil
local src_path = vim.fs.joinpath(vim.fn.stdpath("config"), "/extras/JavaVersion.java")
---@type string?
local cache_path = vim.fs.joinpath(vim.fn.stdpath("cache"),
"/JavaVersion.class")
---@type string?
local src_path = vim.fs.joinpath(vim.fn.stdpath("config"),
"/extras/JavaVersion.java")
-- if either path is invalid
if not cache_path or not src_path then
@ -92,19 +107,18 @@ end
--- build a cache of the JavaVersion code
local function build_cache()
-- check if we have javac
vim.system({ "javac" }, {}, function(out)
if out.code == 127 then
cache_path = nil
return
end
if vim.fn.executable("javac") ~= 1 then
cache_path = nil
return
end
-- compile our code
vim.system({ "javac", src_path, "-d", vim.fn.stdpath("cache") }, {}, function(out)
-- compile our code
vim.system({ "javac", src_path, "-d", vim.fn.stdpath("cache"), }, {},
function(out)
if out.code ~= 0 then
cache_path = nil
end
end)
end)
end
-- check if we have a compiled version of JavaVersion
@ -130,20 +144,17 @@ local function version_check()
if out.code ~= 0 then
vim.notify(string.format(
"java version check failed: exit code %s", out.code),
vim.log.levels.ERROR, { title = misc.appid })
vim.log.levels.ERROR)
vim.notify(string.format(
"%s", vim.inspect(out.stdout)),
vim.log.levels.ERROR, { title = misc.appid })
"%s", vim.inspect(out.stdout)), vim.log.levels.ERROR)
return false
elseif not v then
vim.notify("no java version info found", vim.log.levels.ERROR,
{ title = misc.appid })
vim.notify("no java version info found", vim.log.levels.ERROR)
return false
elseif v.major < 21 then
vim.notify(string.format(
"java version %s < 21.0.0 Cannot run jdtls, bailing out",
v[1] .. "." .. v[2] .. "." .. v[3]),
vim.log.levels.ERROR, { title = misc.appid })
v[1].."."..v[2].."."..v[3]), vim.log.levels.ERROR)
return false
end

View File

@ -1,5 +1,4 @@
local misc = require("core.misc")
local map_local = misc.map_local
local map_local = core.misc.map_local
map_local("n", "h", "-", { noremap = false, remap = true }) -- Go up a directory
map_local("n", "l", "<CR>", { noremap = false, remap = true }) -- Go down a directory / open a file
@ -16,5 +15,5 @@ end)
-- change neovim root
map_local("n", "rt", function()
vim.api.nvim_set_current_dir(vim.b.netrw_curdir)
vim.notify("root dir updated: "..vim.b.netrw_curdir, vim.log.levels.LOW, { title = misc.appid })
vim.notify("root dir updated: "..vim.b.netrw_curdir)
end)

View File

@ -1,4 +1,4 @@
local map = require("core.misc").map
local map = core.misc.map
return {
on_attach = function(_, bufnr)

View File

@ -1,4 +1,4 @@
local map = require("core.misc").map
local map = core.misc.map
return {
on_attach = function(_, bufnr)

View File

@ -1 +1,5 @@
vim.cmd("colorscheme mellow")
if vim.fn.has("termguicolors") and not os.getenv("TERM") ~= "linux" then
vim.cmd("colorscheme mellow")
else
vim.cmd("colorscheme default")
end

686
dep-not-lazy Normal file
View File

@ -0,0 +1,686 @@
vim-startuptime -vimpath nvim -count 100:
Extra options: []
Measured: 100 times
Total Average: 144.380620 msec
Total Max: 174.784000 msec
Total Min: 137.569000 msec
AVERAGE MAX MIN
---------------------------------
129.170670 154.969000 123.411000: /home/squibid/.config/nvim/init.lua
12.890310 15.866000 12.461000: require('headlines')
7.751880 13.893000 6.340000: require('neorg.modules.core.completion.module')
6.036340 11.060000 5.441000: require('neorg.modules.core.integrations.telescope.module')
5.710990 12.120000 4.446000: require('treesj')
5.583670 9.049000 3.078000: require('pathlib')
5.517340 11.929000 4.260000: require('treesj.settings')
5.420920 8.867000 2.959000: require('pathlib.posix')
5.347190 8.769000 2.905000: require('pathlib.base')
5.033420 7.179000 4.344000: require('snippets.c')
4.863020 5.906000 4.074000: require('telescope.actions')
4.821470 7.779000 4.361000: require('telescope._extensions.neorg.find_linkable')
4.773650 7.730000 4.318000: require('neorg.telescope_utils')
4.380770 7.633000 2.226000: require('pathlib.utils.watcher')
4.354190 6.453000 3.870000: require('core.snippets.shorthands')
4.217790 7.457000 2.109000: require('nio')
3.915800 4.986000 3.149000: require('cmp')
3.681300 4.563000 3.454000: require('nvim-treesitter')
3.673010 4.757000 3.024000: require('conf.opts')
3.552670 4.559000 2.842000: require('cmp.core')
3.403410 4.259000 3.189000: require('nvim-treesitter.install')
3.278770 4.250000 2.695000: require('core.lsp.functions')
3.123820 4.077000 2.568000: require('vim.lsp')
2.916240 4.233000 2.083000: require('telescope.config')
2.749690 7.714000 0.209000: require('neorg.modules.core.dirman.module')
2.719720 4.105000 2.530000: /home/squibid/.config/nvim/after/plugin/colorscheme.lua
2.636010 4.836000 1.002000: require('nio.uv')
2.264605 6.153000 0.098000: /home/squibid/.local/share/nvim/site/pack/deps/opt/LuaSnip/plugin/luasnip.lua
2.135570 9.144000 0.044000: require('neorg.modules.core.dirman.utils.module')
2.112660 2.993000 1.967000: require('nvim-treesitter.parsers')
2.072940 3.811000 1.856000: require('telescope.pickers')
2.044980 4.082000 1.147000: require('leetcode.command')
2.036605 4.949000 0.013000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-treesitter/plugin/nvim-treesitter.lua
2.002450 2.983000 1.705000: require('luasnip')
1.856050 2.291000 1.754000: reading ShaDa
1.849890 2.930000 1.582000: require('luasnip.extras.treesitter_postfix')
1.815740 2.975000 1.321000: require('oil.actions')
1.784180 3.307000 1.678000: require('mason-registry.sources.github')
1.706120 2.466000 1.316000: require('vim.filetype')
1.689720 2.871000 1.396000: require('neorg')
1.641400 2.511000 1.243000: require('vim._init_packages')
1.608390 2.496000 1.452000: nvim_exec2() called at /home/squibid/.config/nvim/after/plugin/colorscheme.lua:0
1.576020 3.313000 1.359000: require('treesj.langs')
1.483850 3.010000 1.318000: require('telescope.previewers')
1.471520 2.320000 1.258000: require('harpoon')
1.407890 2.307000 1.220000: require('luasnip.nodes.snippet')
1.380020 2.569000 1.110000: require('neorg.core')
1.360060 1.717000 1.287000: require('luasnip.loaders.from_vscode')
1.332500 1.870000 0.868000: require('snippets.java')
1.325500 2.360000 0.913000: require('telescope.sorters')
1.281050 2.458000 1.213000: require('mason-registry.sources.util')
1.234380 2.150000 1.110000: require('fidget')
1.196200 1.524000 1.137000: require('vim.treesitter')
1.192760 2.665000 0.809000: require('nui.utils.autocmd')
1.092560 2.162000 0.974000: require('telescope.finders')
1.075350 1.957000 0.820000: require('vim._editor')
1.065820 1.861000 0.866000: require('cmp.view')
1.057940 1.654000 0.792000: require('vim._defaults')
1.031440 1.528000 0.990000: loading rtp plugins
1.008240 1.302000 0.961000: require('vim.treesitter.languagetree')
1.002450 2.050000 0.887000: require('telescope.previewers.buffer_previewer')
0.970120 2.414000 0.637000: require('nui.utils.buf_storage')
0.953090 1.720000 0.896000: require('mason-core.installer.registry')
0.920170 2.354000 0.591000: require('nui.utils')
0.915700 2.416000 0.684000: require('dap')
0.911030 1.815000 0.821000: require('fidget.progress')
0.907280 1.993000 0.726000: require('neorg.core.modules')
0.904650 1.667000 0.620000: require('nvim-ts-autotag')
0.900400 1.747000 0.803000: /home/squibid/.local/share/nvim/site/pack/deps/opt/mellow.nvim/colors/mellow.vim
0.881180 1.128000 0.804000: require('vim.diagnostic')
0.874900 1.211000 0.743000: require('vim.lsp.util')
0.836730 1.348000 0.659000: require('snippets.tex')
0.820980 0.981000 0.662000: require('cmp.source')
0.811710 1.086000 0.739000: require('colorizer')
0.794280 1.032000 0.754000: require('luasnip.util.parser')
0.794230 0.974000 0.726000: require('fidget.notification')
0.780010 1.601000 0.546000: require('telescope.utils')
0.745350 1.485000 0.668000: require('nvim-treesitter.info')
0.709760 1.418000 0.648000: require('plenary.async')
0.704610 1.526000 0.608000: require('Comment.api')
0.692370 1.027000 0.511000: require('dep')
0.690380 1.361000 0.429000: require('nvim-ts-autotag.internal')
0.672970 1.462000 0.563000: require('harpoon.data')
0.672400 1.731000 0.578000: require('neorg.modules.core.concealer.module')
0.668760 1.489000 0.469000: require('leetcode')
0.667590 1.305000 0.458000: require('oil')
0.657210 1.400000 0.590000: require('nvim-treesitter.configs')
0.656470 1.325000 0.492000: require('neorg.core.utils')
0.647370 1.406000 0.478000: require('oil.util')
0.643150 1.524000 0.597000: require('fidget.progress.lsp')
0.642500 0.832000 0.583000: require('gitsigns')
0.631140 0.746000 0.509000: require('cmp.entry')
0.623440 1.027000 0.578000: require('mason')
0.619960 0.964000 0.583000: require('mason-core.installer.registry.schemas')
0.618810 0.872000 0.526000: require('luasnip.loaders')
0.615590 1.598000 0.492000: require('neorg.modules.core.tempus.module')
0.611610 1.395000 0.488000: require('cmp.utils.async')
0.611580 1.400000 0.510000: require('plenary.path')
0.593090 0.807000 0.522000: require('todo-comments')
0.575730 1.230000 0.508000: require('telescope.make_entry')
0.574340 0.678000 0.542000: require('mason-core.installer.managers.std')
0.559130 1.413000 0.510000: require('lspconfig')
0.551550 1.412000 0.509000: require('vim.lsp.handlers')
0.539370 0.699000 0.478000: require('dap.repl')
0.537050 0.716000 0.506000: require('vim.treesitter.query')
0.532820 1.014000 0.441000: require('mason-registry')
0.523700 1.178000 0.383000: require('neorg.modules.core.ui.module')
0.520580 0.899000 0.327000: require('vim.lsp.protocol')
0.517080 0.851000 0.400000: require('luasnip.config')
0.497290 1.229000 0.417000: require('neorg.modules.core.ui.calendar.views.monthly.module')
0.491310 0.601000 0.466000: require('luasnip.util.parser.ast_parser')
0.478880 1.713000 0.016000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-ts-autotag/plugin/nvim-ts-autotag.lua
0.469290 1.385000 0.356000: require('neogen')
0.465790 1.699000 0.043000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-cmp/plugin/cmp.lua
0.465570 0.604000 0.341000: require('vim.shared')
0.465020 1.230000 0.371000: require('cmp.config')
0.460660 0.547000 0.433000: require('mason-core.installer')
0.458220 1.223000 0.406000: require('nvim-treesitter.query')
0.444530 0.565000 0.421000: require('luasnip.loaders.from_lua')
0.440785 1.634000 0.047000: /home/squibid/.local/share/nvim/site/pack/deps/opt/Comment.nvim/plugin/Comment.lua
0.438070 1.277000 0.192000: require('snippets.make')
0.431750 0.803000 0.385000: require('telescope.actions.layout')
0.418390 0.689000 0.345000: require('nyooom')
0.416160 0.651000 0.330000: require('plenary.popup')
0.413120 1.268000 0.287000: require('luasnip.util.environ')
0.405490 1.187000 0.364000: require('cmp_nvim_lsp')
0.402540 0.507000 0.355000: require('lspconfig.util')
0.400330 0.518000 0.387000: /usr/share/nvim/runtime/plugin/matchit.vim
0.397180 0.813000 0.303000: require('neorg.modules.core.integrations.treesitter.module')
0.396580 1.116000 0.293000: require('vim.lsp.rpc')
0.391370 0.491000 0.374000: loading after plugins
0.390090 1.147000 0.359000: require('mellow')
0.386650 1.225000 0.224000: require('leetcode.config')
0.376050 1.087000 0.294000: require('vim.re')
0.372040 0.638000 0.336000: require('plenary.scandir')
0.368370 0.846000 0.287000: require('neorg.modules.core.esupports.hop.module')
0.364860 0.723000 0.329000: require('oil-git-status')
0.358670 0.857000 0.290000: require('treesj.langs.javascript')
0.356240 0.668000 0.318000: require('telescope.pickers.layout_strategies')
0.355440 0.738000 0.224000: require('nio.lsp')
0.344860 0.704000 0.307000: require('telescope.previewers.term_previewer')
0.343640 0.737000 0.221000: require('nio.ui')
0.337520 0.419000 0.322000: require('luasnip.loaders.from_snipmate')
0.333470 1.049000 0.294000: require('plenary.async.tests')
0.330750 0.669000 0.298000: require('mason-core.platform')
0.328140 0.484000 0.309000: require('lsp_lines')
0.325760 0.468000 0.257000: require('vim.lsp.log')
0.324620 1.025000 0.235000: require('plenary.job')
0.315990 0.524000 0.281000: require('mason-core.fetch')
0.313600 1.125000 0.253000: require('Comment.utils')
0.313080 0.916000 0.187000: require('nvim-ts-autotag.config.plugin')
0.308130 1.170000 0.186000: require('luasnip.util._builtin_vars')
0.307790 0.382000 0.285000: require('fidget.notification.model')
0.305460 0.480000 0.282000: require('plenary.async.async')
0.303080 0.943000 0.279000: require('mason-core.package')
0.299810 0.416000 0.216000: init lua interpreter
0.296330 1.079000 0.272000: /usr/share/nvim/runtime/filetype.lua
0.295040 0.445000 0.197000: require('vim._options')
0.291240 0.522000 0.136000: require('snippets.norg')
0.290500 0.547000 0.264000: require('mason.api.command')
0.288690 0.544000 0.254000: require('telescope.finders.async_oneshot_finder')
0.287905 0.625000 0.070000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-lspconfig/plugin/lspconfig.lua
0.287280 0.715000 0.228000: require('neorg.modules.core.qol.toc.module')
0.285650 0.441000 0.226000: require('vim.lsp._changetracking')
0.283750 0.981000 0.247000: require('plenary.async.util')
0.278980 1.041000 0.231000: require('lua-utils')
0.278760 0.666000 0.124000: require('snippets.openscad')
0.278420 0.345000 0.259000: require('vim.lsp.completion')
0.275980 0.362000 0.220000: require('cmp.view.custom_entries_view')
0.272330 0.743000 0.238000: require('neorg.modules.core.export.markdown.module')
0.270190 0.374000 0.222000: require('cmp.types')
0.268910 0.347000 0.254000: require('luasnip.util.parser.ast_utils')
0.268770 0.331000 0.254000: require('cmp.utils.api')
0.268160 0.851000 0.145000: require('neorg.modules.core.autocommands.module')
0.266450 0.392000 0.225000: require('luasnip.nodes.util.trig_engines')
0.265550 0.418000 0.186000: inits 1
0.264490 0.353000 0.237000: require('dap.ui')
0.262080 0.374000 0.213000: require('cmp.view.docs_view')
0.261610 1.063000 0.161000: require('conf.binds')
0.259520 1.074000 0.219000: require('luasnip.extras._treesitter')
0.253560 0.368000 0.190000: require('core.misc')
0.252560 0.307000 0.237000: /home/squibid/.local/share/nvim/site/pack/deps/opt/cmp-buffer/after/plugin/cmp_buffer.lua
0.250170 0.319000 0.237000: /usr/share/nvim/runtime/plugin/fzf.vim
0.249520 1.036000 0.230000: nvim_exec2() called at /usr/share/nvim/runtime/filetype.lua:0
0.248350 0.502000 0.183000: require('telescope.actions.set')
0.248200 0.385000 0.177000: require('telescope.log')
0.247880 0.308000 0.231000: require('telescope')
0.246820 0.352000 0.175000: sourcing vimrc file(s)
0.246150 0.397000 0.185000: require('pathlib.utils')
0.240050 0.314000 0.216000: require('nvim-treesitter.tsrange')
0.239730 0.394000 0.208000: require('mason-core.managers.powershell')
0.239110 0.309000 0.199000: require('luasnip.util.jsonc')
0.235180 0.556000 0.200000: require('oil.fs')
0.234770 0.302000 0.217000: require('vim.iter')
0.233840 0.311000 0.198000: require('todo-comments.jump')
0.233720 0.287000 0.223000: require('cmp_buffer')
0.230720 0.572000 0.171000: require('neorg.modules.core.journal.module')
0.230310 0.298000 0.172000: require('cmp.utils.snippet')
0.229900 0.433000 0.202000: require('vim.deprecated.health')
0.229210 5.677000 0.147000: require('neorg.modules.core.tangle.module')
0.228340 0.308000 0.201000: require('lspconfig.configs')
0.226710 0.346000 0.198000: require('luasnip.nodes.util')
0.224430 0.285000 0.185000: require('cmp.utils.feedkeys')
0.222960 0.623000 0.155000: require('neorg.modules.core.highlights.module')
0.222670 0.468000 0.192000: require('telescope._')
0.221340 0.321000 0.196000: require('luasnip.nodes.node')
0.219750 0.714000 0.006000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nyooom/plugin/nyooom.lua
0.218470 0.283000 0.201000: require('mason-core.installer.context')
0.217820 0.298000 0.201000: require('mellow.colors')
0.216890 0.310000 0.175000: require('cmp.types.lsp')
0.216840 0.275000 0.179000: require('vim.fs')
0.216260 0.266000 0.207000: require('cmp_buffer.source')
0.216060 0.536000 0.164000: require('treesj.langs.utils')
0.213770 0.323000 0.178000: require('luasnip.loaders.fs_watchers')
0.212320 0.325000 0.158000: init highlight
0.208980 0.339000 0.175000: require('luasnip.util.jsregexp')
0.207530 0.929000 0.151000: require('neorg.modules.core.ui.selection_popup.module')
0.206480 0.448000 0.166000: require('cmp.config.default')
0.206440 0.381000 0.189000: require('telescope._extensions.fzf')
0.203830 0.434000 0.144000: require('luasnip.session')
0.201750 0.256000 0.168000: require('harpoon.ui')
0.201560 0.469000 0.122000: require('luasnip.extras.fmt')
0.201490 0.246000 0.187000: require('luasnip.util.parser.neovim_parser')
0.201090 0.290000 0.150000: require('vim.inspect')
0.198040 0.872000 0.069000: require('leetcode.logger')
0.197790 0.481000 0.138000: require('neorg.modules.core.esupports.metagen.module')
0.197100 1.016000 0.119000: require('luasnip.nodes.insertNode')
0.195580 0.490000 0.153000: require('neorg.modules.core.neorgcmd.module')
0.194220 0.418000 0.173000: require('telescope.entry_manager')
0.193970 0.266000 0.166000: require('todo-comments.highlight')
0.193490 0.400000 0.124000: require('nio.logger')
0.192330 0.307000 0.133000: require('plenary.log')
0.192030 0.879000 0.159000: require('luasnip.session.snippet_collection')
0.191690 0.722000 0.171000: require('mason-core.fs')
0.191510 0.284000 0.153000: require('treesj.langs.ruby')
0.190550 0.255000 0.140000: require('gitsigns.highlight')
0.189900 0.926000 0.174000: /usr/share/nvim/runtime/syntax/syntax.vim
0.186950 0.238000 0.173000: require('fidget.commands')
0.185590 0.272000 0.159000: require('todo-comments.config')
0.184920 0.271000 0.155000: require('luasnip.loaders.util')
0.184230 0.365000 0.139000: require('nio.file')
0.184070 0.242000 0.159000: require('gitsigns.config')
0.183020 0.419000 0.160000: require('luasnip.util.util')
0.182435 0.528000 0.002000: /home/squibid/.local/share/nvim/site/pack/deps/opt/lsp_lines/plugin/lsplines.vim
0.181500 0.586000 0.166000: require('mason-core.installer.registry.link')
0.181460 0.365000 0.159000: require('vim.health')
0.180860 0.246000 0.149000: require('lspconfig.configs.texlab')
0.180230 0.317000 0.162000: require('plenary.async.control')
0.179270 0.295000 0.138000: require('vim.ui')
0.176270 0.266000 0.143000: require('colorizer/trie')
0.176010 0.267000 0.145000: require('cmp.utils.window')
0.175550 0.405000 0.121000: require('luasnip.default_config')
0.173440 0.223000 0.142000: require('cmp.utils.keymap')
0.172560 0.274000 0.159000: require('plenary.vararg')
0.171590 0.685000 0.131000: require('mason-core.EventEmitter')
0.171280 0.468000 0.137000: require('luasnip.nodes.choiceNode')
0.171090 0.631000 0.155000: require('mason-core.purl')
0.169880 0.911000 0.135000: require('telescope.mappings')
0.168790 0.455000 0.149000: require('telescope._extensions.neorg.search_headings')
0.167290 0.222000 0.150000: require('nvim-treesitter.ts_utils')
0.166970 0.409000 0.136000: require('neorg.modules.core.qol.todo_items.module')
0.159690 0.782000 0.101000: require('nvim-ts-autotag.config.ft')
0.159090 0.304000 0.142000: require('neorg.modules.core.summary.module')
0.158750 0.226000 0.133000: require('vim.version')
0.158750 0.279000 0.128000: require('cmp.utils.str')
0.157870 0.399000 0.126000: require('neorg.modules.core.promo.module')
0.157180 0.196000 0.136000: require('nvim-treesitter.indent')
0.157130 0.921000 0.122000: require('cmp.view.wildmenu_entries_view')
0.156800 0.940000 0.132000: require('neorg.modules.core.export.module')
0.156400 0.300000 0.123000: require('telescope.pickers.entry_display')
0.155070 0.962000 0.115000: require('Comment.ft')
0.154010 0.377000 0.075000: require('luasnip.extras')
0.151900 0.188000 0.144000: require('cmp_buffer.buffer')
0.151530 0.214000 0.137000: /home/squibid/.local/share/nvim/site/pack/deps/opt/cmp-async-path/after/plugin/cmp_async_path.lua
0.151420 1.029000 0.104000: require('neorg.modules.core.esupports.indent.module')
0.150360 0.484000 0.097000: require('neorg.modules.core.keybinds.module')
0.149480 0.248000 0.102000: require('nio.tasks')
0.149100 0.238000 0.118000: require('plenary.window.border')
0.147310 0.280000 0.126000: require('neorg.modules.core.queries.native.module')
0.146320 0.291000 0.118000: require('luasnip.nodes.dynamicNode')
0.145410 0.186000 0.131000: require('gitsigns.async')
0.144720 0.193000 0.122000: require('harpoon.list')
0.141770 0.196000 0.120000: require('mason-lspconfig.api.command')
0.140560 0.175000 0.135000: require('luasnip.loaders.snippet_cache')
0.140090 0.301000 0.125000: require('telescope.previewers.utils')
0.137730 0.885000 0.110000: require('telescope._extensions.neorg.find_aof_tasks')
0.135280 0.298000 0.091000: require('nio.control')
0.135160 0.183000 0.121000: require('lspconfig.manager')
0.134390 0.162000 0.125000: require('luasnip.util.directed_graph')
0.134170 0.949000 0.107000: require('plenary.bit')
0.134040 0.363000 0.108000: require('cmp.config.compare')
0.133330 0.941000 0.103000: require('dap.utils')
0.132560 0.201000 0.118000: require('fidget.notification.window')
0.131330 0.163000 0.122000: require('cmp_async_path')
0.130500 0.221000 0.119000: require('plenary.vararg.rotate')
0.130360 0.174000 0.109000: require('fidget.progress.display')
0.130190 0.198000 0.099000: require('vim.lsp.sync')
0.129370 0.649000 0.096000: require('mason-core.log')
0.129230 0.169000 0.114000: require('nvim-treesitter.shell_command_selectors')
0.129200 0.193000 0.117000: /home/squibid/.local/share/nvim/site/pack/deps/opt/cmp-nvim-lsp-signature-help/after/plugin/cmp_nvim_lsp_signature_help.lua
0.128860 0.820000 0.092000: require('oil.config')
0.128060 0.702000 0.038000: require('leetcode.translator')
0.127700 0.188000 0.107000: require('plenary.strings')
0.123255 0.289000 0.069000: /home/squibid/.local/share/nvim/site/pack/deps/opt/telescope.nvim/plugin/telescope.lua
0.122820 0.248000 0.095000: require('neorg.modules.core.looking-glass.module')
0.122470 0.319000 0.105000: require('telescope._extensions.neorg.find_aof_project_tasks')
0.122270 0.265000 0.099000: require('luasnip-jsregexp')
0.121780 1.002000 0.081000: require('pathlib.const')
0.121250 0.250000 0.088000: require('nio.streams')
0.120680 0.155000 0.103000: require('dap.breakpoints')
0.119850 0.234000 0.081000: require('conf.context')
0.119330 0.305000 0.093000: require('neorg.modules.core.presenter.module')
0.118930 0.154000 0.091000: require('mason-lspconfig.mappings.server')
0.118860 0.202000 0.111000: require('mason-core.process')
0.118370 0.733000 0.073000: require('nvim-ts-autotag.utils')
0.118320 0.273000 0.103000: require('telescope._extensions.neorg.insert_link')
0.116230 0.150000 0.097000: require('cmp.matcher')
0.115490 0.257000 0.100000: require('telescope._extensions.neorg.find_context_tasks')
0.115310 0.274000 0.097000: require('telescope.builtin')
0.115170 0.205000 0.096000: require('luasnip.nodes.restoreNode')
0.114930 0.239000 0.074000: require('neogen.mark')
0.113840 0.248000 0.082000: require('client')
0.110540 0.146000 0.094000: require('cmp.utils.misc')
0.108300 0.146000 0.089000: require('mason-lspconfig')
0.108080 0.166000 0.101000: require('cmp_nvim_lsp_signature_help')
0.105870 0.901000 0.068000: nvim_exec2()
0.104420 0.140000 0.096000: require('fidget.logger')
0.104410 0.173000 0.077000: opening buffers
0.103880 0.177000 0.085000: require('luasnip.util.path')
0.103330 0.342000 0.081000: require('vim.lsp._transport')
0.103170 0.145000 0.088000: require('colorizer/nvim')
0.103110 0.167000 0.079000: require('dep.log')
0.101590 0.194000 0.075000: require('lspconfig.configs.omnisharp')
0.101080 0.136000 0.091000: require('fidget.notification.view')
0.100790 0.131000 0.081000: require('cmp.view.native_entries_view')
0.099620 0.144000 0.095000: require('luasnip.util.parser.neovim_ast')
0.099170 0.170000 0.089000: require('telescope.debounce')
0.099030 0.181000 0.090000: require('mason-core.functional.list')
0.097830 0.854000 0.074000: require('fidget.integration')
0.097170 0.974000 0.077000: require('telescope._extensions.neorg.find_project_tasks')
0.097140 0.127000 0.076000: require('cmp.config.mapping')
0.097010 0.870000 0.080000: require('telescope._extensions.neorg.backlinks.file_backlinks')
0.094150 0.208000 0.084000: require('telescope.algos.linked_list')
0.093850 0.129000 0.080000: require('lspconfig.configs.clangd')
0.093200 0.168000 0.060000: event init
0.092890 0.181000 0.083000: require('lsp_lines.render')
0.092540 0.244000 0.073000: require('neorg.modules.core.ui.calendar.module')
0.091780 0.140000 0.083000: require('fzf_lib')
0.091580 0.121000 0.074000: require('cmp.view.ghost_text_view')
0.091130 0.176000 0.072000: require('telescope.actions.mt')
0.091120 0.194000 0.075000: require('neorg.modules.core.todo-introspector.module')
0.091100 0.177000 0.065000: require('mason-core.spawn')
0.090770 0.120000 0.074000: require('neorg.core.log')
0.090460 0.131000 0.074000: require('harpoon.config')
0.090200 0.782000 0.068000: require('cmp_nvim_lsp.source')
0.090180 0.163000 0.065000: require('nio.tests')
0.089760 0.247000 0.083000: require('mason-core.async')
0.088870 0.192000 0.079000: require('telescope.pickers.highlights')
0.088160 0.172000 0.071000: require('Comment.opfunc')
0.088100 0.114000 0.083000: /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim
0.087690 0.167000 0.066000: require('luasnip.util.ext_opts')
0.087270 0.188000 0.068000: require('telescope.config.resolve')
0.087110 0.121000 0.078000: require('gitsigns.debug.log')
0.086360 0.209000 0.078000: require('telescope._extensions.neorg.insert_file_link')
0.085930 0.221000 0.062000: require('nio.process')
0.084930 0.118000 0.070000: require('conf.plugins.oil')
0.084700 0.112000 0.079000: require('luasnip.nodes.snippetProxy')
0.083640 0.114000 0.078000: require('cmp-under-comparator')
0.083520 0.125000 0.079000: /usr/share/nvim/runtime/plugin/gzip.vim
0.082380 0.162000 0.058000: require('pathlib.utils.nuv')
0.082030 0.141000 0.068000: require('conf.plugins.jdtls')
0.081140 0.185000 0.068000: require('mason-core.functional')
0.081070 0.189000 0.063000: require('dep.proc')
0.080340 0.151000 0.072000: require('nvim-treesitter.utils')
0.080040 0.118000 0.064000: require('cmp.context')
0.079000 0.125000 0.072000: require('vim.treesitter._range')
0.078948 6.408000 0.000000: nvim_exec2() called at /home/squibid/.config/nvim/init.lua:0
0.078460 0.118000 0.069000: require('luasnip.util.mark')
0.077670 0.199000 0.068000: require('telescope.themes')
0.077290 0.130000 0.064000: require('luasnip.nodes.functionNode')
0.077180 0.112000 0.069000: /home/squibid/.local/share/nvim/site/pack/deps/opt/cmp-luasnip-choice/after/plugin/cmp_luasnip_choice.lua
0.077030 0.483000 0.047000: require('treesj.langs.typescript')
0.076940 0.111000 0.061000: require('core.folding')
0.076610 0.136000 0.071000: require('vim.treesitter.language')
0.075690 0.190000 0.052000: require('server')
0.075270 0.935000 0.035000: require('leetcode.config.langs')
0.074710 0.105000 0.064000: require('lspconfig.configs.basedpyright')
0.074110 0.122000 0.055000: require('cmp.utils.char')
0.073890 0.111000 0.064000: require('mason-lspconfig.lspconfig_hook')
0.073600 0.136000 0.066000: require('telescope._extensions.neorg.switch_workspace')
0.073060 0.115000 0.056000: require('treesj.langs.python')
0.072980 0.125000 0.066000: require('mason-core.functional.function')
0.072110 0.105000 0.059000: require('harpoon.buffer')
0.070740 0.189000 0.050000: require('neorg.modules.core.itero.module')
0.070580 0.230000 0.063000: require('telescope.previewers.previewer')
0.070580 0.087000 0.068000: require('luasnip.nodes.duplicate')
0.070480 0.149000 0.041000: require('snippets.php')
0.070350 0.136000 0.048000: require('treesj.langs.rust')
0.069490 0.101000 0.064000: require('fidget.spinner')
0.069430 0.122000 0.051000: require('pathlib.utils.lists')
0.069150 0.118000 0.056000: require('luasnip.util.log')
0.068550 0.168000 0.056000: require('neorg.modules.core.integrations.nvim-cmp.module')
0.068230 0.321000 0.054000: require('luasnip.util.select')
0.067850 0.105000 0.062000: require('plenary.async.structs')
0.067610 0.101000 0.060000: require('fidget.poll')
0.067560 0.093000 0.062000: require('lspconfig.async')
0.067300 0.096000 0.065000: require('luasnip.util.functions')
0.067140 0.114000 0.060000: require('mellow.config')
0.067070 0.130000 0.050000: require('lspconfig.configs.lua_ls')
0.066920 0.080000 0.062000: require('mason-core.installer.linker')
0.066870 0.117000 0.060000: require('nvim-treesitter.query_predicates')
0.066760 0.109000 0.055000: require('treesj.langs.elixir')
0.065750 0.102000 0.054000: require('cmp.utils.autocmd')
0.065510 0.182000 0.051000: require('conf.plugins.cmp')
0.064440 0.101000 0.052000: require('harpoon.logger')
0.064210 0.082000 0.062000: require('luasnip.session.enqueueable_operations')
0.064130 0.154000 0.040000: require('conf.autos')
0.063920 0.119000 0.058000: require('plenary.class')
0.063870 0.186000 0.052000: require('oil.log')
0.063320 0.109000 0.058000: require('mason-core.result')
0.063130 0.125000 0.056000: require('telescope._extensions.neorg.find_norg_files')
0.062530 0.131000 0.046000: require('telescope.actions.utils')
0.061890 0.173000 0.040000: early init
0.061830 0.242000 0.050000: require('luasnip.nodes.multiSnippet')
0.061250 0.114000 0.055000: require('telescope.finders.async_job_finder')
0.061220 0.140000 0.055000: require('telescope.pickers.layout')
0.060290 0.121000 0.048000: require('lspconfig.configs.ts_ls')
0.060290 0.332000 0.045000: require('lspconfig.configs.cssls')
0.059610 0.124000 0.044000: require('telescope.pickers.scroller')
0.059530 0.078000 0.057000: /usr/share/nvim/runtime/plugin/matchparen.vim
0.059110 0.392000 0.050000: require('mason-core.installer.registry.expr')
0.059020 0.739000 0.034000: require('neogen.utilities.helpers')
0.058980 0.133000 0.054000: require('mason-registry.sources')
0.058970 0.084000 0.056000: /usr/share/nvim/runtime/plugin/rplugin.vim
0.058930 0.148000 0.046000: require('neorg.modules.core.pivot.module')
0.058680 0.132000 0.042000: require('pathlib.utils.paths')
0.058360 0.086000 0.051000: require('lspconfig.configs.gopls')
0.058280 0.089000 0.053000: require('mason-core.receipt')
0.058130 0.148000 0.051000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-dap/plugin/dap.lua
0.057960 0.238000 0.047000: require('luasnip.extras.postfix')
0.057800 0.148000 0.023000: require('conf.plugins.treesitter')
0.057440 0.109000 0.049000: require('luasnip.util.str')
0.056990 0.081000 0.053000: require('vim.func._memoize')
0.056980 0.084000 0.053000: require('mason-core.async.control')
0.056630 0.104000 0.045000: require('conf.plugins.neorg')
0.056350 0.071000 0.054000: /usr/share/nvim/runtime/plugin/zipPlugin.vim
0.055940 0.085000 0.047000: require('lspconfig.configs.arduino_language_server')
0.055890 0.172000 0.039000: require('neorg.modules.core.storage.module')
0.055840 0.141000 0.043000: require('neorg.modules.core.clipboard.module')
0.055510 0.105000 0.037000: BufEnter autocommands
0.055210 0.097000 0.046000: require('lspconfig.configs.html')
0.055170 0.090000 0.045000: require('lspconfig.configs.zls')
0.055100 0.091000 0.048000: require('telescope.finders.async_static_finder')
0.055060 0.159000 0.043000: require('conf.plugins.mason-lspconfig')
0.054760 0.157000 0.037000: require('conf.plugins.telescope')
0.053550 0.126000 0.048000: require('telescope.pickers.multi')
0.053060 0.535000 0.039000: require('mason-core.optional')
0.053010 0.082000 0.049000: require('plenary.tbl')
0.052970 0.136000 0.037000: require('neorg.modules.core.ui.text_popup.module')
0.052960 0.084000 0.043000: require('neorg.core.config')
0.052020 0.526000 0.042000: require('telescope._extensions.neorg.backlinks.common')
0.051580 0.103000 0.041000: require('lspconfig.configs.mesonlsp')
0.051550 0.088000 0.045000: require('lspconfig.configs.bashls')
0.051170 0.145000 0.038000: require('pathlib.utils.errors')
0.051100 0.083000 0.047000: require('fidget.spinner.patterns')
0.051030 0.089000 0.044000: require('luasnip.util.pattern_tokenizer')
0.050930 0.092000 0.042000: require('Comment.extra')
0.050630 0.105000 0.034000: require('leetcode.config.template')
0.050430 0.585000 0.024000: require('leetcode.command.arguments')
0.049920 0.131000 0.039000: require('conf.plugins.gitsigns')
0.049640 0.076000 0.043000: require('todo-comments.util')
0.049380 0.084000 0.042000: require('lspconfig.configs.fortls')
0.049060 0.121000 0.044000: require('mason-core.functional.string')
0.048810 0.114000 0.042000: require('lspconfig.configs.phpactor')
0.048220 0.102000 0.043000: require('telescope._extensions.neorg.backlinks.header_backlinks')
0.048140 0.940000 0.022000: require('neorg.modules.core.links.module')
0.047980 0.066000 0.044000: require('cmp_luasnip_choice')
0.047350 0.068000 0.044000: loading packages
0.047300 0.074000 0.041000: require('lspconfig.configs.rnix')
0.046910 0.736000 0.017000: require('leetcode.config.imports')
0.046590 0.072000 0.040000: require('treesj.utils')
0.046220 0.074000 0.043000: require('plenary.errors')
0.046020 0.102000 0.034000: require('luasnip.nodes.textNode')
0.045910 0.071000 0.042000: require('fidget.progress.handle')
0.045880 0.059000 0.039000: require('lspconfig.configs.asm_lsp')
0.045360 0.091000 0.035000: require('treesj.langs.julia')
0.045295 0.118000 0.004000: /home/squibid/.local/share/nvim/site/pack/deps/opt/undotree/plugin/undotree.vim
0.045050 0.068000 0.040000: require('telescope._extensions.neorg')
0.045010 0.062000 0.040000: require('lspconfig.configs.openscad_lsp')
0.044820 0.070000 0.036000: require('plenary.functional')
0.044090 0.169000 0.036000: require('fidget.integration.xcodebuild-nvim')
0.044010 0.070000 0.042000: /usr/share/nvim/runtime/plugin/tarPlugin.vim
0.043780 0.069000 0.035000: require('Comment')
0.042870 0.097000 0.027000: require('nvim-ts-autotag.config.init')
0.042300 0.077000 0.028000: require('luasnip.extras.conditions.expand')
0.042250 0.110000 0.031000: require('luasnip.extras.filetype_functions')
0.042030 0.102000 0.038000: require('mason-core.functional.table')
0.041920 0.103000 0.031000: require('treesj.langs.cpp')
0.041270 0.067000 0.038000: require('mason-core.installer.registry.util')
0.040200 0.065000 0.037000: /usr/share/nvim/runtime/syntax/synload.vim
0.040150 0.095000 0.033000: require('mason.settings')
0.040070 0.161000 0.027000: require('treesj.langs.perl')
0.039770 0.062000 0.032000: require('pathlib.utils.tables')
0.039310 0.062000 0.029000: require('vim.keymap')
0.039310 0.064000 0.031000: require('conf.plugins.luasnip')
0.039180 0.118000 0.029000: require('conf.plugins.dap')
0.038870 0.067000 0.031000: require('harpoon.extensions')
0.038730 0.154000 0.026000: require('neorg.modules.core.neorgcmd.commands.return.module')
0.038570 0.099000 0.028000: require('treesj.langs.go')
0.037930 0.055000 0.033000: require('gitsigns.debounce')
0.037790 0.057000 0.024000: locale set
0.036770 0.099000 0.024000: require('neogen.config')
0.036420 0.100000 0.030000: require('telescope._extensions')
0.036250 0.083000 0.025000: require('treesj.langs.php')
0.036030 0.062000 0.029000: require('luasnip.loaders.data')
0.035940 0.066000 0.033000: /usr/share/nvim/runtime/plugin/osc52.lua
0.035620 0.086000 0.023000: require('leetcode.config.stats')
0.035390 0.058000 0.032000: require('mason-core.providers')
0.035250 0.065000 0.031000: require('mason-core.path')
0.035220 0.822000 0.024000: require('nvim-treesitter.caching')
0.034700 0.071000 0.032000: require('vim.func')
0.034380 0.057000 0.032000: /usr/share/nvim/runtime/plugin/man.lua
0.034110 0.056000 0.026000: require('nvim-treesitter.highlight')
0.033610 0.555000 0.024000: require('fidget.integration.nvim-tree')
0.033120 0.055000 0.031000: require('fidget.options')
0.032650 0.064000 0.027000: require('treesj.langs.yaml')
0.032160 0.059000 0.025000: require('luasnip.util.extend_decorator')
0.032100 0.074000 0.023000: require('telescope.actions.state')
0.032090 0.094000 0.024000: require('treesj.langs.zig')
0.031990 0.053000 0.026000: require('Comment.config')
0.031730 0.049000 0.021000: expanding arguments
0.031340 0.409000 0.022000: require('plenary.compat')
0.031200 0.090000 0.024000: require('treesj.langs.nix')
0.030880 0.051000 0.023000: /usr/share/nvim/runtime/ftplugin.vim
0.030560 0.467000 0.022000: require('luasnip.util.auto_table')
0.030470 0.063000 0.022000: require('neorg.modules.core.clipboard.code-blocks.module')
0.030140 0.067000 0.024000: require('luasnip.extras.conditions')
0.029710 0.055000 0.025000: require('luasnip.util.dict')
0.029470 0.053000 0.021000: init first window
0.029330 0.085000 0.022000: require('treesj.langs.bash')
0.029330 0.063000 0.023000: require('conf.plugins.mellow')
0.028960 0.082000 0.020000: require('treesj.langs.starlark')
0.028620 0.048000 0.026000: require('cmp_buffer.timer')
0.028590 0.099000 0.020000: require('treesj.langs.r')
0.028570 0.067000 0.019000: require('telescope.state')
0.028510 0.044000 0.025000: require('mason-core.functional.type')
0.028500 0.082000 0.017000: require('leetcode.config.icons')
0.028490 0.083000 0.019000: require('treesj.langs.kotlin')
0.028140 0.066000 0.025000: require('nvim-treesitter.statusline')
0.028010 0.049000 0.021000: require('conf.plugins.harpoon')
0.027510 0.063000 0.023000: require('mason-core.functional.number')
0.027360 0.062000 0.021000: require('cmp.types.cmp')
0.027330 0.041000 0.024000: require('nvim-treesitter.compat')
0.027330 0.046000 0.023000: require('mason-core.functional.logic')
0.027240 0.582000 0.015000: require('leetcode.config.sessions')
0.027050 0.053000 0.022000: require('cmp.utils.highlight')
0.026790 0.301000 0.019000: require('neorg.core.callbacks')
0.026760 0.075000 0.016000: require('treesj.langs.html')
0.026350 0.104000 0.020000: require('treesj.langs.lua')
0.026150 0.051000 0.021000: require('cmp.utils.cache')
0.025850 0.052000 0.022000: require('cmp.utils.event')
0.025090 0.032000 0.024000: /usr/share/nvim/runtime/plugin/shada.vim
0.024860 0.074000 0.019000: require('oil.ringbuf')
0.024495 0.064000 0.007000: /home/squibid/.local/share/nvim/site/pack/deps/opt/instant.nvim/plugin/instant.vim
0.024390 0.109000 0.018000: require('treesj.langs.java')
0.024020 0.058000 0.021000: /usr/share/nvim/runtime/plugin/editorconfig.lua
0.023780 0.068000 0.016000: require('util.helpers')
0.023700 0.036000 0.021000: require('plenary.popup.utils')
0.023660 0.042000 0.021000: require('telescope.pickers.window')
0.023630 0.082000 0.017000: require('treesj.langs.c')
0.023470 0.187000 0.016000: require('neorg.modules.core.defaults.module')
0.022810 0.084000 0.016000: require('conf.plugins.todo-comments')
0.022540 0.053000 0.019000: require('treesj.langs.default_preset')
0.022250 0.052000 0.015000: require('cmp.config.sources')
0.021970 0.056000 0.017000: require('telescope.from_entry')
0.021940 0.046000 0.019000: require('mason-core.functional.relation')
0.021910 0.046000 0.016000: require('conf.plugins.mini-clue')
0.021900 0.045000 0.018000: require('luasnip.session.snippet_collection.source')
0.021840 0.052000 0.020000: require('plenary.window')
0.021690 0.547000 0.010000: require('leetcode.config.hooks')
0.021610 0.059000 0.016000: require('conf.plugins.fidget')
0.021190 0.048000 0.018000: require('oil-git-status.system')
0.021090 0.052000 0.017000: require('cmp.utils.pattern')
0.020370 0.044000 0.017000: require('treesj.langs.sql')
0.020330 0.045000 0.016000: require('treesj.langs.css')
0.020320 0.056000 0.014000: require('conf.plugins.mason')
0.020110 0.051000 0.016000: require('neorg.modules.core.integrations.zen_mode.module')
0.020060 0.027000 0.017000: require('harpoon.utils')
0.019830 0.070000 0.015000: require('treesj.langs.dart')
0.019730 0.286000 0.014000: require('luasnip.util.table')
0.019440 0.076000 0.015000: require('neorg.modules.core.concealer.preset_varied.module')
0.019440 0.049000 0.014000: require('luasnip.util.events')
0.019400 0.047000 0.014000: require('luasnip.util.types')
0.018880 0.033000 0.015000: require('cmp.config.window')
0.018070 0.033000 0.011000: /usr/share/nvim/runtime/indent.vim
0.018060 0.076000 0.013000: require('telescope.deprecated')
0.017940 0.040000 0.015000: require('cmp.utils.buffer')
0.017550 0.075000 0.014000: require('neorg.modules.core.concealer.preset_diamond.module')
0.017430 0.025000 0.015000: require('treesj.langs.haskell')
0.017380 0.036000 0.014000: require('nvim-ts-autotag._log')
0.017310 0.037000 0.013000: require('conf.plugins.dressing')
0.017160 0.029000 0.014000: require('vim.F')
0.016680 0.030000 0.015000: /usr/share/nvim/runtime/plugin/tohtml.lua
0.016350 0.042000 0.013000: require('cmp.utils.debug')
0.016280 0.067000 0.012000: require('treesj.langs.json')
0.016270 0.111000 0.008000: require('conf.plugins.ts-autotag')
0.016260 0.051000 0.014000: require('cmp.utils.options')
0.015980 0.047000 0.014000: /home/squibid/.local/share/nvim/site/pack/deps/opt/vimtex/ftdetect/cls.vim
0.015960 0.103000 0.010000: require('conf.plugins.treesj')
0.015940 0.087000 0.008000: require('conf.plugins.undotree')
0.015940 0.044000 0.009000: require('core.snippets.functions')
0.015800 0.029000 0.013000: require('luasnip.util.time')
0.015590 0.031000 0.013000: require('neorg.modules.core.concealer.preset_basic.module')
0.015430 0.026000 0.014000: require('mason-core.functional.data')
0.015180 0.026000 0.011000: require('luasnip.util.lazy_table')
0.015090 0.030000 0.012000: require('luasnip.extras.conditions.show')
0.014870 0.039000 0.013000: require('lsp_lines.config')
0.014450 0.021000 0.013000: require('mason-lspconfig.settings')
0.014320 0.043000 0.013000: require('mason-core.async.uv')
0.014180 0.025000 0.010000: require('conf.plugins.headlines')
0.014130 0.053000 0.011000: require('luasnip.nodes.key_indexer')
0.014075 0.038000 0.012000: /home/squibid/.local/share/nvim/site/pack/deps/opt/plenary.nvim/plugin/plenary.vim
0.013590 0.034000 0.009000: require('conf.plugins.nvim-colorizer')
0.013590 0.114000 0.009000: inits 2
0.013330 0.026000 0.008000: require('mason-lspconfig.server_config_extensions')
0.013180 0.041000 0.009000: require('conf.plugins.neogen')
0.013020 0.048000 0.009000: require('conf.plugins.project')
0.012830 0.030000 0.010000: /home/squibid/.local/share/nvim/site/pack/deps/opt/LuaSnip/plugin/luasnip.vim
0.012775 0.044000 0.003000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-jdtls/plugin/nvim_jdtls.vim
0.012580 0.032000 0.009000: require('conf.plugins.leetcode')
0.012380 0.054000 0.010000: require('treesj.langs.tsx')
0.012135 0.043000 0.006000: /home/squibid/.local/share/nvim/site/pack/deps/opt/vimtex/plugin/vimtex.vim
0.011910 0.038000 0.010000: /home/squibid/.local/share/nvim/site/pack/deps/opt/todo-comments.nvim/plugin/todo.vim
0.011770 0.036000 0.009000: require('oil.constants')
0.011710 0.084000 0.006000: require('conf.plugins.vimtex')
0.011620 0.034000 0.009000: require('mason-lspconfig.notify')
0.011580 0.038000 0.008000: require('util.connection')
0.011470 0.035000 0.007000: require('conf.plugins.comment')
0.011410 0.028000 0.010000: --- NVIM STARTED ---
0.011390 0.018000 0.010000: require('mason.version')
0.011260 0.038000 0.009000: require('treesj.langs.vue')
0.011180 0.035000 0.009000: require('treesj.langs.php_only')
0.011130 0.043000 0.008000: require('treesj.langs.toml')
0.010650 0.032000 0.008000: /home/squibid/.local/share/nvim/site/pack/deps/opt/helpful.vim/plugin/helpful.vim
0.010640 0.015000 0.009000: require('harpoon.autocmd')
0.010380 0.019000 0.007000: require('ffi')
0.010330 0.024000 0.007000: require('conf.plugins.lsp_lines')
0.010180 0.029000 0.006000: /home/squibid/.local/share/nvim/site/pack/deps/opt/zen-mode.nvim/plugin/zen-mode.vim
0.009980 0.030000 0.003000: /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-colorizer.lua/plugin/colorizer.vim
0.009800 0.030000 0.008000: require('treesj.langs.pug')
0.009690 0.033000 0.009000: /home/squibid/.local/share/nvim/site/pack/deps/opt/vimtex/ftdetect/tex.vim
0.009630 0.023000 0.008000: /home/squibid/.local/share/nvim/site/pack/deps/opt/cmp-nvim-lsp/after/plugin/cmp_nvim_lsp.lua
0.009620 0.028000 0.008000: require('treesj.langs.scss')
0.009520 0.027000 0.006000: require('conf.plugins.nyooom')
0.009430 0.038000 0.007000: require('cmp.types.vim')
0.009360 0.013000 0.008000: /home/squibid/.local/share/nvim/site/pack/deps/opt/vimtex/ftdetect/tikz.vim
0.009250 0.033000 0.008000: require('treesj.langs.jsonc')
0.008940 0.013000 0.007000: require('treesj.langs.svelte')
0.008480 0.040000 0.007000: require('treesj.langs.json5')
0.008380 0.015000 0.005000: clear screen
0.008310 0.027000 0.006000: require('conf.plugins.instant')
0.007290 0.017000 0.005000: require('conf.plugins.helpful')
0.007070 0.012000 0.006000: /usr/share/nvim/runtime/plugin/tutor.vim
0.006880 0.165000 0.004000: require('jsregexp.core')
0.006450 0.008000 0.006000: /usr/share/nvim/runtime/plugin/spellfile.vim
0.006130 0.012000 0.006000: inits 3
0.005720 0.013000 0.003000: window checked
0.004060 0.008000 0.003000: /usr/share/nvim/runtime/plugin/netrwPlugin.vim
0.003230 0.006000 0.002000: init default mappings & autocommands
0.003130 0.007000 0.003000: nvim_exec2() called at /home/squibid/.local/share/nvim/site/pack/deps/opt/nvim-cmp/plugin/cmp.lua:0
0.002690 0.011000 0.002000: parsing arguments
0.002330 0.006000 0.002000: /home/squibid/.local/share/nvim/rplugin.vim
0.001490 0.002000 0.001000: editing files in windows
0.000999 0.026000 0.000000: nvim_exec2() called at ColorScheme Autocommands for "*":0
0.000310 0.001000 0.000000: --- NVIM STARTING ---

3
extras/c.sh Normal file
View File

@ -0,0 +1,3 @@
# TODO:
# add something to check if we need to run bear again to update
# clangd build options

View File

@ -1,26 +1,22 @@
-- TODO: after switching to dep with lazy loading check out vim-startuptime
-- again
_G.core = require("core")
-- enable performance stuff
if vim.fn.has("nvim-0.9") == true then
vim.loader.enable()
end
vim.loader.enable()
-- load user config
require("conf")
-- bootstrap plugin manager
local path = vim.fn.stdpath("data").."/site/pack/deps/opt/dep"
if vim.fn.empty(vim.fn.glob(path)) > 0 then
vim.fn.system({ "git", "clone", "--depth=1", "https://git.squi.bid/dep", path })
vim.fn.system({ "git", "clone", "--depth=1", "https://git.squi.bid/dep",
path })
end
vim.cmd("packadd dep")
-- load miscellaneous utilities
local misc = require("core.misc")
-- load user config
misc.include("conf.opts") -- setup options
misc.include("conf.binds") -- setup keybinds
misc.include("conf.autos") -- setup autos
-- load plugins
require("dep") {
{ "squibid/dep",
@ -32,8 +28,11 @@ require("dep") {
-- aquire all plugin specs
local plugs = {}
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/conf/plugins/*.lua", true)) do
local ret = misc.include("conf.plugins."..file:gsub("^.*/", ""):gsub("%.lua$", ""))
for _, file in ipairs(vim.api.nvim_get_runtime_file(
"lua/conf/plugins/*.lua", true)) do
local ret = require("conf.plugins."..file:gsub("^.*/", ""):gsub("%.lua$",
""))
if type(ret) ~= "boolean" then
plugs[#plugs + 1] = ret
end

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")
@ -48,3 +47,5 @@ auto("BufWritePre", {
vim.fn.mkdir(dir, "p")
end
})
core.color.setup_termbg_sync()

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
@ -24,14 +23,16 @@ map("n", "<leader>x", function() -- execute order 111
if vim.fn.getftype(fn) == "file" then
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 })
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."-"..string.sub(fn, 4, 5).."-"..string.sub(fn, 7, 8).."-")
vim.notify("Removed executable flags")
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 })
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."x"..string.sub(fn, 4, 5).."x"..string.sub(fn, 7, 8).."x")
vim.notify("Add executable flags")
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 })
vim.notify("File doesn't exist")
end
end, { desc = "toggle executable flag of the file" })
@ -50,7 +51,8 @@ vim.keymap.set("n", "z=", function()
end
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)
vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt },
spell_on_choice)
end, { desc = "Shows spelling suggestions" })
-- quickfix

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,13 +1,10 @@
local misc = require("core.misc")
local auto = misc.auto
local auto = core.misc.auto
-- color stuff
if vim.fn.has("termguicolors") then
vim.opt.termguicolors = true
end
vim.opt.laststatus = 3
-- numbers
vim.opt.number = true
vim.opt.relativenumber = true
@ -64,95 +61,129 @@ 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
-- 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 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
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
else
vim.opt.foldmethod = "syntax"
do -- folding
auto("FileType", {
callback = function()
-- use treesitter for folding
if require("nvim-treesitter.parsers").has_parser() then
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
else
vim.opt.foldmethod = "syntax"
end
end
end
})
})
-- lsp folding: vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()"
-- waiting on https://github.com/neovim/neovim/pull/31311 to hit a release
vim.lsp.config['*'] = {
capabilities = {
textDocument = {
foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
}
}
}
vim.opt.foldlevelstart = 99
vim.opt.foldlevel = 99
vim.opt.foldenable = true
vim.o.fillchars = "fold: "
vim.opt.foldlevelstart = 99
vim.opt.foldlevel = 99
vim.opt.foldenable = true
vim.o.fillchars = "fold: "
_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
"%m", -- modify tag
"%r", -- readonly flag
"%=", -- seperate left and right side
-- 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
"%<", -- we can start truncating here
" "..percentage() -- percentage through the buffer
}
vim.opt.foldtext = "v:lua.core.folding()"
end
do -- statusline
local last_bufnr, i = 1, 1
--- status line
---@return string out formatted status line
function _G.Status()
--- get the percentage through the file
---@return string out the formatted percentage
local function percentage()
local percent, line, lines
-- get the current and total # of lines
line = vim.api.nvim_win_get_cursor(0)[1]
lines = vim.api.nvim_buf_line_count(0)
-- calculate the percentage through the file
percent = math.floor((line / lines) * 100)
if percent == 0 or line == 1 then
return "Top"
elseif percent == 100 or line == lines then
return "Bot"
end
return percent.."%%"
end
--- get the number of lsp servers
---@return string out the formatted number of servers
local function lsp_servers()
local out, nclients, hi
local hi_groups = { "@boolean", "@constant", "@keyword", "@number" }
-- get the number of clients
nclients = #vim.lsp.get_clients({ bufnr = 0 })
-- set the client display
out = "λ"..nclients
if nclients > 0 then
local bufnr = vim.api.nvim_win_get_buf(0)
if bufnr ~= last_bufnr then
last_bufnr = bufnr
i = i + 1
if i > #hi_groups then
i = 1
end
end
hi = "%#"..hi_groups[i].."#"
out = hi..out.."%#StatusLine#"
end
return out
end
--- get git status information
---@return string out git status information or nothing
local function gitsigns()
local reset = "%#StatusLine#"
local hl = reset
local lil_guy = "o/"
---@type table
local status = vim.b.gitsigns_status_dict
if not status then
return ""
end
if status.removed and status.removed > 0 then
hl = "%#GitSignsDelete#"
lil_guy = "<o>"
elseif status.changed and status.changed > 0 then
hl = "%#GitSignsChange#"
lil_guy = "o7"
elseif status.added and status.added > 0 then
hl = "%#GitSignsAdd#"
lil_guy = "\\o/"
end
return hl..lil_guy..reset
end
return table.concat {
"%t", -- file name
" %h", -- help buffer tag
"%m", -- modify tag
"%r", -- readonly flag
"%=", -- seperate left and right side
-- print out git status information in the form of a lil guy
gitsigns(), " ",
-- print out the number of lsp clients attached with nice colors :)
lsp_servers(), " ",
"%<", -- we can start truncating here (I want to keep the file name)
"%l,%c%V", -- line, column-virtual column
"%<", -- we can start truncating here
" "..percentage() -- percentage through the buffer
}
end
vim.opt.statusline = "%!v:lua.Status()"
vim.opt.laststatus = 3
end
vim.o.statusline="%!v:lua.Status()"

View File

@ -0,0 +1,7 @@
return { "mfussenegger/nvim-dap-python",
requires = "mfussenegger/nvim-dap",
function()
local debugpy = core.mason.get_pkg_path("debugpy", "/venv/bin/python3")
require("dap-python").setup(debugpy)
end
}

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
@ -57,7 +43,7 @@ return { "mfussenegger/nvim-dap",
-- define codelldb
dap.adapters.codelldb = {
type = "executable",
command = "codelldb",
command = "codelldb"
}
-- define the c configuration for codelldb
@ -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
@ -79,17 +67,19 @@ return { "mfussenegger/nvim-dap",
dap.configurations.rust = dap.configurations.c
-- keybinds
map("n", "<Leader>ec", dap.continue, { desc = "dap continue " })
map("n", "<Leader>el", dap.run_last, { desc = "dap run last" })
map("n", "<Leader>et", function()
map("n", "<leader>ec", dap.continue, { desc = "dap continue" })
map("n", "<leader>el", dap.run_last, { desc = "dap run last" })
map("n", "<leader>et", function()
dap.terminate()
unset_hover_bind()
end, { 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>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" })
-- events
dap.listeners.after['event_initialized']['me'] = set_hover_bind

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"),
@ -13,9 +15,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.notify("added "..vim.fn.expand("%:t").." to quickmarks")
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

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

View File

@ -5,12 +5,23 @@ 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",
"mesonlsp",
"bashls",
"jdtls",
"lua_ls",
"jdtls"
"stylua",
-- python
"basedpyright",
"mypy",
"black",
"debugpy"
}
}
end

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,13 +54,21 @@ return { "L3MON4D3/LuaSnip",
end
end)
-- load all snippets from snippet directory
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do
-- 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

@ -23,7 +23,17 @@ return { "mellow-theme/mellow.nvim",
["BlinkCmpMenu"] = { link = "NormalFloat" },
["BlinkCmpMenuBorder"] = { link = "BlinkCmpMenu" },
["BlinkCmpMenuSelection"] = { bg = c.gray01 },
["BlinkCmpLabelDeprecated"] = { link = "CmpItemAbbrDeprecated" }
["BlinkCmpLabelDeprecated"] = { link = "CmpItemAbbrDeprecated" },
-- telescope styling so I can see when coding outside (real)
["TelescopeResultsNormal"] = { bg = c.bg_dark },
["TelescopeResultsBorder"] = { link = "TelescopeResultsNormal" },
["TelescopeResultsTitle"] = {
bg = core.color.copyhl("TelescopeResultsNormal").background,
fg = core.color.copyhl("TelescopeResultsNormal").background
},
["TelescopePreviewNormal"] = { link = "NormalFloat" },
["TelescopePreviewBorder"] = { link = "TelescopePreviewNormal" }
}
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

@ -0,0 +1,31 @@
local augroup = core.misc.augroup("nullls formatting")
return { "nvimtools/none-ls.nvim",
function()
local null_ls = require("null-ls")
null_ls.setup {
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.black,
null_ls.builtins.diagnostics.mypy
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr
})
core.misc.auto("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end
})
end
end
}
end
}

View File

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

View File

@ -1,12 +1,12 @@
local misc = require("core.misc")
local map = misc.map
local map = core.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
for line in vim.gsplit(result.stdout, "\n", {
plain = true, trimempty = true }) do
-- Remove trailing slash
line = line:gsub("/$", "")
ret[line] = true
@ -20,16 +20,20 @@ local function new_git_status()
return setmetatable({}, {
__index = function(self, key)
local ignore_proc = vim.system(
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" },
{ "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 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),

View File

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

29
lua/conf/plugins/show.lua Normal file
View File

@ -0,0 +1,29 @@
return { "nvzone/showkeys",
function()
require("showkeys").setup {
position = "top-right",
winopts = {
border = vim.g.border_style,
},
-- change the way it looks
winhl = "NormalFloat:Comment,NormalFloat:NormalFloat",
maxkeys = 3,
-- change the way keys are displayed
keyformat = {
["<BS>"] = "<BS>",
["<CR>"] = "<CR>",
["<Space>"] = "<Space>",
["<Up>"] = "<Up>",
["<Down>"] = "<Down>",
["<Left>"] = "<Left>",
["<Right>"] = "<Right>",
["<PageUp>"] = "<PageUp>",
["<PageDown>"] = "<PageDown>",
["<M>"] = "Alt",
["<C>"] = "Ctrl",
}
}
end
}

View File

@ -1,5 +1,24 @@
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
local function root_dir()
local clients = vim.lsp.get_clients({ bufnr = 0 })
if #clients > 0 then
return clients[1].config.root_dir
end
return "."
end
--- wrap a telebuilt picker to make it work for the current project root
---@param fn function telebuilt function
---@return function the new function
local function telebuilt_picker(fn)
return function()
fn { cwd = root_dir() }
end
end
return { "nvim-telescope/telescope.nvim",
disable = not vim.fn.has("nvim-0.9.0"),
@ -10,7 +29,6 @@ return { "nvim-telescope/telescope.nvim",
vim.cmd("make")
end
},
"mollerhoj/telescope-recent-files.nvim",
"nvim-telescope/telescope-ui-select.nvim"
},
@ -53,37 +71,37 @@ return { "nvim-telescope/telescope.nvim",
-- load in the fzf extension
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()
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>f", telebuilt_picker(telebuilt.find_files), {
desc = "Find files."
})
map("n", "<leader>i", telebuilt.help_tags, {
desc = "find help tags.",
map("n", "<leader>o", telebuilt.oldfiles, { desc = "Find old." })
map("n", "<leader>s", telebuilt_picker(telebuilt.live_grep), {
desc = "Find strings."
})
map("n", "<leader>i", telebuilt.help_tags, { desc = "find help tags." })
map("n", "<leader>l", telebuilt.lsp_document_symbols, {
desc = "Find symbols."
})
-- find over specific directories
map("n", "<leader>tc", function()
require("telescope.builtin").find_files {
cwd = vim.fn.stdpath("config")
}
telebuilt.find_files { cwd = vim.fn.stdpath("config") }
end, { desc = "find config files" })
map("n", "<leader>tp", function()
require("telescope.builtin").find_files {
telebuilt.find_files {
cwd = vim.fs.joinpath(vim.fn.stdpath("data"), "site/pack/deps/opt")
}
end, { desc = "find files in plugin directory" })
-- enable previewing in the default colorscheme switcher
telebuilt.colorscheme = function()
require("telescope.builtin.__internal").colorscheme { enable_preview = true }
require("telescope.builtin.__internal").colorscheme {
enable_preview = true
}
end
end
}

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,8 @@ 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, vim.api.nvim_buf_get_name(buf))
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
end

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()

167
lua/core/color.lua Normal file
View File

@ -0,0 +1,167 @@
local M = {}
--- copy highlight group
---@param hlgroup string highlight group to copy
---@param namespace? number highlight space
---@return table
function M.copyhl(hlgroup, namespace)
namespace = namespace or 0
local res = {}
local ok, hl = pcall(vim.api.nvim_get_hl, namespace, {
name = hlgroup,
create = false
})
if not ok then
-- return default
return {
["foreground"] = "#000000",
["background"] = "#000000",
["special"] = "#000000"
}
end
for _, key in pairs({ "foreground", "background", "special" }) do
if hl[key] then
res[key] = string.format("#%06x", hl[key])
end
end
return res
end
--- Taken from https://github.com/rachartier/tiny-inline-diagnostic.nvim
---@param hex string
---@return table rgb
function M.hex_to_rgb(hex)
if hex == nil or hex == 'None' then
return {0, 0, 0}
end
hex = hex:gsub('#', '')
hex = string.lower(hex)
return {
tonumber(hex:sub(1, 2), 16),
tonumber(hex:sub(3, 4), 16),
tonumber(hex:sub(5, 6), 16)
}
end
-- Source: 'runtime/lua/vim/_defaults.lua' in Neovim source
local function parse_osc11(x)
local r, g, b = x:match('^\027%]11;rgb:(%x+)/(%x+)/(%x+)$')
if not (r and g and b) then
local a
r, g, b, a = x:match('^\027%]11;rgba:(%x+)/(%x+)/(%x+)/(%x+)$')
if not (a and a:len() <= 4) then
return
end
end
if not (r and g and b) then
return
end
if not (r:len() <= 4 and g:len() <= 4 and b:len() <= 4) then
return
end
local parse_osc_hex = function(c)
return c:len() == 1 and (c..c) or c:sub(1, 2)
end
return '#'..parse_osc_hex(r)..parse_osc_hex(g)..parse_osc_hex(b)
end
local _termbg_init
--- taken from github.com/echasnovski/mini.misc modified to work for me
--- sets up terminal background synchronization which enables neovim to set the
--- background of the terminal it is running in
function M.setup_termbg_sync()
-- Handling `'\027]11;?\007'` response was added in Neovim 0.10
if vim.fn.has('nvim-0.10') == 0 then
vim.notify('`setup_termbg_sync()` requires Neovim>=0.10',
vim.log.levels.WARN)
end
-- Proceed only if there is a valid stdout to use
local has_stdout_tty = false
for _, ui in ipairs(vim.api.nvim_list_uis()) do
has_stdout_tty = has_stdout_tty or ui.stdout_tty
end
if not has_stdout_tty then return end
local augroup = vim.api.nvim_create_augroup('TermbgSync', {
clear = true,
})
local track_au_id, bad_responses, had_proper_response = nil, {}, false
local f = function(args)
-- Process proper response only once
if had_proper_response then
return
end
-- Neovim=0.10 uses string sequence as response, while Neovim>=0.11 sets it
-- in `sequence` table field
local seq = type(args.data) == 'table' and args.data.sequence or args.data
local ok, bg_init = pcall(parse_osc11, seq)
if not (ok and type(bg_init) == 'string') then
return table.insert(bad_responses, seq)
end
had_proper_response = true
pcall(vim.api.nvim_del_autocmd, track_au_id)
-- Set up sync
local sync = function()
local normal = vim.api.nvim_get_hl(0, {
name = "Normal",
create = false
})
if normal.bg == nil then
return
end
-- NOTE: use `io.stdout` instead of `io.write` to ensure correct target
-- Otherwise after `io.output(file); file:close()` there is an error
io.stdout:write(string.format('\027]11;#%06x\007', normal.bg))
end
vim.api.nvim_create_autocmd({ 'VimResume', 'ColorScheme' }, {
group = augroup,
callback = sync,
})
-- Set up reset to the color returned from the very first call
_termbg_init = _termbg_init or bg_init
local reset = function()
io.stdout:write('\027]11;'.._termbg_init..'\007')
end
vim.api.nvim_create_autocmd({ 'VimLeavePre', 'VimSuspend' }, {
group = augroup,
callback = reset,
})
-- Sync immediately
sync()
end
-- Ask about current background color and process the proper response.
-- NOTE: do not use `once = true` as Neovim itself triggers `TermResponse`
-- events during startup, so this should wait until the proper one.
track_au_id = vim.api.nvim_create_autocmd('TermResponse', {
group = augroup,
callback = f,
nested = true
})
io.stdout:write('\027]11;?\007')
vim.defer_fn(function()
if had_proper_response then
return
end
pcall(vim.api.nvim_del_augroup_by_id, augroup)
local bad_suffix = #bad_responses == 0 and '' or
(', only these: '..vim.inspect(bad_responses))
local msg =
"`setup_termbg_sync()` did not get proper response from terminal emulator"
..bad_suffix
vim.notify(msg, vim.log.levels.WARN)
end, 1000)
end
return M

55
lua/core/init.lua Normal file
View File

@ -0,0 +1,55 @@
-- inspired by (and partially yoinked from): github.com/gonstoll/dotfiles
local notify = vim.notify
--- overidden version of vim.notify
---@param msg string message
---@param level vim.log.levels? log level
---@param opts table? options
---@diagnostic disable-next-line: duplicate-set-field
vim.notify = function(msg, level, opts)
notify(msg, level or vim.log.levels.INFO, opts or {
title = require("core.misc").appid
})
end
--- check if the given table contains an item, and return the key value pair if
--- it does
---@param self table table
---@param item any item to find
---@return boolean, [any, any]? found true if found
table.contains = function(self, item)
for k, v in pairs(self) do
if v == item then
return true, { k, v }
end
end
return false
end
local M = {
misc = require("core.misc"),
folding = require("core.folding"),
lsp = require("core.lsp"),
color = require("core.color"),
snippets = vim.fs.joinpath(vim.fn.stdpath("config"), "lua/core/snippets.lua"),
}
M.mason = {
--- Gets a path to a package in the Mason registry.
--- Prefer this to `get_package`, since the package might not always be
--- available yet and trigger errors.
---@param pkg string
---@param path? string
get_pkg_path = function(pkg, path)
pcall(require, "mason") -- make sure Mason is loaded. Will fail when
-- generating docs
local root = vim.env.MASON or vim.fs.joinpath(vim.fn.stdpath("data"),
"mason")
path = path or ""
return vim.fs.joinpath(root, "packages", pkg, path)
end
}
return M

84
lua/core/lsp.lua Normal file
View File

@ -0,0 +1,84 @@
---@diagnostic disable: param-type-mismatch
local misc = require("core.misc")
local map, auto = misc.map, misc.auto
local popup_opts, hover_opts, signature_opts, list_opts, location_opts
-- 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")
end
-- disable the default keybinds (they're bad)
for _, bind in ipairs({ "grn", "gra", "gri", "grr" }) do
pcall(vim.keymap.del, "n", bind)
end
local M = {}
--- setup vim lsp options
function M.setup()
-- options for different lsp functions
popup_opts = { border = vim.g.border_style }
hover_opts = vim.tbl_deep_extend("force", popup_opts, {})
signature_opts = vim.tbl_deep_extend("force", popup_opts, {})
list_opts = { on_list = on_list }
location_opts = vim.tbl_deep_extend("force", list_opts, {})
-- confgiure lsp
vim.diagnostic.config {
virtual_text = false,
virtual_lines = {
current_line = true
},
update_in_insert = false,
underline = true,
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "x",
[vim.diagnostic.severity.WARN] = "!",
[vim.diagnostic.severity.INFO] = "i",
[vim.diagnostic.severity.HINT] = "h"
}
}
}
-- set default capabilities and attach function
vim.lsp.config['*'] = {
capabilities = vim.lsp.protocol.make_client_capabilities()
}
-- make my attach function always run
auto("LspAttach", {
callback = function(event)
local opts = { buffer = event.buf, nowait = true }
-- LSP actions
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, opts)
-- Diagnostics
map("n", "[d", function()
vim.diagnostic.jump({ count = -1 })
end, opts)
map("n", "]d", function()
vim.diagnostic.jump({ count = 1 })
end, opts)
end
})
end
return M

View File

@ -1,102 +0,0 @@
local misc = require("core.misc")
local map, auto = misc.map, misc.auto
local M = {}
-- 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")
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, {})
-- disable the default keybinds (they're bad)
for _, bind in ipairs({ "grn", "gra", "gri", "grr" }) do
pcall(vim.keymap.del, "n", bind)
end
--- setup basic options on lsp attach
---@param bufnr number buffer number
local function attach(bufnr)
local opts = { buffer = bufnr, nowait = true }
-- LSP actions
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",
})
-- Diagnostics
map("n", "[d", function()
vim.diagnostic.jump({ count = -1 })
end, opts)
map("n", "]d", function()
vim.diagnostic.jump({ count = 1 })
end, opts)
end
function M.setup()
vim.diagnostic.config {
virtual_text = false,
virtual_lines = {
only_current_line = true
},
update_in_insert = false,
underline = true,
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "x",
[vim.diagnostic.severity.WARN] = "!",
[vim.diagnostic.severity.INFO] = "i",
[vim.diagnostic.severity.HINT] = "h",
}
}
}
-- set default capabilities and attach function
vim.lsp.config['*'] = {
capabilities = vim.lsp.protocol.make_client_capabilities()
}
-- make my attach function always run
auto("LspAttach", {
callback = function(event)
attach(event.buf)
end
})
end
return M

View File

@ -3,18 +3,6 @@ local M = {}
--- vim.notify title
M.appid = "Nvim Config"
--- safe version of require
---@param fn string name of file to include
---@return any
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 })
return ok
end
return r
end
--- loop through files in directory
---@param path string absolute path of directory to be looped through
---@param body function function to use on every recursion of the loop
@ -99,31 +87,7 @@ function M.highlight(group, opts, namespace)
end
end
--- copy highlight group
---@param hlgroup string highlight group to copy
---@param namespace? number highlight space
---@return table
function M.cpyhl(hlgroup, namespace)
namespace = namespace or 0
local ok, hl = pcall(vim.api.nvim_get_hl, namespace, {
name = hlgroup,
create = false
})
if not ok then
return {}
end
for _, key in pairs({"foreground", "background", "special"}) do
if hl[key] then
hl[key] = string.format("#%06x", hl[key])
end
end
return hl
end
--- highlight something with some highlight group for a certain amount of time
---@param opts table? options
--- example:
--- ```lua
--- {
@ -145,6 +109,7 @@ end
--- ```
--- opts is optional and if empty will simply highlight the current line for
--- 250ms using IncSearch as the highlight group
---@param opts table? options
function M.timeout_highlight(opts)
opts = opts or {}
opts.hl = opts.hl or "IncSearch"

View File

@ -21,3 +21,7 @@ conds_expand = require("luasnip.extras.conditions.expand")
ts_postfix = require("luasnip.extras.treesitter_postfix").treesitter_postfix
postfix = require("luasnip.extras.postfix").postfix
ms = ls.multi_snippet
file_name = function(_, _, _)
return vim.fn.expand("%:t:r")
end

View File

@ -1,3 +0,0 @@
function file_name(_, _, _)
return vim.fn.expand("%:t:r")
end

View File

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

View File

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

View File

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

View File

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

View File

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

108
lua/snippets/python.lua Normal file
View File

@ -0,0 +1,108 @@
dofile(core.snippets)
--- convert snake to pascal case
---@return string classname
local function py_file_name()
local fn = file_name()
local new = ""
-- convert snake to pascal case
for i = 1, #fn do
if i == 1 then
new = fn:sub(1, 1):upper()
elseif fn:sub(i - 1, i - 1) == "_" then
new = new..fn:sub(i, i):upper()
elseif fn:sub(i, i) ~= "_" then
new = new..fn:sub(i, i)
end
end
return new
end
--- find the current class and return its name if not available defaults to
--- the file name
---@return string
local function python_class()
-- set the starting node to the node under the cursor
local node = require("nvim-treesitter.ts_utils").get_node_at_cursor()
while node do
-- check if we're in a class
if node:type() == "class_definition" then
-- find the class name in the class declaration and return it
for i = 0, node:child_count() - 1 do
local child = node:child(i)
if child and child:type() == "identifier" then
return vim.treesitter.get_node_text(child, 0)
end
end
end
node = node:parent()
end
-- if no class can be found default to the current file name
return file_name()
end
return {
s("class", {
t("class "),
c(1, {
f(py_file_name, {}),
i(0, "MyClass")
}),
c(2, {
t(""),
sn(nil, {
t("("),
i(1, "object"),
t(")")
})
}),
t({ ": ", "\t" }),
i(0)
}),
s({ trig = [[fn\|def\|constr\|init]], trigEngine = "vim" }, {
t("def "),
d(1, function(_, snip)
if snip.trigger == "constr" or snip.trigger == "init" then
print(python_class())
return sn(nil, {
t("__init__")
})
else
return sn(nil, {
i(1, "myFunc")
})
end
end, {}),
t("("),
d(2, function(_, snip)
-- if this is a constructor or a function in a class then we need to put
-- self as the first argument
if snip.trigger == "constr" or snip.trigger == "init"
or python_class() ~= file_name() then
return sn(nil, {
t("self")
})
else
return sn(nil, {})
end
end, {}),
i(3),
t(")"),
t(" -> "),
i(4, "None"),
t({ ":", "\t" }),
i(0, "pass")
}),
s("main", {
t({ "def main() -> None:", "\t" }),
i(0, 'print("hello world")'),
t({ "", "", 'if __name__ == "__main__":', "\tmain()" })
})
}

View File

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