codesnap.nvim/plugin/codesnap.lua

30 lines
704 B
Lua
Raw Normal View History

2024-02-13 06:20:51 +00:00
local codesnap = require("codesnap")
2024-02-19 14:27:17 +00:00
local static = require("codesnap.static")
local client = require("codesnap.client")
2024-02-13 06:05:36 +00:00
2024-02-19 14:27:17 +00:00
-- snap code
vim.api.nvim_create_user_command("CodeSnap", function() end, {})
vim.api.nvim_create_user_command("CodeSnapPreviewOn", function() end, {})
vim.api.nvim_create_user_command("CodeSnapPreviewOff", function() end, {})
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
callback = function()
local mode = vim.api.nvim_get_mode().mode
if mode ~= "v" or not static.preview_switch then
return
end
codesnap.preview_code()
end,
})
vim.api.nvim_create_autocmd({ "VimLeavePre" }, {
pattern = "*",
callback = function()
client:stop()
end,
})