From b92370a8c09c6c141dd1ec79a64142d2df039886 Mon Sep 17 00:00:00 2001 From: Barak Michener Date: Wed, 27 Mar 2024 16:11:08 -0700 Subject: [PATCH] [vim] lir Return binding --- .gitconfig | 1 + .vim/lua/lir_setup.lua | 139 +++++++++++++++++++++++++------------------------ 2 files changed, 71 insertions(+), 69 deletions(-) diff --git a/.gitconfig b/.gitconfig index 4336734..5c45626 100644 --- a/.gitconfig +++ b/.gitconfig @@ -21,6 +21,7 @@ undo-last = reset HEAD^ unstage = restore --staged latest = branch --sort=committerdate + f = fetch origin main [diff] renamelimit = 0 diff --git a/.vim/lua/lir_setup.lua b/.vim/lua/lir_setup.lua index c1728bc..e559e37 100644 --- a/.vim/lua/lir_setup.lua +++ b/.vim/lua/lir_setup.lua @@ -3,85 +3,86 @@ local mark_actions = require 'lir.mark.actions' local clipboard_actions = require 'lir.clipboard.actions' require 'lir'.setup { - show_hidden_files = false, - ignore = { ".DS_Store" }, -- { ".DS_Store", "node_modules" } etc. - devicons = { - enable = true, - highlight_dirname = true - }, - mappings = { - ['l'] = actions.edit, - [''] = actions.split, - [''] = actions.vsplit, - [''] = actions.tabedit, + show_hidden_files = false, + ignore = { ".DS_Store" }, -- { ".DS_Store", "node_modules" } etc. + devicons = { + enable = true, + highlight_dirname = true + }, + mappings = { + ['l'] = actions.edit, + [''] = actions.edit, + [''] = actions.split, + [''] = actions.vsplit, + [''] = actions.tabedit, - ['h'] = actions.up, - ['q'] = actions.quit, + ['h'] = actions.up, + ['q'] = actions.quit, - ['K'] = actions.mkdir, - ['N'] = actions.newfile, - ['R'] = actions.rename, - ['@'] = actions.cd, - ['Y'] = actions.yank_path, - ['.'] = actions.toggle_show_hidden, - ['D'] = actions.delete, + ['K'] = actions.mkdir, + ['N'] = actions.newfile, + ['R'] = actions.rename, + ['@'] = actions.cd, + ['Y'] = actions.yank_path, + ['.'] = actions.toggle_show_hidden, + ['D'] = actions.delete, - ['J'] = function() - mark_actions.toggle_mark() - vim.cmd('normal! j') - end, - ['C'] = clipboard_actions.copy, - ['X'] = clipboard_actions.cut, - ['P'] = clipboard_actions.paste, - }, - float = { - winblend = 0, - curdir_window = { - enable = false, - highlight_dirname = false - }, + ['J'] = function() + mark_actions.toggle_mark() + vim.cmd('normal! j') + end, + ['C'] = clipboard_actions.copy, + ['X'] = clipboard_actions.cut, + ['P'] = clipboard_actions.paste, + }, + float = { + winblend = 0, + curdir_window = { + enable = false, + highlight_dirname = false + }, - -- -- You can define a function that returns a table to be passed as the third - -- -- argument of nvim_open_win(). - -- win_opts = function() - -- local width = math.floor(vim.o.columns * 0.8) - -- local height = math.floor(vim.o.lines * 0.8) - -- return { - -- border = { - -- "+", "─", "+", "│", "+", "─", "+", "│", - -- }, - -- width = width, - -- height = height, - -- row = 1, - -- col = math.floor((vim.o.columns - width) / 2), - -- } - -- end, - }, - hide_cursor = true + -- -- You can define a function that returns a table to be passed as the third + -- -- argument of nvim_open_win(). + -- win_opts = function() + -- local width = math.floor(vim.o.columns * 0.8) + -- local height = math.floor(vim.o.lines * 0.8) + -- return { + -- border = { + -- "+", "─", "+", "│", "+", "─", "+", "│", + -- }, + -- width = width, + -- height = height, + -- row = 1, + -- col = math.floor((vim.o.columns - width) / 2), + -- } + -- end, + }, + hide_cursor = true } vim.api.nvim_create_autocmd({ 'FileType' }, { - pattern = { "lir" }, - callback = function() - -- use visual mode - vim.api.nvim_buf_set_keymap( - 0, - "x", - "J", - ':lua require"lir.mark.actions".toggle_mark("v")', - { noremap = true, silent = true } - ) + pattern = { "lir" }, + callback = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) - -- echo cwd - -- vim.api.nvim_echo({ { vim.fn.expand("%:p"), "Normal" } }, false, {}) - end + -- echo cwd + -- vim.api.nvim_echo({ { vim.fn.expand("%:p"), "Normal" } }, false, {}) + end }) -- custom folder icon require 'nvim-web-devicons'.set_icon({ - lir_folder_icon = { - icon = "", - color = "#7ebae4", - name = "LirFolderNode" - } + lir_folder_icon = { + icon = "", + color = "#7ebae4", + name = "LirFolderNode" + } })