623 current 2024-05-14 21:33:31 24.05.20240512.2057814 6.8.6-zen1 *
This commit is contained in:
parent
82b00d37b9
commit
4bc4f44f74
3 changed files with 34 additions and 3 deletions
|
|
@ -1,7 +1,9 @@
|
|||
local map = require("utils.mappings")
|
||||
local f = require("utils.functions")
|
||||
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 freeze, freeze_selection = fn.freeze, fn.freeze_selection
|
||||
|
||||
return {
|
||||
i = {
|
||||
|
|
@ -41,7 +43,7 @@ return {
|
|||
[l("ct")] = { cmd("CloakToggle"), "Cloak Toggle" },
|
||||
|
||||
-- Freeze
|
||||
[l("sc")] = { cmd("Freeze"), "Take code screenshot" },
|
||||
[l("sc")] = { freeze(), "Take code screenshot" },
|
||||
|
||||
-- Rest
|
||||
[l("rr")] = { cmd("Rest run"), "Run request in Rest" },
|
||||
|
|
@ -261,7 +263,7 @@ return {
|
|||
[l(";")] = { f.comment_selection, fmt("Comment", "Comment selection") },
|
||||
|
||||
-- Freeze
|
||||
[l("sc")] = { cmd("'<,'>Freeze"), "Take code screenshot" },
|
||||
[l("sc")] = { freeze_selection(), "Take code screenshot" },
|
||||
|
||||
-- gitsigns
|
||||
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ return {
|
|||
require("charm-freeze").setup({
|
||||
command = "freeze",
|
||||
output = function()
|
||||
return "./" .. os.date("%Y-%m-%d") .. "_freeze.png"
|
||||
return "./" .. "._freeze.png"
|
||||
end,
|
||||
show_line_numbers = true,
|
||||
theme = "catppuccin-mocha",
|
||||
|
|
|
|||
|
|
@ -17,6 +17,35 @@ local select = function(prompt, callback)
|
|||
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()
|
||||
input("Set filetype: ", function(value)
|
||||
vim.bo[0].filetype = value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue