From d2ff1cb546b2dcb6c3510aa16ec8bde9c7d21538 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 16 Feb 2022 07:59:33 +0000 Subject: [PATCH] feat(nvim): add `lir.nvim` --- roles/neovim/files/after/plugin/lir.lua | 64 +++++++++++++++++++++ roles/neovim/files/lua/opdavies/plugins.lua | 2 + 2 files changed, 66 insertions(+) create mode 100644 roles/neovim/files/after/plugin/lir.lua diff --git a/roles/neovim/files/after/plugin/lir.lua b/roles/neovim/files/after/plugin/lir.lua new file mode 100644 index 0000000..b779a3d --- /dev/null +++ b/roles/neovim/files/after/plugin/lir.lua @@ -0,0 +1,64 @@ +local has_lir, lir = pcall(require, "lir") +if not has_lir then + return +end + +local actions = require'lir.actions' +local clipboard_actions = require'lir.clipboard.actions' +local mark_actions = require 'lir.mark.actions' + +lir.setup { + hide_cursor = true, + show_hidden_files = true, + -- devicons_enable = true, + + mappings = { + ['l'] = actions.edit, + [''] = actions.split, + [''] = actions.vsplit, + [''] = actions.tabedit, + + ['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, + + ['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 + }, + }, + + on_init = 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, +} + diff --git a/roles/neovim/files/lua/opdavies/plugins.lua b/roles/neovim/files/lua/opdavies/plugins.lua index 970e40e..7c73af4 100644 --- a/roles/neovim/files/lua/opdavies/plugins.lua +++ b/roles/neovim/files/lua/opdavies/plugins.lua @@ -51,6 +51,8 @@ return packer.startup(function() -- Navigation use "ThePrimeagen/harpoon" + use "tamago324/lir-git-status.nvim" + use "tamago324/lir.nvim" -- Treesitter use {