[vim] lir Return binding

This commit is contained in:
Barak Michener 2024-03-27 16:11:08 -07:00
parent 02090ad839
commit b92370a8c0
2 changed files with 71 additions and 69 deletions

View file

@ -21,6 +21,7 @@
undo-last = reset HEAD^ undo-last = reset HEAD^
unstage = restore --staged unstage = restore --staged
latest = branch --sort=committerdate latest = branch --sort=committerdate
f = fetch origin main
[diff] [diff]
renamelimit = 0 renamelimit = 0

View file

@ -3,85 +3,86 @@ local mark_actions = require 'lir.mark.actions'
local clipboard_actions = require 'lir.clipboard.actions' local clipboard_actions = require 'lir.clipboard.actions'
require 'lir'.setup { require 'lir'.setup {
show_hidden_files = false, show_hidden_files = false,
ignore = { ".DS_Store" }, -- { ".DS_Store", "node_modules" } etc. ignore = { ".DS_Store" }, -- { ".DS_Store", "node_modules" } etc.
devicons = { devicons = {
enable = true, enable = true,
highlight_dirname = true highlight_dirname = true
}, },
mappings = { mappings = {
['l'] = actions.edit, ['l'] = actions.edit,
['<C-s>'] = actions.split, ['<CR>'] = actions.edit,
['<C-v>'] = actions.vsplit, ['<C-s>'] = actions.split,
['<C-t>'] = actions.tabedit, ['<C-v>'] = actions.vsplit,
['<C-t>'] = actions.tabedit,
['h'] = actions.up, ['h'] = actions.up,
['q'] = actions.quit, ['q'] = actions.quit,
['K'] = actions.mkdir, ['K'] = actions.mkdir,
['N'] = actions.newfile, ['N'] = actions.newfile,
['R'] = actions.rename, ['R'] = actions.rename,
['@'] = actions.cd, ['@'] = actions.cd,
['Y'] = actions.yank_path, ['Y'] = actions.yank_path,
['.'] = actions.toggle_show_hidden, ['.'] = actions.toggle_show_hidden,
['D'] = actions.delete, ['D'] = actions.delete,
['J'] = function() ['J'] = function()
mark_actions.toggle_mark() mark_actions.toggle_mark()
vim.cmd('normal! j') vim.cmd('normal! j')
end, end,
['C'] = clipboard_actions.copy, ['C'] = clipboard_actions.copy,
['X'] = clipboard_actions.cut, ['X'] = clipboard_actions.cut,
['P'] = clipboard_actions.paste, ['P'] = clipboard_actions.paste,
}, },
float = { float = {
winblend = 0, winblend = 0,
curdir_window = { curdir_window = {
enable = false, enable = false,
highlight_dirname = false highlight_dirname = false
}, },
-- -- You can define a function that returns a table to be passed as the third -- -- You can define a function that returns a table to be passed as the third
-- -- argument of nvim_open_win(). -- -- argument of nvim_open_win().
-- win_opts = function() -- win_opts = function()
-- local width = math.floor(vim.o.columns * 0.8) -- local width = math.floor(vim.o.columns * 0.8)
-- local height = math.floor(vim.o.lines * 0.8) -- local height = math.floor(vim.o.lines * 0.8)
-- return { -- return {
-- border = { -- border = {
-- "+", "─", "+", "│", "+", "─", "+", "│", -- "+", "─", "+", "│", "+", "─", "+", "│",
-- }, -- },
-- width = width, -- width = width,
-- height = height, -- height = height,
-- row = 1, -- row = 1,
-- col = math.floor((vim.o.columns - width) / 2), -- col = math.floor((vim.o.columns - width) / 2),
-- } -- }
-- end, -- end,
}, },
hide_cursor = true hide_cursor = true
} }
vim.api.nvim_create_autocmd({ 'FileType' }, { vim.api.nvim_create_autocmd({ 'FileType' }, {
pattern = { "lir" }, pattern = { "lir" },
callback = function() callback = function()
-- use visual mode -- use visual mode
vim.api.nvim_buf_set_keymap( vim.api.nvim_buf_set_keymap(
0, 0,
"x", "x",
"J", "J",
':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>', ':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
{ noremap = true, silent = true } { noremap = true, silent = true }
) )
-- echo cwd -- echo cwd
-- vim.api.nvim_echo({ { vim.fn.expand("%:p"), "Normal" } }, false, {}) -- vim.api.nvim_echo({ { vim.fn.expand("%:p"), "Normal" } }, false, {})
end end
}) })
-- custom folder icon -- custom folder icon
require 'nvim-web-devicons'.set_icon({ require 'nvim-web-devicons'.set_icon({
lir_folder_icon = { lir_folder_icon = {
icon = "", icon = "",
color = "#7ebae4", color = "#7ebae4",
name = "LirFolderNode" name = "LirFolderNode"
} }
}) })