1
0
Fork 0
This commit is contained in:
zymon 2025-03-16 20:21:16 +01:00
parent ce4c38469e
commit aa4eadeb61
4 changed files with 85 additions and 65 deletions

View file

@ -2,21 +2,6 @@ vim.keymap.set("i", "jk", "<ESC>")
vim.keymap.set("n", "<leader>pl", "<cmd>Lazy<cr>", { desc = "Lazy" })
vim.keymap.set("n", "<leader>uc", function ()
if #vim.o.colorcolumn == 0 then
vim.o.colorcolumn = "80"
else
vim.o.colorcolumn = ""
end
end, { desc = "toggle 80th column" })
vim.keymap.set("n", "<leader>ur", function ()
if vim.o.relativenumber then
vim.o.relativenumber = false
else
vim.o.relativenumber = true
end
end, { desc = "toggle relative numbers" })
vim.keymap.set("n", "<C-A-k>", "<cmd>m .-2<cr>==", { desc = "move up" })
vim.keymap.set("n", "<C-A-j>", "<cmd>m .+1<cr>==", { desc = "move line down" })

View file

@ -34,7 +34,7 @@ return {
map("n", "<leader>gB", function() gitsigns.blame_line({ full = true }) end, "full blame!")
map("n", "<leader>gp", gitsigns.preview_hunk, "look at hunk")
map("n", "<leader>gS", ":Gitsigns select_hunk<CR>", "select hunk")
map("n", "<leader>gdd", gitsigns.diffthis, "diff this")
-- map("n", "<leader>gdd", gitsigns.diffthis, "diff this")
map("n", "<leader>gsb", gitsigns.stage_buffer, "stage buffer")
map("n", "<leader>gsh", ":Gitsigns stage_hunk<CR>", "stage hunk (toggle)")
@ -63,6 +63,8 @@ return {
event = "BufReadPre",
keys = {
{ "<leader>gdo", "<CMD>DiffviewOpen<CR>", desc = "open diffview", },
{ "<leader>gdf", "<CMD>DiffviewFileHistory<CR>", desc = "open diffview", },
{ "<leader>gdF", "<CMD>DiffviewFileHistory %<CR>", desc = "open file", },
{ "<leader>gdc", "<CMD>DiffviewClose<CR>", desc = "close diffview", },
}
},

View file

@ -4,7 +4,7 @@ return {
"https://github.com/mbbill/undotree",
cmd = "UndotreeToggle",
keys = {
{ "<leader>ut", "<cmd>UndotreeToggle<cr>", desc = "undo tree" },
{ "<leader>ut", "<cmd>UndotreeToggle<cr>", desc = "undo tree" },
},
},
@ -23,7 +23,7 @@ return {
modes = { "n", "i", "no", "c" },
hybrid_modes = { "i" },
callbacks = {
on_enable = function (_, win)
on_enable = function(_, win)
vim.wo[win].conceallevel = 2;
vim.wo[win].concealcursor = "nc";
end
@ -48,10 +48,10 @@ return {
sh = {
-- Can be a table or a function that
-- returns a table (see below)
command = {"zsh"}
command = { "zsh" }
},
julia = {
command = {"julia", "--project"},
command = { "julia", "--project" },
},
},
repl_open_cmd = "vertical botright 80 split", -- require("iron").view.split.vertical.botright(100),
@ -79,7 +79,7 @@ return {
},
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
},
config = function (_, opts)
config = function(_, opts)
local iron = require("iron.core")
iron.setup(opts)
@ -88,11 +88,11 @@ return {
local iron_core = require('iron.core')
local marks = require('iron.marks')
local cell_pattern = "^\\s*##" -- cell delimiter pattern
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)
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
@ -109,17 +109,17 @@ return {
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.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
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.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
},
@ -137,9 +137,9 @@ return {
priority = 1000,
lazy = false,
keys = {
{ "<leader>pp", function () require("snacks").picker() end, desc = "pick picker", },
{ "<leader>pg", function () require("snacks").picker.grep() end, desc = "pick string", },
{ "<leader>pf", function () require("snacks").picker.files() end, desc = "pick files", },
{ "<leader>pp", function() require("snacks").picker() end, desc = "pick picker", },
{ "<leader>pg", function() require("snacks").picker.grep() end, desc = "pick string", },
{ "<leader>pf", function() require("snacks").picker.files() end, desc = "pick files", },
{
"<leader>gl",
function()
@ -205,6 +205,8 @@ return {
end,
desc = "[P]Snacks picker buffers",
},
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
{ "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
},
opts = {
picker = {
@ -240,23 +242,78 @@ return {
notify = { enabled = true },
quickfile = { enabled = true },
words = { enabled = true },
toggle = { enabled = true },
indent = { 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",
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 = "keys", gap = 1, padding = 1 },
{ section = "startup" },
},
},
},
zen = { enabled = true },
},
init = function()
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
callback = function()
Snacks = require("snacks")
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
Snacks.toggle.diagnostics():map("<leader>ud")
Snacks.toggle.line_number():map("<leader>ul")
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
Snacks.toggle.option("conceallevel",
{ off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc")
Snacks.toggle.treesitter():map("<leader>uT")
Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map(
"<leader>ub")
Snacks.toggle.inlay_hints():map("<leader>uh")
Snacks.toggle.indent():map("<leader>ug")
Snacks.toggle.dim():map("<leader>uD")
local toggleopt = {
name = "80th column",
keys = "<leader>uc",
which_key = true,
get = function()
return vim.o.colorcolumn == "80"
end,
notify = false,
set = function(state)
if state then
vim.o.colorcolumn = "80"
else
vim.o.colorcolumn = ""
end
end,
}
require("snacks.toggle").new(toggleopt):map(toggleopt.keys, { mode = { "n" } })
require("snacks").toggle({
name = "Diffview",
get = function()
return require("diffview.lib").get_current_view() ~= nil
end,
set = function(state)
vim.cmd("Diffview" .. (state and "Open" or "Close"))
end,
}):map("<leader>gdd")
end,
})
end
},
{
@ -306,11 +363,11 @@ return {
ft = "typst",
version = "1.*",
keys = {
{ "<localleader>pd", "<CMD>TypstPreview document<CR>", desc = "open typst preview document", },
{ "<localleader>ps", "<CMD>TypstPreview slide<CR>", desc = "open typst preview slide", },
{ "<localleader>s", "<CMD>TypstPreviewStop<CR>", desc = "stop typst preview", },
{ "<localleader><SPACE>", "<CMD>TypstPreviewSyncCursor<CR>", desc = "sync cursor", },
{ "<localleader>f", "<CMD>TypstPreviewFollowCursorToggle<CR>", desc = "toggle follow cursor", },
{ "<localleader>pd", "<CMD>TypstPreview document<CR>", desc = "open typst preview document", },
{ "<localleader>ps", "<CMD>TypstPreview slide<CR>", desc = "open typst preview slide", },
{ "<localleader>s", "<CMD>TypstPreviewStop<CR>", desc = "stop typst preview", },
{ "<localleader><SPACE>", "<CMD>TypstPreviewSyncCursor<CR>", desc = "sync cursor", },
{ "<localleader>f", "<CMD>TypstPreviewFollowCursorToggle<CR>", desc = "toggle follow cursor", },
},
opts = {
dependencies_bin = {
@ -321,12 +378,12 @@ return {
{
"https://github.com/hat0uma/csvview.nvim",
ft = {"csv", "tsv"},
ft = { "csv", "tsv" },
opts = {},
keys = {
{ "<localleader>e", "<CMD>CsvViewEnable<CR>", desc = "enable csv preview", },
{ "<localleader>d", "<CMD>CsvViewDisable<CR>", desc = "disable csv preview", },
{ "<localleader>t", "<CMD>CsvViewToggle<CR>", desc = "toggle csv preview", },
{ "<localleader>e", "<CMD>CsvViewEnable<CR>", desc = "enable csv preview", },
{ "<localleader>d", "<CMD>CsvViewDisable<CR>", desc = "disable csv preview", },
{ "<localleader>t", "<CMD>CsvViewToggle<CR>", desc = "toggle csv preview", },
},
},

View file

@ -1,28 +1,4 @@
return {
{ -- notification popups
"https://github.com/rcarriga/nvim-notify",
keys = {
{
"<leader>un",
function()
require("notify").dismiss({ silent = true, pending = true })
end,
desc = "clear notifications",
},
},
opts = {
stages = "fade_in_slide_out",
render = "compact",
background_colour = "#000000",
timeout = 3000,
max_height = function()
return math.floor(vim.o.lines * 0.75)
end,
max_width = function()
return math.floor(vim.o.columns * 0.75)
end,
},
},
{ -- a snazzy bufferline
"https://github.com/akinsho/bufferline.nvim",
event = "BufReadPre",