summaryrefslogtreecommitdiff
path: root/lua/lvim/core
diff options
context:
space:
mode:
Diffstat (limited to 'lua/lvim/core')
-rw-r--r--lua/lvim/core/nvimtree.lua47
-rw-r--r--lua/lvim/core/telescope.lua20
-rw-r--r--lua/lvim/core/telescope/custom-finders.lua4
3 files changed, 50 insertions, 21 deletions
diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua
index 17b8f36a..6b6997ca 100644
--- a/lua/lvim/core/nvimtree.lua
+++ b/lua/lvim/core/nvimtree.lua
@@ -9,11 +9,18 @@ function M.config()
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
+ ignore_buffer_on_setup = false,
ignore_ft_on_setup = {
"startify",
"dashboard",
"alpha",
},
+ auto_reload_on_write = true,
+ hijack_unnamed_buffer_when_opening = false,
+ hijack_directories = {
+ enable = true,
+ auto_open = true,
+ },
update_to_buf_dir = {
enable = true,
auto_open = true,
@@ -67,17 +74,27 @@ function M.config()
cmd = "trash",
require_confirm = true,
},
+ actions = {
+ change_dir = {
+ global = false,
+ },
+ open_file = {
+ quit_on_open = false,
+ },
+ window_picker = {
+ enable = false,
+ chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
+ exclude = {},
+ },
+ },
},
show_icons = {
git = 1,
folders = 1,
files = 1,
folder_arrows = 1,
- tree_width = 30,
},
- quit_on_open = 0,
git_hl = 1,
- disable_window_picker = 0,
root_folder_modifier = ":t",
icons = {
default = "",
@@ -118,21 +135,25 @@ function M.setup()
if lvim.builtin.project.active then
lvim.builtin.nvimtree.respect_buf_cwd = 1
lvim.builtin.nvimtree.setup.update_cwd = true
- lvim.builtin.nvimtree.setup.disable_netrw = false
- lvim.builtin.nvimtree.setup.hijack_netrw = false
- vim.g.netrw_banner = false
+ lvim.builtin.nvimtree.setup.update_focused_file = { enable = true, update_cwd = true }
+ end
+
+ local function telescope_find_files(_)
+ require("lvim.core.nvimtree").start_telescope "find_files"
+ end
+ local function telescope_live_grep(_)
+ require("lvim.core.nvimtree").start_telescope "live_grep"
end
-- Add useful keymaps
- local tree_cb = nvim_tree_config.nvim_tree_callback
if #lvim.builtin.nvimtree.setup.view.mappings.list == 0 then
lvim.builtin.nvimtree.setup.view.mappings.list = {
- { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
- { key = "h", cb = tree_cb "close_node" },
- { key = "v", cb = tree_cb "vsplit" },
- { key = "C", cb = tree_cb "cd" },
- { key = "gtf", cb = "<cmd>lua require'lvim.core.nvimtree'.start_telescope('find_files')<cr>" },
- { key = "gtg", cb = "<cmd>lua require'lvim.core.nvimtree'.start_telescope('live_grep')<cr>" },
+ { key = { "l", "<CR>", "o" }, action = "edit", mode = "n" },
+ { key = "h", action = "close_node" },
+ { key = "v", action = "vsplit" },
+ { key = "C", action = "cd" },
+ { key = "gtf", action = "telescope_find_files", action_cb = telescope_find_files },
+ { key = "gtg", action = "telescope_live_grep", action_cb = telescope_live_grep },
}
end
diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua
index 2c9ef1e7..11a9655d 100644
--- a/lua/lvim/core/telescope.lua
+++ b/lua/lvim/core/telescope.lua
@@ -25,7 +25,15 @@ function M.config()
layout_config = {
width = 0.75,
preview_cutoff = 120,
- horizontal = { mirror = false },
+ horizontal = {
+ preview_width = function(_, cols, _)
+ if cols < 120 then
+ return math.floor(cols * 0.5)
+ end
+ return math.floor(cols * 0.6)
+ end,
+ mirror = false,
+ },
vertical = { mirror = false },
},
vimgrep_arguments = {
@@ -91,11 +99,7 @@ function M.code_actions()
width = 80,
height = 12,
},
- borderchars = {
- prompt = { "─", "│", " ", "│", "╭", "╮", "│", "│" },
- results = { "─", "│", "─", "│", "├", "┤", "╯", "╰" },
- preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
- },
+ borderchars = lvim.builtin.telescope.defaults.borderchars,
border = {},
previewer = false,
shorten_path = false,
@@ -149,7 +153,9 @@ function M.setup()
end
if lvim.builtin.telescope.extensions and lvim.builtin.telescope.extensions.fzf then
- require("telescope").load_extension "fzf"
+ pcall(function()
+ require("telescope").load_extension "fzf"
+ end)
end
end
diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua
index 18307fbd..b0ee1c07 100644
--- a/lua/lvim/core/telescope/custom-finders.lua
+++ b/lua/lvim/core/telescope/custom-finders.lua
@@ -50,7 +50,9 @@ local copy_to_clipboard_action = function(prompt_bufnr)
end
function M.view_lunarvim_changelog()
- local opts = themes.get_ivy { cwd = get_lvim_base_dir() }
+ local opts = themes.get_ivy {
+ cwd = get_lvim_base_dir(),
+ }
opts.entry_maker = make_entry.gen_from_git_commits(opts)
pickers.new(opts, {