1
0
Fork 0
znvim/lua/znvim/plugins/init.lua
2024-12-15 21:26:46 +01:00

161 lines
6 KiB
Lua

return {
{ -- display undo tree for a file
"https://github.com/mbbill/undotree",
cmd = "UndotreeToggle",
keys = {
{ "<leader>ut", "<cmd>UndotreeToggle<cr>", desc = "undo tree" },
},
},
{ -- markview.nvim
"https://github.com/OXY2DEV/markview.nvim",
ft = 'markdown',
keys = {
{ -- toggle markview rendering
"<localleader>t",
"<cmd>Markview toggle<cr>",
desc = "Toggle markdown rendering",
ft = "markdown"
},
},
opts = {
modes = { "n", "i", "no", "c" },
hybrid_modes = { "i" },
callbacks = {
on_enable = function (_, win)
vim.wo[win].conceallevel = 2;
vim.wo[win].concealcursor = "nc";
end
}
},
},
{ -- repl integration
"https://github.com/Vigemus/iron.nvim",
keys = {
{ "<leader>rs", "<cmd>IronRepl<cr>", desc = "Show/start REPL" },
{ "<leader>rh", "<cmd>IronHide<cr>", desc = "Hide REPL" },
{ "<leader>rf", "<cmd>IronFocus<cr>", desc = "Focus REPL" },
{ "<leader>rr", "<cmd>IronRestart<cr>", desc = "Restart REPL" },
{ "<leader>rq", function() require("iron").core.close_repl(vim.bo.filetype) end, desc = "Quit REPL" },
},
opts = {
config = {
-- Whether a repl should be discarded or not
scratch_repl = true,
-- Your repl definitions come here
repl_definition = {
sh = {
-- Can be a table or a function that
-- returns a table (see below)
command = {"zsh"}
},
julia = {
command = {"julia", "--project"},
},
},
repl_open_cmd = "vertical botright 80 split", -- require("iron").view.split.vertical.botright(100),
},
-- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core
keymaps = {
send_motion = "<leader>ss",
visual_send = "<leader>ss",
send_file = "<space>sf",
send_line = "<space>sl",
send_until_cursor = "<space>su",
-- send_mark = "<space>sm",
mark_motion = "<space>mc",
mark_visual = "<space>mc",
remove_mark = "<space>md",
cr = "<space>s<cr>",
interrupt = "<space>s<space>",
clear = "<space>cl",
},
-- If the highlight is on, you can change how it looks
-- For the available options, check nvim_set_hl
highlight = {
italic = false,
},
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
},
config = function (_, opts)
local iron = require("iron.core")
iron.setup(opts)
IronSendCell = function(next_cell)
-- source: https://github.com/Vigemus/iron.nvim/issues/236#issuecomment-1317674256
local iron_core = require('iron.core')
local marks = require('iron.marks')
local cell_pattern = "^\\s*##" -- cell delimiter pattern
local cell_start = vim.fn.search(cell_pattern, 'bcnW')
local cell_end = vim.fn.search(cell_pattern, 'nW')
local lines = vim.api.nvim_buf_get_lines(0, cell_start, cell_end-1, 0)
-- ignore blank lines
local b_lines = {}
for _, line in ipairs(lines) do
if line:gsub("^%s*(.-)%s*$", "%1") ~= '' then
table.insert(b_lines, line)
end
end
if #b_lines == 0 then return end
if cell_start == 0 then
cell_start = 1 -- if first cell, then start from first line
end
if cell_end == 0 then
cell_end = vim.fn.line('$') -- set to last line
end
marks.set{ from_line=cell_start, from_col=0, to_line=cell_end, to_col=-1 }
marks.winrestview()
iron_core.send(nil, b_lines)
if next_cell == true then
vim.fn.cursor(cell_end+1, 0) -- move to next cell start
end
end
vim.keymap.set('n', '<space>sc', function () IronSendCell(false) end)
vim.keymap.set('n', '<space>sC', function () IronSendCell(true) end)
vim.cmd("nmap <leader>sp <leader>ssap")
end
},
{ -- neodev
"https://github.com/folke/lazydev.nvim",
ft = "lua",
},
{ -- A better user experience for interacting with and manipulating marks
"https://github.com/chentoast/marks.nvim",
event = "BufReadPost",
config = true,
},
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
opts = {
bigfile = { enabled = true },
-- notifier = { enabled = true },
quickfile = { enabled = true },
words = { enabled = true },
dashboard = {
sections = {
{
section = "terminal",
cmd = "chafa ~/i/piksela_arto/docks_1041uuu_Toyoi_Yuuta.gif --format symbols --symbols vhalf --size 60x17 --stretch; sleep .1",
height = 17,
padding = 1,
},
{
pane = 2,
{ section = "keys", gap = 1, padding = 1 },
{ section = "startup" },
},
},
},
},
},
}