mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-25 03:35:30 +02:00
feat: add lir.nvim again (#3038)
This commit is contained in:
parent
68fdbaa51d
commit
a331ef711b
7 changed files with 161 additions and 3 deletions
|
@ -10,6 +10,36 @@ function M.load_defaults()
|
|||
user_config_file = user_config_file:gsub("\\", "/")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = {
|
||||
"Jaq",
|
||||
"qf",
|
||||
"help",
|
||||
"man",
|
||||
"lspinfo",
|
||||
"spectre_panel",
|
||||
"lir",
|
||||
"DressingSelect",
|
||||
"tsplayground",
|
||||
"Markdown",
|
||||
},
|
||||
callback = function()
|
||||
vim.cmd [[
|
||||
nnoremap <silent> <buffer> q :close<CR>
|
||||
nnoremap <silent> <buffer> <esc> :close<CR>
|
||||
set nobuflisted
|
||||
]]
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "lir" },
|
||||
callback = function()
|
||||
vim.opt_local.number = false
|
||||
vim.opt_local.relativenumber = false
|
||||
end,
|
||||
})
|
||||
|
||||
local definitions = {
|
||||
{
|
||||
"TextYankPost",
|
||||
|
|
|
@ -9,6 +9,7 @@ local builtins = {
|
|||
"lvim.core.telescope",
|
||||
"lvim.core.treesitter",
|
||||
"lvim.core.nvimtree",
|
||||
"lvim.core.lir",
|
||||
"lvim.core.project",
|
||||
"lvim.core.bufferline",
|
||||
"lvim.core.autopairs",
|
||||
|
|
117
lua/lvim/core/lir.lua
Normal file
117
lua/lvim/core/lir.lua
Normal file
|
@ -0,0 +1,117 @@
|
|||
local M = {}
|
||||
|
||||
local Log = require "lvim.core.log"
|
||||
|
||||
M.config = function()
|
||||
lvim.builtin.lir = {
|
||||
active = true,
|
||||
on_config_done = nil,
|
||||
}
|
||||
|
||||
local status_ok, lir = pcall(require, "lir")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local actions = require "lir.actions"
|
||||
local mark_actions = require "lir.mark.actions"
|
||||
local clipboard_actions = require "lir.clipboard.actions"
|
||||
|
||||
lir.setup {
|
||||
show_hidden_files = false,
|
||||
devicons_enable = true,
|
||||
mappings = {
|
||||
["l"] = actions.edit,
|
||||
["<CR>"] = actions.edit,
|
||||
["<C-s>"] = actions.split,
|
||||
["v"] = actions.vsplit,
|
||||
["<C-t>"] = actions.tabedit,
|
||||
|
||||
["h"] = actions.up,
|
||||
["q"] = actions.quit,
|
||||
|
||||
["A"] = actions.mkdir,
|
||||
["a"] = actions.newfile,
|
||||
["r"] = actions.rename,
|
||||
["@"] = actions.cd,
|
||||
["Y"] = actions.yank_path,
|
||||
["i"] = 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 = 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.7)
|
||||
local height = math.floor(vim.o.lines * 0.7)
|
||||
return {
|
||||
border = "rounded",
|
||||
width = width,
|
||||
height = height,
|
||||
-- row = 1,
|
||||
-- col = math.floor((vim.o.columns - width) / 2),
|
||||
}
|
||||
end,
|
||||
},
|
||||
hide_cursor = false,
|
||||
on_init = function()
|
||||
-- use visual mode
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
0,
|
||||
"x",
|
||||
"J",
|
||||
':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
|
||||
-- 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",
|
||||
-- color = "#569CD6",
|
||||
color = "#42A5F5",
|
||||
name = "LirFolderNode",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
if lvim.builtin.nvimtree.active then
|
||||
Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'"
|
||||
return
|
||||
end
|
||||
|
||||
local status_ok, lir = pcall(require, "lir")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
lir.setup(lvim.builtin.lir.setup)
|
||||
require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons)
|
||||
|
||||
if lvim.builtin.lir.on_config_done then
|
||||
lvim.builtin.lir.on_config_done(lir)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -15,7 +15,7 @@ M.config = function()
|
|||
motions = false, -- adds help for motions
|
||||
text_objects = false, -- help for text objects triggered after entering an operator
|
||||
windows = false, -- default bindings on <c-w>
|
||||
nav = true, -- misc bindings to work with windows
|
||||
nav = false, -- misc bindings to work with windows
|
||||
z = false, -- bindings for folds, spelling and others prefixed with z
|
||||
g = false, -- bindings for prefixed with g
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@ function plugin_loader.init(opts)
|
|||
package_root = opts.package_root or join_paths(vim.fn.stdpath "data", "site", "pack"),
|
||||
compile_path = compile_path,
|
||||
snapshot_path = snapshot_path,
|
||||
max_jobs = 40,
|
||||
max_jobs = 100,
|
||||
log = { level = "warn" },
|
||||
git = {
|
||||
clone_timeout = 300,
|
||||
|
|
|
@ -139,7 +139,14 @@ local core_plugins = {
|
|||
end,
|
||||
disable = not lvim.builtin.nvimtree.active,
|
||||
},
|
||||
|
||||
-- Lir
|
||||
{
|
||||
"christianchiarulli/lir.nvim",
|
||||
config = function()
|
||||
require("lvim.core.lir").setup()
|
||||
end,
|
||||
disable = not lvim.builtin.lir.active,
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
"gitsigns.nvim": {
|
||||
"commit": "d7e0bcb"
|
||||
},
|
||||
"lir.nvim": {
|
||||
"commit": "7d8c6c4"
|
||||
},
|
||||
"lua-dev.nvim": {
|
||||
"commit": "fd7a18e"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue