From f302e2586a74b6f13df56ce5d9ffeda9bd26291c Mon Sep 17 00:00:00 2001 From: KaasKop Date: Wed, 12 Jun 2024 20:38:49 +0200 Subject: [PATCH] New nvim config, add mangohud --- config/MangoHud/MangoHud.conf | 44 + config/mpv/scripts/sponsorblock.lua | 866 +++++++++--------- config/nvim/lazyvim.json | 4 +- config/nvim/lua/config/lazy.lua | 11 +- config/nvim/lua/config/options.lua | 2 +- config/nvim/lua/plugins/example.lua | 23 +- config/nvim/lua/plugins/lazyvim.lua | 15 +- config/nvim/lua/plugins/mason.lua | 17 - config/nvim/lua/plugins/nvim-lspconfig.lua | 38 - config/nvim/lua/plugins/nvim-treesitter.lua | 2 +- config/nvim_old/lazyvim.json | 4 +- config/nvim_old/lua/config/lazy.lua | 12 +- config/nvim_old/lua/config/options.lua | 3 +- .../lua/plugins/colorizer.lua | 0 config/nvim_old/lua/plugins/colorscheme.lua | 12 - config/nvim_old/lua/plugins/headlines.lua | 27 - config/nvim_old/lua/plugins/lazyvim.lua | 15 + .../nvim_old/lua/plugins/markdown-preview.lua | 18 - config/nvim_old/lua/plugins/mason.lua | 27 +- config/nvim_old/lua/plugins/neo-tree.lua | 93 -- .../nvim_old/lua/plugins/nvim-lspconfig.lua | 86 +- .../nvim_old/lua/plugins/nvim-treesitter.lua | 5 + .../lua/plugins/telescope-fzf-native.lua | 13 + 23 files changed, 610 insertions(+), 727 deletions(-) create mode 100644 config/MangoHud/MangoHud.conf delete mode 100644 config/nvim/lua/plugins/mason.lua delete mode 100644 config/nvim/lua/plugins/nvim-lspconfig.lua rename config/{nvim => nvim_old}/lua/plugins/colorizer.lua (100%) delete mode 100644 config/nvim_old/lua/plugins/colorscheme.lua delete mode 100644 config/nvim_old/lua/plugins/headlines.lua create mode 100644 config/nvim_old/lua/plugins/lazyvim.lua delete mode 100644 config/nvim_old/lua/plugins/markdown-preview.lua create mode 100644 config/nvim_old/lua/plugins/telescope-fzf-native.lua diff --git a/config/MangoHud/MangoHud.conf b/config/MangoHud/MangoHud.conf new file mode 100644 index 0000000..4527e56 --- /dev/null +++ b/config/MangoHud/MangoHud.conf @@ -0,0 +1,44 @@ +################### File Generated by Goverlay ################### +legacy_layout=false + + +background_alpha=0.6 +round_corners=0 +background_alpha=0.6 +background_color=000000 + +font_size=24 +text_color=FFFFFF +position=top-left +toggle_hud=Shift_R+F12 +pci_dev=0:03:00.0 +table_columns=3 +gpu_text=GPU +gpu_stats +gpu_temp +gpu_mem_temp +cpu_text=CPU +cpu_stats + +cpu_temp +vram +vram_color=AD64C1 +ram +ram_color=C26693 +fps +fps_limit_method=late +toggle_fps_limit=Shift_L+F1 + +fps_limit=0 + + + + + + + +output_folder=/home/mitch +log_duration=30 +autostart_log=0 +log_interval=100 +toggle_logging=Shift_L+F2 diff --git a/config/mpv/scripts/sponsorblock.lua b/config/mpv/scripts/sponsorblock.lua index d20d017..3ad97d9 100644 --- a/config/mpv/scripts/sponsorblock.lua +++ b/config/mpv/scripts/sponsorblock.lua @@ -3,81 +3,81 @@ -- This script skips sponsored segments of YouTube videos -- using data from https://github.com/ajayyy/SponsorBlock -local ON_WINDOWS = package.config:sub(1,1) ~= "/" +local ON_WINDOWS = package.config:sub(1, 1) ~= "/" local options = { - server_address = "https://sponsor.ajay.app", + server_address = "https://sponsor.ajay.app", - python_path = ON_WINDOWS and "python" or "python3", + python_path = ON_WINDOWS and "python" or "python3", - -- Categories to fetch - categories = "sponsor,intro,outro,interaction,selfpromo,filler", + -- Categories to fetch + categories = "sponsor,intro,outro,interaction,selfpromo,filler", - -- Categories to skip automatically - skip_categories = "sponsor, intro, selfpromo", + -- Categories to skip automatically + skip_categories = "sponsor,intro,selfpromo", - -- If true, sponsored segments will only be skipped once - skip_once = true, + -- If true, sponsored segments will only be skipped once + skip_once = true, - -- Note that sponsored segments may ocasionally be inaccurate if this is turned off - -- see https://blog.ajay.app/voting-and-pseudo-randomness-or-sponsorblock-or-youtube-sponsorship-segment-blocker - local_database = false, + -- Note that sponsored segments may ocasionally be inaccurate if this is turned off + -- see https://blog.ajay.app/voting-and-pseudo-randomness-or-sponsorblock-or-youtube-sponsorship-segment-blocker + local_database = false, - -- Update database on first run, does nothing if local_database is false - auto_update = true, + -- Update database on first run, does nothing if local_database is false + auto_update = true, - -- How long to wait between local database updates - -- Format: "X[d,h,m]", leave blank to update on every mpv run - auto_update_interval = "6h", + -- How long to wait between local database updates + -- Format: "X[d,h,m]", leave blank to update on every mpv run + auto_update_interval = "6h", - -- User ID used to submit sponsored segments, leave blank for random - user_id = "", + -- User ID used to submit sponsored segments, leave blank for random + user_id = "", - -- Name to display on the stats page https://sponsor.ajay.app/stats/ leave blank to keep current name - display_name = "", + -- Name to display on the stats page https://sponsor.ajay.app/stats/ leave blank to keep current name + display_name = "", - -- Tell the server when a skip happens - report_views = true, + -- Tell the server when a skip happens + report_views = true, - -- Auto upvote skipped sponsors - auto_upvote = false, + -- Auto upvote skipped sponsors + auto_upvote = false, - -- Use sponsor times from server if they're more up to date than our local database - server_fallback = true, + -- Use sponsor times from server if they're more up to date than our local database + server_fallback = true, - -- Create chapters at sponsor boundaries for OSC display and manual skipping - make_chapters = true, + -- Create chapters at sponsor boundaries for OSC display and manual skipping + make_chapters = true, - -- Minimum duration for sponsors (in seconds), segments under that threshold will be ignored - min_duration = 1, + -- Minimum duration for sponsors (in seconds), segments under that threshold will be ignored + min_duration = 1, - -- Fade audio for smoother transitions - audio_fade = false, + -- Fade audio for smoother transitions + audio_fade = false, - -- Audio fade step, applied once every 100ms until cap is reached - audio_fade_step = 10, + -- Audio fade step, applied once every 100ms until cap is reached + audio_fade_step = 10, - -- Audio fade cap - audio_fade_cap = 0, + -- Audio fade cap + audio_fade_cap = 0, - -- Fast forward through sponsors instead of skipping - fast_forward = false, + -- Fast forward through sponsors instead of skipping + fast_forward = false, - -- Playback speed modifier when fast forwarding, applied once every second until cap is reached - fast_forward_increase = .2, + -- Playback speed modifier when fast forwarding, applied once every second until cap is reached + fast_forward_increase = .2, - -- Playback speed cap - fast_forward_cap = 2, + -- Playback speed cap + fast_forward_cap = 2, - -- Length of the sha256 prefix (3-32) when querying server, 0 to disable - sha256_length = 4, + -- Length of the sha256 prefix (3-32) when querying server, 0 to disable + sha256_length = 4, - -- Pattern for video id in local files, ignored if blank - -- Recommended value for base youtube-dl is "-([%w-_]+)%.[mw][kpe][v4b]m?$" - local_pattern = "", + -- Pattern for video id in local files, ignored if blank + -- Recommended value for base youtube-dl is "-([%w-_]+)%.[mw][kpe][v4b]m?$" + local_pattern = "", - -- Legacy option, use skip_categories instead - skip = true + -- Legacy option, use skip_categories instead + skip = true } mp.options = require "mp.options" @@ -96,465 +96,481 @@ scripts_dir = mp.find_config_file("scripts") local sponsorblock = utils.join_path(scripts_dir, "sponsorblock_shared/sponsorblock.py") local uid_path = utils.join_path(scripts_dir, "sponsorblock_shared/sponsorblock.txt") -local database_file = options.local_database and utils.join_path(scripts_dir, "sponsorblock_shared/sponsorblock.db") or "" +local database_file = options.local_database and utils.join_path(scripts_dir, "sponsorblock_shared/sponsorblock.db") or +"" local youtube_id = nil local ranges = {} local init = false -local segment = {a = 0, b = 0, progress = 0, first = true} +local segment = { a = 0, b = 0, progress = 0, first = true } local retrying = false -local last_skip = {uuid = "", dir = nil} +local last_skip = { uuid = "", dir = nil } local speed_timer = nil local fade_timer = nil local fade_dir = nil local volume_before = mp.get_property_number("volume") local categories = {} -local all_categories = {"sponsor", "intro", "outro", "interaction", "selfpromo", "preview", "music_offtopic", "filler"} +local all_categories = { "sponsor", "intro", "outro", "interaction", "selfpromo", "preview", "music_offtopic", "filler" } local chapter_cache = {} for category in string.gmatch(options.skip_categories, "([^,]+)") do - categories[category] = true + categories[category] = true end function file_exists(name) - local f = io.open(name,"r") - if f ~= nil then io.close(f) return true else return false end + local f = io.open(name, "r") + if f ~= nil then + io.close(f) + return true + else return false end end function t_count(t) - local count = 0 - for _ in pairs(t) do count = count + 1 end - return count + local count = 0 + for _ in pairs(t) do count = count + 1 end + return count end function time_sort(a, b) - if a.time == b.time then - return string.match(a.title, "segment end") - end - return a.time < b.time + if a.time == b.time then + return string.match(a.title, "segment end") + end + return a.time < b.time end function parse_update_interval() - local s = options.auto_update_interval - if s == "" then return 0 end -- Interval Disabled + local s = options.auto_update_interval + if s == "" then return 0 end -- Interval Disabled - local num, mod = s:match "^(%d+)([hdm])$" + local num, mod = s:match "^(%d+)([hdm])$" - if num == nil or mod == nil then - mp.osd_message("[sponsorblock] auto_update_interval " .. s .. " is invalid", 5) - return nil - end + if num == nil or mod == nil then + mp.osd_message("[sponsorblock] auto_update_interval " .. s .. " is invalid", 5) + return nil + end - local time_table = { - m = 60, - h = 60 * 60, - d = 60 * 60 * 24, - } + local time_table = { + m = 60, + h = 60 * 60, + d = 60 * 60 * 24, + } - return num * time_table[mod] + return num * time_table[mod] end function clean_chapters() - local chapters = mp.get_property_native("chapter-list") - local new_chapters = {} - for _, chapter in pairs(chapters) do - if chapter.title ~= "Preview segment start" and chapter.title ~= "Preview segment end" then - table.insert(new_chapters, chapter) - end + local chapters = mp.get_property_native("chapter-list") + local new_chapters = {} + for _, chapter in pairs(chapters) do + if chapter.title ~= "Preview segment start" and chapter.title ~= "Preview segment end" then + table.insert(new_chapters, chapter) end - mp.set_property_native("chapter-list", new_chapters) + end + mp.set_property_native("chapter-list", new_chapters) end function create_chapter(chapter_title, chapter_time) - local chapters = mp.get_property_native("chapter-list") - local duration = mp.get_property_native("duration") - table.insert(chapters, {title=chapter_title, time=(duration == nil or duration > chapter_time) and chapter_time or duration - .001}) - table.sort(chapters, time_sort) - mp.set_property_native("chapter-list", chapters) + local chapters = mp.get_property_native("chapter-list") + local duration = mp.get_property_native("duration") + table.insert(chapters, + { title = chapter_title, time = (duration == nil or duration > chapter_time) and chapter_time or duration - .001 }) + table.sort(chapters, time_sort) + mp.set_property_native("chapter-list", chapters) end function process(uuid, t, new_ranges) - start_time = tonumber(string.match(t, "[^,]+")) - end_time = tonumber(string.sub(string.match(t, ",[^,]+"), 2)) - for o_uuid, o_t in pairs(ranges) do - if (start_time >= o_t.start_time and start_time <= o_t.end_time) or (o_t.start_time >= start_time and o_t.start_time <= end_time) then - new_ranges[o_uuid] = o_t - return - end - end - category = string.match(t, "[^,]+$") - if categories[category] and end_time - start_time >= options.min_duration then - new_ranges[uuid] = { - start_time = start_time, - end_time = end_time, - category = category, - skipped = false - } - end - if options.make_chapters and not chapter_cache[uuid] then - chapter_cache[uuid] = true - local category_title = (category:gsub("^%l", string.upper):gsub("_", " ")) - create_chapter(category_title .. " segment start (" .. string.sub(uuid, 1, 6) .. ")", start_time) - create_chapter(category_title .. " segment end (" .. string.sub(uuid, 1, 6) .. ")", end_time) + start_time = tonumber(string.match(t, "[^,]+")) + end_time = tonumber(string.sub(string.match(t, ",[^,]+"), 2)) + for o_uuid, o_t in pairs(ranges) do + if (start_time >= o_t.start_time and start_time <= o_t.end_time) or (o_t.start_time >= start_time and o_t.start_time <= end_time) then + new_ranges[o_uuid] = o_t + return end + end + category = string.match(t, "[^,]+$") + if categories[category] and end_time - start_time >= options.min_duration then + new_ranges[uuid] = { + start_time = start_time, + end_time = end_time, + category = category, + skipped = false + } + end + if options.make_chapters and not chapter_cache[uuid] then + chapter_cache[uuid] = true + local category_title = (category:gsub("^%l", string.upper):gsub("_", " ")) + create_chapter(category_title .. " segment start (" .. string.sub(uuid, 1, 6) .. ")", start_time) + create_chapter(category_title .. " segment end (" .. string.sub(uuid, 1, 6) .. ")", end_time) + end end function getranges(_, exists, db, more) - if type(exists) == "table" and exists["status"] == "1" then - if options.server_fallback then - mp.add_timeout(0, function() getranges(true, true, "") end) - else - return mp.osd_message("[sponsorblock] database update failed, gave up") - end - end - if db ~= "" and db ~= database_file then db = database_file end - if exists ~= true and not file_exists(db) then - if not retrying then - mp.osd_message("[sponsorblock] database update failed, retrying...") - retrying = true - end - return update() - end - if retrying then - mp.osd_message("[sponsorblock] database update succeeded") - retrying = false - end - local sponsors - local args = { - options.python_path, - sponsorblock, - "ranges", - db, - options.server_address, - youtube_id, - options.categories, - tostring(options.sha256_length) - } - if not legacy then - sponsors = mp.command_native({name = "subprocess", capture_stdout = true, playback_only = false, args = args}) + if type(exists) == "table" and exists["status"] == "1" then + if options.server_fallback then + mp.add_timeout(0, function() getranges(true, true, "") end) else - sponsors = utils.subprocess({args = args}) + return mp.osd_message("[sponsorblock] database update failed, gave up") end - mp.msg.debug("Got: " .. string.gsub(sponsors.stdout, "[\n\r]", "")) - if not string.match(sponsors.stdout, "^%s*(.*%S)") then return end - if string.match(sponsors.stdout, "error") then return getranges(true, true) end - local new_ranges = {} - local r_count = 0 - if more then r_count = -1 end - for t in string.gmatch(sponsors.stdout, "[^:%s]+") do - uuid = string.match(t, "([^,]+),[^,]+$") - if ranges[uuid] then - new_ranges[uuid] = ranges[uuid] - else - process(uuid, t, new_ranges) - end - r_count = r_count + 1 + end + if db ~= "" and db ~= database_file then db = database_file end + if exists ~= true and not file_exists(db) then + if not retrying then + mp.osd_message("[sponsorblock] database update failed, retrying...") + retrying = true end - local c_count = t_count(ranges) - if c_count == 0 or r_count >= c_count then - ranges = new_ranges + return update() + end + if retrying then + mp.osd_message("[sponsorblock] database update succeeded") + retrying = false + end + local sponsors + local args = { + options.python_path, + sponsorblock, + "ranges", + db, + options.server_address, + youtube_id, + options.categories, + tostring(options.sha256_length) + } + if not legacy then + sponsors = mp.command_native({ name = "subprocess", capture_stdout = true, playback_only = false, args = args }) + else + sponsors = utils.subprocess({ args = args }) + end + mp.msg.debug("Got: " .. string.gsub(sponsors.stdout, "[\n\r]", "")) + if not string.match(sponsors.stdout, "^%s*(.*%S)") then return end + if string.match(sponsors.stdout, "error") then return getranges(true, true) end + local new_ranges = {} + local r_count = 0 + if more then r_count = -1 end + for t in string.gmatch(sponsors.stdout, "[^:%s]+") do + uuid = string.match(t, "([^,]+),[^,]+$") + if ranges[uuid] then + new_ranges[uuid] = ranges[uuid] + else + process(uuid, t, new_ranges) end + r_count = r_count + 1 + end + local c_count = t_count(ranges) + if c_count == 0 or r_count >= c_count then + ranges = new_ranges + end end function fast_forward() - if options.fast_forward and options.fast_forward == true then - speed_timer = nil - mp.set_property("speed", 1) - end - local last_speed = mp.get_property_number("speed") - local new_speed = math.min(last_speed + options.fast_forward_increase, options.fast_forward_cap) - if new_speed <= last_speed then return end - mp.set_property("speed", new_speed) + if options.fast_forward and options.fast_forward == true then + speed_timer = nil + mp.set_property("speed", 1) + end + local last_speed = mp.get_property_number("speed") + local new_speed = math.min(last_speed + options.fast_forward_increase, options.fast_forward_cap) + if new_speed <= last_speed then return end + mp.set_property("speed", new_speed) end function fade_audio(step) - local last_volume = mp.get_property_number("volume") - local new_volume = math.max(options.audio_fade_cap, math.min(last_volume + step, volume_before)) - if new_volume == last_volume then - if step >= 0 then fade_dir = nil end - if fade_timer ~= nil then fade_timer:kill() end - fade_timer = nil - return - end - mp.set_property("volume", new_volume) + local last_volume = mp.get_property_number("volume") + local new_volume = math.max(options.audio_fade_cap, math.min(last_volume + step, volume_before)) + if new_volume == last_volume then + if step >= 0 then fade_dir = nil end + if fade_timer ~= nil then fade_timer:kill() end + fade_timer = nil + return + end + mp.set_property("volume", new_volume) end function skip_ads(name, pos) - if pos == nil then return end - local sponsor_ahead = false - for uuid, t in pairs(ranges) do - if (options.fast_forward == uuid or not options.skip_once or not t.skipped) and t.start_time <= pos and t.end_time > pos then - if options.fast_forward == uuid then return end - if options.fast_forward == false then - mp.osd_message("[sponsorblock] " .. t.category .. " skipped") - mp.set_property("time-pos", t.end_time) - else - mp.osd_message("[sponsorblock] skipping " .. t.category) - end - t.skipped = true - last_skip = {uuid = uuid, dir = nil} - if options.report_views or options.auto_upvote then - local args = { - options.python_path, - sponsorblock, - "stats", - database_file, - options.server_address, - youtube_id, - uuid, - options.report_views and "1" or "", - uid_path, - options.user_id, - options.auto_upvote and "1" or "" - } - if not legacy then - mp.command_native_async({name = "subprocess", playback_only = false, args = args}, function () end) - else - utils.subprocess_detached({args = args}) - end - end - if options.fast_forward ~= false then - options.fast_forward = uuid - if speed_timer ~= nil then speed_timer:kill() end - speed_timer = mp.add_periodic_timer(1, fast_forward) - end - return - elseif (not options.skip_once or not t.skipped) and t.start_time <= pos + 1 and t.end_time > pos + 1 then - sponsor_ahead = true + if pos == nil then return end + local sponsor_ahead = false + for uuid, t in pairs(ranges) do + if (options.fast_forward == uuid or not options.skip_once or not t.skipped) and t.start_time <= pos and t.end_time > pos then + if options.fast_forward == uuid then return end + if options.fast_forward == false then + mp.osd_message("[sponsorblock] " .. t.category .. " skipped") + mp.set_property("time-pos", t.end_time) + else + mp.osd_message("[sponsorblock] skipping " .. t.category) + end + t.skipped = true + last_skip = { uuid = uuid, dir = nil } + if options.report_views or options.auto_upvote then + local args = { + options.python_path, + sponsorblock, + "stats", + database_file, + options.server_address, + youtube_id, + uuid, + options.report_views and "1" or "", + uid_path, + options.user_id, + options.auto_upvote and "1" or "" + } + if not legacy then + mp.command_native_async({ name = "subprocess", playback_only = false, args = args }, function() end) + else + utils.subprocess_detached({ args = args }) end + end + if options.fast_forward ~= false then + options.fast_forward = uuid + if speed_timer ~= nil then speed_timer:kill() end + speed_timer = mp.add_periodic_timer(1, fast_forward) + end + return + elseif (not options.skip_once or not t.skipped) and t.start_time <= pos + 1 and t.end_time > pos + 1 then + sponsor_ahead = true end - if options.audio_fade then - if sponsor_ahead then - if fade_dir ~= false then - if fade_dir == nil then volume_before = mp.get_property_number("volume") end - if fade_timer ~= nil then fade_timer:kill() end - fade_dir = false - fade_timer = mp.add_periodic_timer(.1, function() fade_audio(-options.audio_fade_step) end) - end - elseif fade_dir == false then - fade_dir = true - if fade_timer ~= nil then fade_timer:kill() end - fade_timer = mp.add_periodic_timer(.1, function() fade_audio(options.audio_fade_step) end) - end - end - if options.fast_forward and options.fast_forward ~= true then - options.fast_forward = true - speed_timer:kill() - speed_timer = nil - mp.set_property("speed", 1) + end + if options.audio_fade then + if sponsor_ahead then + if fade_dir ~= false then + if fade_dir == nil then volume_before = mp.get_property_number("volume") end + if fade_timer ~= nil then fade_timer:kill() end + fade_dir = false + fade_timer = mp.add_periodic_timer(.1, function() fade_audio(-options.audio_fade_step) end) + end + elseif fade_dir == false then + fade_dir = true + if fade_timer ~= nil then fade_timer:kill() end + fade_timer = mp.add_periodic_timer(.1, function() fade_audio(options.audio_fade_step) end) end + end + if options.fast_forward and options.fast_forward ~= true then + options.fast_forward = true + speed_timer:kill() + speed_timer = nil + mp.set_property("speed", 1) + end end function vote(dir) - if last_skip.uuid == "" then return mp.osd_message("[sponsorblock] no sponsors skipped, can't submit vote") end - local updown = dir == "1" and "up" or "down" - if last_skip.dir == dir then return mp.osd_message("[sponsorblock] " .. updown .. "vote already submitted") end - last_skip.dir = dir - local args = { - options.python_path, - sponsorblock, - "stats", - database_file, - options.server_address, - youtube_id, - last_skip.uuid, - "", - uid_path, - options.user_id, - dir - } - if not legacy then - mp.command_native_async({name = "subprocess", playback_only = false, args = args}, function () end) - else - utils.subprocess({args = args}) - end - mp.osd_message("[sponsorblock] " .. updown .. "vote submitted") + if last_skip.uuid == "" then return mp.osd_message("[sponsorblock] no sponsors skipped, can't submit vote") end + local updown = dir == "1" and "up" or "down" + if last_skip.dir == dir then return mp.osd_message("[sponsorblock] " .. updown .. "vote already submitted") end + last_skip.dir = dir + local args = { + options.python_path, + sponsorblock, + "stats", + database_file, + options.server_address, + youtube_id, + last_skip.uuid, + "", + uid_path, + options.user_id, + dir + } + if not legacy then + mp.command_native_async({ name = "subprocess", playback_only = false, args = args }, function() end) + else + utils.subprocess({ args = args }) + end + mp.osd_message("[sponsorblock] " .. updown .. "vote submitted") end function update() - mp.command_native_async({name = "subprocess", playback_only = false, args = { - options.python_path, - sponsorblock, - "update", - database_file, - options.server_address - }}, getranges) + mp.command_native_async({ + name = "subprocess", + playback_only = false, + args = { + options.python_path, + sponsorblock, + "update", + database_file, + options.server_address + } + }, getranges) end function file_loaded() - local initialized = init - ranges = {} - segment = {a = 0, b = 0, progress = 0, first = true} - last_skip = {uuid = "", dir = nil} - chapter_cache = {} - local video_path = mp.get_property("path", "") - mp.msg.debug("Path: " .. video_path) - local video_referer = string.match(mp.get_property("http-header-fields", ""), "Referer:([^,]+)") or "" - mp.msg.debug("Referer: " .. video_referer) + local initialized = init + ranges = {} + segment = { a = 0, b = 0, progress = 0, first = true } + last_skip = { uuid = "", dir = nil } + chapter_cache = {} + local video_path = mp.get_property("path", "") + mp.msg.debug("Path: " .. video_path) + local video_referer = string.match(mp.get_property("http-header-fields", ""), "Referer:([^,]+)") or "" + mp.msg.debug("Referer: " .. video_referer) - local urls = { - "ytdl://([%w-_]+).*", - "https?://youtu%.be/([%w-_]+).*", - "https?://w?w?w?%.?youtube%.com/v/([%w-_]+).*", - "/watch.*[?&]v=([%w-_]+).*", - "/embed/([%w-_]+).*" + local urls = { + "ytdl://([%w-_]+).*", + "https?://youtu%.be/([%w-_]+).*", + "https?://w?w?w?%.?youtube%.com/v/([%w-_]+).*", + "/watch.*[?&]v=([%w-_]+).*", + "/embed/([%w-_]+).*" + } + youtube_id = nil + for i, url in ipairs(urls) do + youtube_id = youtube_id or string.match(video_path, url) or string.match(video_referer, url) + if youtube_id then break end + end + youtube_id = youtube_id or string.match(video_path, options.local_pattern) + + if not youtube_id or string.len(youtube_id) < 11 or (local_pattern and string.len(youtube_id) ~= 11) then return end + youtube_id = string.sub(youtube_id, 1, 11) + mp.msg.debug("Found YouTube ID: " .. youtube_id) + init = true + if not options.local_database then + getranges(true, true) + else + local exists = file_exists(database_file) + if exists and options.server_fallback then + getranges(true, true) + mp.add_timeout(0, function() getranges(true, true, "", true) end) + elseif exists then + getranges(true, true) + elseif options.server_fallback then + mp.add_timeout(0, function() getranges(true, true, "") end) + end + end + if initialized then return end + if options.skip then + mp.observe_property("time-pos", "native", skip_ads) + end + if options.display_name ~= "" then + local args = { + options.python_path, + sponsorblock, + "username", + database_file, + options.server_address, + youtube_id, + "", + "", + uid_path, + options.user_id, + options.display_name } - youtube_id = nil - for i, url in ipairs(urls) do - youtube_id = youtube_id or string.match(video_path, url) or string.match(video_referer, url) - if youtube_id then break end - end - youtube_id = youtube_id or string.match(video_path, options.local_pattern) - - if not youtube_id or string.len(youtube_id) < 11 or (local_pattern and string.len(youtube_id) ~= 11) then return end - youtube_id = string.sub(youtube_id, 1, 11) - mp.msg.debug("Found YouTube ID: " .. youtube_id) - init = true - if not options.local_database then - getranges(true, true) + if not legacy then + mp.command_native_async({ name = "subprocess", playback_only = false, args = args }, function() end) else - local exists = file_exists(database_file) - if exists and options.server_fallback then - getranges(true, true) - mp.add_timeout(0, function() getranges(true, true, "", true) end) - elseif exists then - getranges(true, true) - elseif options.server_fallback then - mp.add_timeout(0, function() getranges(true, true, "") end) - end + utils.subprocess_detached({ args = args }) end - if initialized then return end - if options.skip then - mp.observe_property("time-pos", "native", skip_ads) - end - if options.display_name ~= "" then - local args = { - options.python_path, - sponsorblock, - "username", - database_file, - options.server_address, - youtube_id, - "", - "", - uid_path, - options.user_id, - options.display_name - } - if not legacy then - mp.command_native_async({name = "subprocess", playback_only = false, args = args}, function () end) - else - utils.subprocess_detached({args = args}) - end - end - if not options.local_database or (not options.auto_update and file_exists(database_file)) then return end + end + if not options.local_database or (not options.auto_update and file_exists(database_file)) then return end - if file_exists(database_file) then - local db_info = utils.file_info(database_file) - local cur_time = os.time(os.date("*t")) - local upd_interval = parse_update_interval() - if upd_interval == nil or os.difftime(cur_time, db_info.mtime) < upd_interval then return end - end + if file_exists(database_file) then + local db_info = utils.file_info(database_file) + local cur_time = os.time(os.date("*t")) + local upd_interval = parse_update_interval() + if upd_interval == nil or os.difftime(cur_time, db_info.mtime) < upd_interval then return end + end - update() + update() end function set_segment() - if not youtube_id then return end - local pos = mp.get_property_number("time-pos") - if pos == nil then return end - if segment.progress > 1 then - segment.progress = segment.progress - 2 + if not youtube_id then return end + local pos = mp.get_property_number("time-pos") + if pos == nil then return end + if segment.progress > 1 then + segment.progress = segment.progress - 2 + end + if segment.progress == 1 then + segment.progress = 0 + segment.b = pos + mp.osd_message("[sponsorblock] segment boundary B set, press again for boundary A", 3) + else + segment.progress = 1 + segment.a = pos + mp.osd_message("[sponsorblock] segment boundary A set, press again for boundary B", 3) + end + if options.make_chapters and not segment.first then + local start_time = math.min(segment.a, segment.b) + local end_time = math.max(segment.a, segment.b) + if end_time - start_time ~= 0 and end_time ~= 0 then + clean_chapters() + create_chapter("Preview segment start", start_time) + create_chapter("Preview segment end", end_time) end - if segment.progress == 1 then - segment.progress = 0 - segment.b = pos - mp.osd_message("[sponsorblock] segment boundary B set, press again for boundary A", 3) - else - segment.progress = 1 - segment.a = pos - mp.osd_message("[sponsorblock] segment boundary A set, press again for boundary B", 3) - end - if options.make_chapters and not segment.first then - local start_time = math.min(segment.a, segment.b) - local end_time = math.max(segment.a, segment.b) - if end_time - start_time ~= 0 and end_time ~= 0 then - clean_chapters() - create_chapter("Preview segment start", start_time) - create_chapter("Preview segment end", end_time) - end - end - segment.first = false + end + segment.first = false end function select_category(selected) - for category in string.gmatch(options.categories, "([^,]+)") do - mp.remove_key_binding("select_category_"..category) - mp.remove_key_binding("kp_select_category_"..category) - end - submit_segment(selected) + for category in string.gmatch(options.categories, "([^,]+)") do + mp.remove_key_binding("select_category_" .. category) + mp.remove_key_binding("kp_select_category_" .. category) + end + submit_segment(selected) end function submit_segment(category) - if not youtube_id then return end - local start_time = math.min(segment.a, segment.b) - local end_time = math.max(segment.a, segment.b) - if end_time - start_time == 0 or end_time == 0 then - mp.osd_message("[sponsorblock] empty segment, not submitting") - elseif segment.progress <= 1 then - segment.progress = segment.progress + 2 - local category_list = "" - for category_id, category in pairs(all_categories) do - local category_title = (category:gsub("^%l", string.upper):gsub("_", " ")) - category_list = category_list .. category_id .. ": " .. category_title .. "\n" - mp.add_forced_key_binding(tostring(category_id), "select_category_"..category, function() select_category(category) end) - mp.add_forced_key_binding("KP"..tostring(category_id), "kp_select_category_"..category, function() select_category(category) end) - end - mp.osd_message(string.format("[sponsorblock] press a number to select category for segment: %.2d:%.2d:%.2d to %.2d:%.2d:%.2d\n\n" .. category_list .. "\nyou can press Shift+G again for default (Sponsor) or hide this message with g", math.floor(start_time/(60*60)), math.floor(start_time/60%60), math.floor(start_time%60), math.floor(end_time/(60*60)), math.floor(end_time/60%60), math.floor(end_time%60)), 30) - else - mp.osd_message("[sponsorblock] submitting segment...", 30) - local submit - local args = { - options.python_path, - sponsorblock, - "submit", - database_file, - options.server_address, - youtube_id, - tostring(start_time), - tostring(end_time), - uid_path, - options.user_id, - category or "sponsor" - } - if not legacy then - submit = mp.command_native({name = "subprocess", capture_stdout = true, playback_only = false, args = args}) - else - submit = utils.subprocess({args = args}) - end - if string.match(submit.stdout, "success") then - segment = {a = 0, b = 0, progress = 0, first = true} - mp.osd_message("[sponsorblock] segment submitted") - if options.make_chapters then - clean_chapters() - create_chapter("Submitted segment start", start_time) - create_chapter("Submitted segment end", end_time) - end - elseif string.match(submit.stdout, "error") then - mp.osd_message("[sponsorblock] segment submission failed, server may be down. try again", 5) - elseif string.match(submit.stdout, "502") then - mp.osd_message("[sponsorblock] segment submission failed, server is down. try again", 5) - elseif string.match(submit.stdout, "400") then - mp.osd_message("[sponsorblock] segment submission failed, impossible inputs", 5) - segment = {a = 0, b = 0, progress = 0, first = true} - elseif string.match(submit.stdout, "429") then - mp.osd_message("[sponsorblock] segment submission failed, rate limited. try again", 5) - elseif string.match(submit.stdout, "409") then - mp.osd_message("[sponsorblock] segment already submitted", 3) - segment = {a = 0, b = 0, progress = 0, first = true} - else - mp.osd_message("[sponsorblock] segment submission failed", 5) - end + if not youtube_id then return end + local start_time = math.min(segment.a, segment.b) + local end_time = math.max(segment.a, segment.b) + if end_time - start_time == 0 or end_time == 0 then + mp.osd_message("[sponsorblock] empty segment, not submitting") + elseif segment.progress <= 1 then + segment.progress = segment.progress + 2 + local category_list = "" + for category_id, category in pairs(all_categories) do + local category_title = (category:gsub("^%l", string.upper):gsub("_", " ")) + category_list = category_list .. category_id .. ": " .. category_title .. "\n" + mp.add_forced_key_binding(tostring(category_id), "select_category_" .. category, + function() select_category(category) end) + mp.add_forced_key_binding("KP" .. tostring(category_id), "kp_select_category_" .. category, + function() select_category(category) end) end + mp.osd_message( + string.format( + "[sponsorblock] press a number to select category for segment: %.2d:%.2d:%.2d to %.2d:%.2d:%.2d\n\n" .. + category_list .. "\nyou can press Shift+G again for default (Sponsor) or hide this message with g", + math.floor(start_time / (60 * 60)), math.floor(start_time / 60 % 60), math.floor(start_time % 60), + math.floor(end_time / (60 * 60)), math.floor(end_time / 60 % 60), math.floor(end_time % 60)), 30) + else + mp.osd_message("[sponsorblock] submitting segment...", 30) + local submit + local args = { + options.python_path, + sponsorblock, + "submit", + database_file, + options.server_address, + youtube_id, + tostring(start_time), + tostring(end_time), + uid_path, + options.user_id, + category or "sponsor" + } + if not legacy then + submit = mp.command_native({ name = "subprocess", capture_stdout = true, playback_only = false, args = args }) + else + submit = utils.subprocess({ args = args }) + end + if string.match(submit.stdout, "success") then + segment = { a = 0, b = 0, progress = 0, first = true } + mp.osd_message("[sponsorblock] segment submitted") + if options.make_chapters then + clean_chapters() + create_chapter("Submitted segment start", start_time) + create_chapter("Submitted segment end", end_time) + end + elseif string.match(submit.stdout, "error") then + mp.osd_message("[sponsorblock] segment submission failed, server may be down. try again", 5) + elseif string.match(submit.stdout, "502") then + mp.osd_message("[sponsorblock] segment submission failed, server is down. try again", 5) + elseif string.match(submit.stdout, "400") then + mp.osd_message("[sponsorblock] segment submission failed, impossible inputs", 5) + segment = { a = 0, b = 0, progress = 0, first = true } + elseif string.match(submit.stdout, "429") then + mp.osd_message("[sponsorblock] segment submission failed, rate limited. try again", 5) + elseif string.match(submit.stdout, "409") then + mp.osd_message("[sponsorblock] segment already submitted", 3) + segment = { a = 0, b = 0, progress = 0, first = true } + else + mp.osd_message("[sponsorblock] segment submission failed", 5) + end + end end mp.register_event("file-loaded", file_loaded) diff --git a/config/nvim/lazyvim.json b/config/nvim/lazyvim.json index f03853f..b1aed37 100644 --- a/config/nvim/lazyvim.json +++ b/config/nvim/lazyvim.json @@ -3,7 +3,7 @@ ], "news": { - "NEWS.md": "3314" + "NEWS.md": "6077" }, - "version": 3 + "version": 6 } \ No newline at end of file diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua index ea9298a..2a0e94e 100644 --- a/config/nvim/lua/config/lazy.lua +++ b/config/nvim/lua/config/lazy.lua @@ -5,16 +5,17 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then -- stylua: ignore vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) end -vim.opt.rtp:prepend(vim.env.LAZY or lazypath) +vim.opt.rtp:prepend(lazypath) require("lazy").setup({ spec = { + -- add LazyVim and import its plugins { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here -- { import = "lazyvim.plugins.extras.lang.typescript" }, -- { import = "lazyvim.plugins.extras.lang.json" }, - -- { import = "lazyvim.plugins.extras.lang.yaml" }, - -- { import = "lazyvim.plugins.extras.lang.tailwind" }, - -- { import = "lazyvim.plugins.extras.lang.markdown" }, + -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- import/override with your plugins { import = "plugins" }, }, defaults = { @@ -25,8 +26,8 @@ require("lazy").setup({ -- have outdated releases, which may break your Neovim install. version = false, -- always use the latest git commit -- version = "*", -- try installing the latest stable version for plugins that support semver + -- colorscheme = "gruvbox", }, - -- install = { colorscheme = { "tokyonight", "habamax" } }, checker = { enabled = true }, -- automatically check for plugin updates performance = { rtp = { diff --git a/config/nvim/lua/config/options.lua b/config/nvim/lua/config/options.lua index 4531474..aa62023 100644 --- a/config/nvim/lua/config/options.lua +++ b/config/nvim/lua/config/options.lua @@ -1,7 +1,7 @@ -- Options are automatically loaded before lazy.nvim startup -- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua -- Add any additional options here - +-- LazyVim.terminal.setup("fish") local opt = vim.opt diff --git a/config/nvim/lua/plugins/example.lua b/config/nvim/lua/plugins/example.lua index de22bc8..8b7eabc 100644 --- a/config/nvim/lua/plugins/example.lua +++ b/config/nvim/lua/plugins/example.lua @@ -192,14 +192,6 @@ return { }, -- Use for completion and snippets (supertab) - -- first: disable default and behavior in LuaSnip - { - "L3MON4D3/LuaSnip", - keys = function() - return {} - end, - }, - -- then: setup supertab in cmp { "hrsh7th/nvim-cmp", dependencies = { @@ -213,17 +205,16 @@ return { return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end - local luasnip = require("luasnip") local cmp = require("cmp") opts.mapping = vim.tbl_extend("force", opts.mapping, { [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- this way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() + elseif vim.snippet.active({ direction = 1 }) then + vim.schedule(function() + vim.snippet.jump(1) + end) elseif has_words_before() then cmp.complete() else @@ -233,8 +224,10 @@ return { [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) + elseif vim.snippet.active({ direction = -1 }) then + vim.schedule(function() + vim.snippet.jump(-1) + end) else fallback() end diff --git a/config/nvim/lua/plugins/lazyvim.lua b/config/nvim/lua/plugins/lazyvim.lua index 7a0123f..54c54b1 100644 --- a/config/nvim/lua/plugins/lazyvim.lua +++ b/config/nvim/lua/plugins/lazyvim.lua @@ -2,12 +2,21 @@ return { -- add gruvbox { "ellisonleao/gruvbox.nvim" }, + -- Adding extras + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.markdown" }, + { import = "lazyvim.plugins.extras.lang.toml" }, + { import = "lazyvim.plugins.extras.lang.sql" }, + { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.vue" }, + { import = "lazyvim.plugins.extras.lang.yaml" }, + { import = "lazyvim.plugins.extras.lang.tailwind" }, + { import = "lazyvim.plugins.extras.lang.omnisharp" }, + { import = "lazyvim.plugins.extras.coding.mini-surround" }, + { import = "lazyvim.plugins.extras.util.mini-hipatterns" }, -- Configure LazyVim to load gruvbox { "LazyVim/LazyVim", - dependencies = { - "ellisonleao/gruvbox.nvim", - }, opts = { colorscheme = "gruvbox", }, diff --git a/config/nvim/lua/plugins/mason.lua b/config/nvim/lua/plugins/mason.lua deleted file mode 100644 index f1520e5..0000000 --- a/config/nvim/lua/plugins/mason.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - "bash-language-server", - "vue-language-server", - "dockerfile-language-server", - "typescript-language-server", - "html-lsp", - "marksman", - "csharp-language-server", - "sqls", - "json-lsp", - "phpactor" - }, - }, -} diff --git a/config/nvim/lua/plugins/nvim-lspconfig.lua b/config/nvim/lua/plugins/nvim-lspconfig.lua deleted file mode 100644 index 387387a..0000000 --- a/config/nvim/lua/plugins/nvim-lspconfig.lua +++ /dev/null @@ -1,38 +0,0 @@ -return {} --- return { --- "neovim/nvim-lspconfig", --- opts = { --- -- LSP Server Settings --- ---@type lspconfig.options --- servers = { --- lua_ls = { --- -- Use this to add any additional keymaps --- -- for specific lsp servers --- ---@type LazyKeysSpec[] --- -- keys = {}, --- settings = { --- Lua = { --- workspace = { --- checkThirdParty = false, --- }, --- codeLens = { --- enable = true, --- }, --- completion = { --- callSnippet = "Replace", --- }, --- }, --- }, --- }, --- -- tsserver = {}, --- biome = {}, --- volar = { --- settings = {}, --- }, --- pyright = {}, --- }, --- -- return true if you don't want this server to be setup with lspconfig --- ---@type table --- setup = {}, --- }, --- } diff --git a/config/nvim/lua/plugins/nvim-treesitter.lua b/config/nvim/lua/plugins/nvim-treesitter.lua index 903ae4d..67639ed 100644 --- a/config/nvim/lua/plugins/nvim-treesitter.lua +++ b/config/nvim/lua/plugins/nvim-treesitter.lua @@ -27,7 +27,7 @@ return { "scss", "dockerfile", "c_sharp", - "php" + "php", }, }, } diff --git a/config/nvim_old/lazyvim.json b/config/nvim_old/lazyvim.json index f03853f..b1aed37 100644 --- a/config/nvim_old/lazyvim.json +++ b/config/nvim_old/lazyvim.json @@ -3,7 +3,7 @@ ], "news": { - "NEWS.md": "3314" + "NEWS.md": "6077" }, - "version": 3 + "version": 6 } \ No newline at end of file diff --git a/config/nvim_old/lua/config/lazy.lua b/config/nvim_old/lua/config/lazy.lua index 891b190..ea9298a 100644 --- a/config/nvim_old/lua/config/lazy.lua +++ b/config/nvim_old/lua/config/lazy.lua @@ -1,5 +1,6 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then + +if not (vim.uv or vim.loop).fs_stat(lazypath) then -- bootstrap lazy.nvim -- stylua: ignore vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) @@ -8,13 +9,12 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup({ spec = { - -- add LazyVim and import its plugins { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import any extras modules here -- { import = "lazyvim.plugins.extras.lang.typescript" }, -- { import = "lazyvim.plugins.extras.lang.json" }, - -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, - -- import/override with your plugins + -- { import = "lazyvim.plugins.extras.lang.yaml" }, + -- { import = "lazyvim.plugins.extras.lang.tailwind" }, + -- { import = "lazyvim.plugins.extras.lang.markdown" }, { import = "plugins" }, }, defaults = { @@ -26,7 +26,7 @@ require("lazy").setup({ version = false, -- always use the latest git commit -- version = "*", -- try installing the latest stable version for plugins that support semver }, - install = { colorscheme = { "tokyonight", "habamax" } }, + -- install = { colorscheme = { "tokyonight", "habamax" } }, checker = { enabled = true }, -- automatically check for plugin updates performance = { rtp = { diff --git a/config/nvim_old/lua/config/options.lua b/config/nvim_old/lua/config/options.lua index 785c746..4531474 100644 --- a/config/nvim_old/lua/config/options.lua +++ b/config/nvim_old/lua/config/options.lua @@ -6,4 +6,5 @@ LazyVim.terminal.setup("fish") local opt = vim.opt -opt.mouse = "" +opt.mouse = "a" +opt.termguicolors = true diff --git a/config/nvim/lua/plugins/colorizer.lua b/config/nvim_old/lua/plugins/colorizer.lua similarity index 100% rename from config/nvim/lua/plugins/colorizer.lua rename to config/nvim_old/lua/plugins/colorizer.lua diff --git a/config/nvim_old/lua/plugins/colorscheme.lua b/config/nvim_old/lua/plugins/colorscheme.lua deleted file mode 100644 index f0c4fa3..0000000 --- a/config/nvim_old/lua/plugins/colorscheme.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - { - "ellisonleao/gruvbox.nvim", - }, - - { - "LazyVim/LazyVim", - opts = { - colorscheme = "gruvbox", - }, - }, -} diff --git a/config/nvim_old/lua/plugins/headlines.lua b/config/nvim_old/lua/plugins/headlines.lua deleted file mode 100644 index 19c360d..0000000 --- a/config/nvim_old/lua/plugins/headlines.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - "lukas-reineke/headlines.nvim", - opts = function() - local opts = {} - for _, ft in ipairs({ "markdown", "norg", "rmd", "org" }) do - opts[ft] = { - headline_highlights = {}, - -- disable bullets for now. See https://github.com/lukas-reineke/headlines.nvim/issues/66 - bullets = {}, - } - for i = 1, 6 do - local hl = "Headline" .. i - vim.api.nvim_set_hl(0, hl, { link = "Headline", default = true }) - table.insert(opts[ft].headline_highlights, hl) - end - end - return opts - end, - ft = { "markdown", "norg", "rmd", "org" }, - config = function(_, opts) - -- PERF: schedule to prevent headlines slowing down opening a file - vim.schedule(function() - require("headlines").setup(opts) - require("headlines").refresh() - end) - end, -} diff --git a/config/nvim_old/lua/plugins/lazyvim.lua b/config/nvim_old/lua/plugins/lazyvim.lua new file mode 100644 index 0000000..7a0123f --- /dev/null +++ b/config/nvim_old/lua/plugins/lazyvim.lua @@ -0,0 +1,15 @@ +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + dependencies = { + "ellisonleao/gruvbox.nvim", + }, + opts = { + colorscheme = "gruvbox", + }, + }, +} diff --git a/config/nvim_old/lua/plugins/markdown-preview.lua b/config/nvim_old/lua/plugins/markdown-preview.lua deleted file mode 100644 index cf037cd..0000000 --- a/config/nvim_old/lua/plugins/markdown-preview.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - build = function() - vim.fn["mkdp#util#install"]() - end, - keys = { - { - "cp", - ft = "markdown", - "MarkdownPreviewToggle", - desc = "Markdown Preview", - }, - }, - config = function() - vim.cmd([[do FileType]]) - end, -} diff --git a/config/nvim_old/lua/plugins/mason.lua b/config/nvim_old/lua/plugins/mason.lua index 8d4479c..f1520e5 100644 --- a/config/nvim_old/lua/plugins/mason.lua +++ b/config/nvim_old/lua/plugins/mason.lua @@ -1,16 +1,17 @@ return { - { - "williamboman/mason.nvim", - opts = function(_, opts) - vim.list_extend(opts.ensure_installed, { - "vue-language-server", - "biome", - "ast-grep", - "sqlls", - "marksman", - "markdownlint", - "js-debug-adapter", - }) - end, + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "bash-language-server", + "vue-language-server", + "dockerfile-language-server", + "typescript-language-server", + "html-lsp", + "marksman", + "csharp-language-server", + "sqls", + "json-lsp", + "phpactor" + }, }, } diff --git a/config/nvim_old/lua/plugins/neo-tree.lua b/config/nvim_old/lua/plugins/neo-tree.lua index 251353f..d33a9bd 100644 --- a/config/nvim_old/lua/plugins/neo-tree.lua +++ b/config/nvim_old/lua/plugins/neo-tree.lua @@ -1,50 +1,5 @@ return { "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - cmd = "Neotree", - keys = { - { - "fe", - function() - require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() }) - end, - desc = "Explorer NeoTree (Root Dir)", - }, - { - "fE", - function() - require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) - end, - desc = "Explorer NeoTree (cwd)", - }, - { "e", "fe", desc = "Explorer NeoTree (Root Dir)", remap = true }, - { "E", "fE", desc = "Explorer NeoTree (cwd)", remap = true }, - { - "ge", - function() - require("neo-tree.command").execute({ source = "git_status", toggle = true }) - end, - desc = "Git Explorer", - }, - { - "be", - function() - require("neo-tree.command").execute({ source = "buffers", toggle = true }) - end, - desc = "Buffer Explorer", - }, - }, - deactivate = function() - vim.cmd([[Neotree close]]) - end, - init = function() - if vim.fn.argc(-1) == 1 then - local stat = vim.uv.fs_stat(vim.fn.argv(0)) - if stat and stat.type == "directory" then - require("neo-tree") - end - end - end, opts = { sources = { "filesystem", "buffers", "git_status", "document_symbols" }, open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, @@ -58,53 +13,5 @@ return { hide_gitignored = true, }, }, - window = { - mappings = { - [""] = "none", - ["Y"] = { - function(state) - local node = state.tree:get_node() - local path = node:get_id() - vim.fn.setreg("+", path, "c") - end, - desc = "Copy Path to Clipboard", - }, - ["O"] = { - function(state) - require("lazy.util").open(state.tree:get_node().path, { system = true }) - end, - desc = "Open with System Application", - }, - }, - }, - default_component_configs = { - indent = { - with_expanders = true, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - }, }, - config = function(_, opts) - local function on_move(data) - LazyVim.lsp.on_rename(data.source, data.destination) - end - - local events = require("neo-tree.events") - opts.event_handlers = opts.event_handlers or {} - vim.list_extend(opts.event_handlers, { - { event = events.FILE_MOVED, handler = on_move }, - { event = events.FILE_RENAMED, handler = on_move }, - }) - require("neo-tree").setup(opts) - vim.api.nvim_create_autocmd("TermClose", { - pattern = "*lazygit", - callback = function() - if package.loaded["neo-tree.sources.git_status"] then - require("neo-tree.sources.git_status").refresh() - end - end, - }) - end, } diff --git a/config/nvim_old/lua/plugins/nvim-lspconfig.lua b/config/nvim_old/lua/plugins/nvim-lspconfig.lua index 03f85a3..387387a 100644 --- a/config/nvim_old/lua/plugins/nvim-lspconfig.lua +++ b/config/nvim_old/lua/plugins/nvim-lspconfig.lua @@ -1,48 +1,38 @@ -return { - "neovim/nvim-lspconfig", - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - pyright = {}, - marksman = {}, - --@type lspconfig.options.tsserver - tsserver = { - keys = { - { - "co", - function() - vim.lsp.buf.code_action({ - apply = true, - context = { - only = { "source.organizeImports.ts" }, - diagnostics = {}, - }, - }) - end, - desc = "Organize Imports", - }, - { - "cR", - function() - vim.lsp.buf.code_action({ - apply = true, - context = { - only = { "source.removeUnused.ts" }, - diagnostics = {}, - }, - }) - end, - desc = "Remove Unused Imports", - }, - }, - ---@diagnostic disable-next-line: missing-fields - settings = { - completions = { - completeFunctionCalls = true, - }, - }, - }, - }, - }, -} +return {} +-- return { +-- "neovim/nvim-lspconfig", +-- opts = { +-- -- LSP Server Settings +-- ---@type lspconfig.options +-- servers = { +-- lua_ls = { +-- -- Use this to add any additional keymaps +-- -- for specific lsp servers +-- ---@type LazyKeysSpec[] +-- -- keys = {}, +-- settings = { +-- Lua = { +-- workspace = { +-- checkThirdParty = false, +-- }, +-- codeLens = { +-- enable = true, +-- }, +-- completion = { +-- callSnippet = "Replace", +-- }, +-- }, +-- }, +-- }, +-- -- tsserver = {}, +-- biome = {}, +-- volar = { +-- settings = {}, +-- }, +-- pyright = {}, +-- }, +-- -- return true if you don't want this server to be setup with lspconfig +-- ---@type table +-- setup = {}, +-- }, +-- } diff --git a/config/nvim_old/lua/plugins/nvim-treesitter.lua b/config/nvim_old/lua/plugins/nvim-treesitter.lua index 05824e7..903ae4d 100644 --- a/config/nvim_old/lua/plugins/nvim-treesitter.lua +++ b/config/nvim_old/lua/plugins/nvim-treesitter.lua @@ -23,6 +23,11 @@ return { "vue", "xml", "csv", + "css", + "scss", + "dockerfile", + "c_sharp", + "php" }, }, } diff --git a/config/nvim_old/lua/plugins/telescope-fzf-native.lua b/config/nvim_old/lua/plugins/telescope-fzf-native.lua new file mode 100644 index 0000000..1233af5 --- /dev/null +++ b/config/nvim_old/lua/plugins/telescope-fzf-native.lua @@ -0,0 +1,13 @@ +return { + "telescope.nvim", + dependencies = { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + config = function() + require("telescope").load_extension("fzf") + end, + cond = function() + return vim.fn.executable("make") == 1 + end, + }, +}