623 current 2024-05-14 21:33:31 24.05.20240512.2057814 6.8.6-zen1 *

This commit is contained in:
zackartz 2024-05-14 21:33:36 -04:00
parent 82b00d37b9
commit 4bc4f44f74
No known key found for this signature in database
GPG key ID: 5B53E53A9A514DBA
3 changed files with 34 additions and 3 deletions

View file

@ -1,7 +1,9 @@
local map = require("utils.mappings") local map = require("utils.mappings")
local f = require("utils.functions") local f = require("utils.functions")
local fmt = require("utils.icons").fmt local fmt = require("utils.icons").fmt
local fn = require("utils.functions")
local l, cmd, rcmd, lua = map.leader, map.cmd, map.rcmd, map.lua local l, cmd, rcmd, lua = map.leader, map.cmd, map.rcmd, map.lua
local freeze, freeze_selection = fn.freeze, fn.freeze_selection
return { return {
i = { i = {
@ -41,7 +43,7 @@ return {
[l("ct")] = { cmd("CloakToggle"), "Cloak Toggle" }, [l("ct")] = { cmd("CloakToggle"), "Cloak Toggle" },
-- Freeze -- Freeze
[l("sc")] = { cmd("Freeze"), "Take code screenshot" }, [l("sc")] = { freeze(), "Take code screenshot" },
-- Rest -- Rest
[l("rr")] = { cmd("Rest run"), "Run request in Rest" }, [l("rr")] = { cmd("Rest run"), "Run request in Rest" },
@ -261,7 +263,7 @@ return {
[l(";")] = { f.comment_selection, fmt("Comment", "Comment selection") }, [l(";")] = { f.comment_selection, fmt("Comment", "Comment selection") },
-- Freeze -- Freeze
[l("sc")] = { cmd("'<,'>Freeze"), "Take code screenshot" }, [l("sc")] = { freeze_selection(), "Take code screenshot" },
-- gitsigns -- gitsigns
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") }, [l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },

View file

@ -4,7 +4,7 @@ return {
require("charm-freeze").setup({ require("charm-freeze").setup({
command = "freeze", command = "freeze",
output = function() output = function()
return "./" .. os.date("%Y-%m-%d") .. "_freeze.png" return "./" .. "._freeze.png"
end, end,
show_line_numbers = true, show_line_numbers = true,
theme = "catppuccin-mocha", theme = "catppuccin-mocha",

View file

@ -17,6 +17,35 @@ local select = function(prompt, callback)
end) end)
end end
M.freeze = function()
local path = "./._freeze.png"
-- Execute the 'Freeze' command on the selected range
vim.cmd("Freeze")
-- Run the shell command 'wl-copy <path>' after 'Freeze' completes
vim.fn.system("wl-copy < " .. path)
vim.fn.system("rm " .. path)
end
M.freeze_selection = function()
local path = "./._freeze.png"
-- Save and exit visual mode
vim.cmd("normal! gv")
-- Get the positions of the start and end of the visual selection
local start_line = vim.fn.getpos("'<")[2] -- line number of the start of selection
local end_line = vim.fn.getpos("'>")[2] -- line number of the end of selection
-- Execute the 'Freeze' command on the selected range
vim.cmd(start_line .. "," .. end_line .. "Freeze")
-- Run the shell command 'wl-copy <path>' after 'Freeze' completes
vim.fn.system("wl-copy < " .. path)
vim.fn.system("rm " .. path)
end
M.set_filetype = function() M.set_filetype = function()
input("Set filetype: ", function(value) input("Set filetype: ", function(value)
vim.bo[0].filetype = value vim.bo[0].filetype = value