Something went wrong. Try again.
Vim/Neovim configurations just for me
neovim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127require("rc.mise").set_env()
local deck = require("deck")
require("deck.easy").setup()
local ignore_globs = { "**/.git/**" }
deck.register_start_preset("files", function() deck.start({ require("deck.builtin.source.files")({ root_dir = assert(vim.uv.cwd()), ignore_globs = ignore_globs, }), })end)
-- local home = vim.uv.os_homedir()---- deck.register_start_preset("mrw", function()-- deck.start({-- name = "mrw",-- execute = function(cx)-- local cwd = vim.uv.cwd()-- for _, v in ipairs(vim.fn["mr#mrw#list"]()) do-- local text = v ---@type string-- if cwd and text:sub(1, #cwd) == cwd then-- text = text:sub(#cwd + 2)-- elseif home and text:sub(1, #home) == home then-- text = "~" .. text:sub(#home + 1)-- end-- cx.item({-- display_text = text,-- data = {-- filename = v,-- },-- })-- end-- cx.done()-- end,-- actions = {-- deck.alias_action("default", "open"),-- },-- })-- end)
vim.api.nvim_create_autocmd("User", { pattern = "DeckShow", callback = function() vim.wo.cursorline = true vim.o.signcolumn = "yes:1" vim.o.statuscolumn = "%=%s" if vim.o.cmdheight == 0 then vim.o.cmdheight = 1 vim.api.nvim_create_autocmd("User", { once = true, pattern = "DeckHide", callback = function() vim.o.cmdheight = 0 end, }) end end,})
vim.api.nvim_create_autocmd("User", { pattern = "DeckStart", callback = function(e) local cx = e.data.ctx
cx.keymap("n", "o", deck.action_mapping("choose_action")) cx.keymap("n", "i", deck.action_mapping("prompt")) cx.keymap("n", "a", deck.action_mapping("prompt")) cx.keymap({ "c", "n" }, "<C-r>", deck.action_mapping("refresh")) cx.keymap({ "c", "n" }, "<C-p>", deck.action_mapping("toggle_preview_mode")) cx.keymap({ "c", "n" }, "<Tab>", deck.action_mapping("toggle_select")) cx.keymap({ "c", "n" }, "<C-a>", deck.action_mapping("toggle_select_all")) cx.keymap({ "c", "n" }, "<C-d>", deck.action_mapping("scroll_preview_down")) cx.keymap({ "c", "n" }, "<C-u>", deck.action_mapping("scroll_preview_up")) cx.keymap("c", "<C-j>", function() cx.set_cursor(cx.get_cursor() + 1) end) cx.keymap("c", "<C-k>", function() cx.set_cursor(cx.get_cursor() - 1) end)
cx.keymap("n", "<CR>", deck.action_mapping("default")) cx.keymap("c", "<CR>", function() vim.api.nvim_feedkeys(vim.keycode("<Esc>"), "n", true) -- vim.schedule(function() -- cx.do_action("default") -- end) end)
cx.keymap("n", "<Esc>", cx.hide) cx.keymap("n", "<C-c>", cx.hide) cx.keymap("c", "<C-c>", function() vim.api.nvim_feedkeys(vim.keycode("<Esc>"), "n", true) vim.schedule(cx.hide) end)
-- cx.prompt() end,})
vim.api.nvim_create_autocmd("User", { pattern = "DeckStart:explorer", callback = function(e) local cx = e.data.ctx cx.keymap("n", "<Esc>", cx.hide) cx.keymap("n", "<C-c>", cx.hide) cx.keymap("n", "-", deck.action_mapping("explorer.cd_up")) cx.keymap("n", "h", deck.action_mapping("explorer.collapse")) cx.keymap("n", "l", deck.action_mapping("explorer.expand")) cx.keymap("n", ".", deck.action_mapping("explorer.toggle_dotfiles")) cx.keymap("n", "c", deck.action_mapping("explorer.clipboard.save_copy")) cx.keymap("n", "m", deck.action_mapping("explorer.clipboard.save_move")) cx.keymap("n", "p", deck.action_mapping("explorer.clipboard.paste")) cx.keymap("n", "~", function() cx.do_action("explorer.get_api").set_cwd(vim.fs.normalize("~")) end) cx.keymap("n", "\\", function() cx.do_action("explorer.get_api").set_cwd(vim.fs.normalize("/")) end) end,})