add: update custom nvim tree, remove root folder

This commit is contained in:
asep komarudin 2024-03-19 04:55:20 +07:00
parent e5a9b6e638
commit fc175ae9ad
5 changed files with 177 additions and 163 deletions

View file

@ -46,7 +46,7 @@
"onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" }, "onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" },
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
"smart-splits.nvim": { "branch": "master", "commit": "f6fcb79527872e9330c554915af2ca511c388390" }, "smart-splits.nvim": { "branch": "master", "commit": "f6fcb79527872e9330c554915af2ca511c388390" },
"telescope.nvim": { "branch": "master", "commit": "5730b950d9e4dc0c3633c1c1a2cb2612069ef480" }, "telescope.nvim": { "branch": "master", "commit": "c816406bd50ade6ec754474f08974154487d417c" },
"toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" }, "toggleterm.nvim": { "branch": "main", "commit": "193786e0371e3286d3bc9aa0079da1cd41beaa62" },
"vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" },
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },

View file

@ -1,161 +1,167 @@
return { return {
"akinsho/bufferline.nvim", -- "akinsho/bufferline.nvim",
event = "VeryLazy", -- event = "VeryLazy",
config = function() -- config = function()
local status_ok, bufferline = pcall(require, "bufferline") -- local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then -- if not status_ok then
return -- return
end -- end
--
local icons = require("user.icons") -- local icons = require("user.icons")
local use_icons = true -- local use_icons = true
--
local function diagnostics_indicator(num, _, diagnostics, _) -- -- get folder name from current directory
local result = {} -- local _get_folder_name = function()
local symbols = { -- local str = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
error = icons.diagnostics.Error, -- return " 󱧶 " .. str:lower():gsub("^%l", string.upper) .. " "
warning = icons.diagnostics.Warning, -- end
info = icons.diagnostics.Information, --
} -- local function diagnostics_indicator(num, _, diagnostics, _)
if not use_icons then -- local result = {}
return "(" .. num .. ")" -- local symbols = {
end -- error = icons.diagnostics.Error,
for name, count in pairs(diagnostics) do -- warning = icons.diagnostics.Warning,
if symbols[name] and count > 0 then -- info = icons.diagnostics.Information,
table.insert(result, symbols[name] .. " " .. count) -- }
end -- if not use_icons then
end -- return "(" .. num .. ")"
result = table.concat(result, " ") -- end
return #result > 0 and result or "" -- for name, count in pairs(diagnostics) do
end -- if symbols[name] and count > 0 then
-- table.insert(result, symbols[name] .. " " .. count)
vim.opt.termguicolors = true -- end
-- end
bufferline.setup({ -- result = table.concat(result, " ")
options = { -- return #result > 0 and result or ""
color_icons = true, -- end
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, --
close_command = function(bufnum) -- vim.opt.termguicolors = true
require("bufdelete").bufdelete(bufnum, true) --
end, -- bufferline.setup({
right_mouse_command = function(bufnum) -- options = {
require("bufdelete").bufdelete(bufnum, true) -- color_icons = true,
end, -- numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
-- close_command = "bdelete! %d", -- close_command = function(bufnum)
-- right_mouse_command = "bdelete! %d", -- require("bufdelete").bufdelete(bufnum, true)
left_mouse_command = "buffer %d", -- end,
middle_mouse_command = nil, -- right_mouse_command = function(bufnum)
-- require("bufdelete").bufdelete(bufnum, true)
indicator_icon = nil, -- end,
indicator = { style = "icon", icon = "" }, -- -- close_command = "bdelete! %d",
buffer_close_icon = icons.ui.Close, -- -- right_mouse_command = "bdelete! %d",
modified_icon = icons.ui.Circle, -- left_mouse_command = "buffer %d",
close_icon = icons.ui.BoldClose, -- middle_mouse_command = nil,
left_trunc_marker = icons.ui.ArrowCircleLeft, --
right_trunc_marker = icons.ui.ArrowCircleRight, -- indicator_icon = nil,
max_name_length = 30, -- indicator = { style = "icon", icon = "▎" },
max_prefix_length = 30, -- buffer_close_icon = icons.ui.Close,
tab_size = 21, -- modified_icon = icons.ui.Circle,
diagnostics = false, -- | "nvim_lsp" | "coc", -- close_icon = icons.ui.BoldClose,
diagnostics_update_in_insert = false, -- left_trunc_marker = icons.ui.ArrowCircleLeft,
diagnostics_indicator = diagnostics_indicator, -- right_trunc_marker = icons.ui.ArrowCircleRight,
offsets = { -- max_name_length = 30,
{ -- max_prefix_length = 30,
filetype = "NvimTree", -- tab_size = 21,
text = "Explorer", -- diagnostics = false, -- | "nvim_lsp" | "coc",
highlight = "Directory", -- diagnostics_update_in_insert = false,
text_align = "left", -- diagnostics_indicator = diagnostics_indicator,
padding = 1, -- offsets = {
}, -- {
{ -- filetype = "NvimTree",
filetype = "neo-tree", -- text = _get_folder_name(),
text = "Explorer", -- highlight = "Directory",
highlight = "Directory", -- text_align = "left",
text_align = "left", -- padding = 1,
padding = 1, -- },
}, -- {
}, -- filetype = "neo-tree",
show_buffer_icons = true, -- text = _get_folder_name(),
show_buffer_close_icons = true, -- highlight = "Directory",
show_close_icon = true, -- text_align = "left",
show_tab_indicators = true, -- padding = 1,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist -- },
separator_style = { "", "" }, -- | "thick" | "thin" | { 'any', 'any' }, -- },
enforce_regular_tabs = true, -- show_buffer_icons = true,
always_show_bufferline = true, -- show_buffer_close_icons = true,
}, -- show_close_icon = true,
highlights = { -- show_tab_indicators = true,
background = { -- persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
fg = { attribute = "fg", highlight = "TabLine" }, -- separator_style = { "", "" }, -- | "thick" | "thin" | { 'any', 'any' },
bg = { attribute = "none", highlight = "TabLine" }, -- enforce_regular_tabs = true,
}, -- always_show_bufferline = true,
buffer_visible = { -- },
fg = { attribute = "fg", highlight = "TabLine" }, -- highlights = {
bg = { attribute = "none", highlight = "TabLine" }, -- background = {
}, -- fg = { attribute = "fg", highlight = "TabLine" },
close_button = { -- bg = { attribute = "none", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" }, -- },
bg = { attribute = "none", highlight = "TabLine" }, -- buffer_visible = {
}, -- fg = { attribute = "fg", highlight = "TabLine" },
close_button_visible = { -- bg = { attribute = "none", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" }, -- },
bg = { attribute = "none", highlight = "TabLine" }, -- close_button = {
}, -- fg = { attribute = "fg", highlight = "TabLine" },
tab_selected = { -- bg = { attribute = "none", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "Normal" }, -- },
bg = { attribute = "bg", highlight = "Normal" }, -- close_button_visible = {
}, -- fg = { attribute = "fg", highlight = "TabLine" },
tab = { -- bg = { attribute = "none", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" }, -- },
bg = { attribute = "bg", highlight = "TabLine" }, -- tab_selected = {
}, -- fg = { attribute = "fg", highlight = "Normal" },
tab_close = { -- bg = { attribute = "bg", highlight = "Normal" },
-- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, -- },
fg = { attribute = "fg", highlight = "TabLineSel" }, -- tab = {
bg = { attribute = "bg", highlight = "Normal" }, -- fg = { attribute = "fg", highlight = "TabLine" },
}, -- bg = { attribute = "bg", highlight = "TabLine" },
duplicate_selected = { -- },
fg = { attribute = "fg", highlight = "TabLineSel" }, -- tab_close = {
bg = { attribute = "bg", highlight = "TabLineSel" }, -- -- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
underline = true, -- fg = { attribute = "fg", highlight = "TabLineSel" },
}, -- bg = { attribute = "bg", highlight = "Normal" },
duplicate_visible = { -- },
fg = { attribute = "fg", highlight = "TabLine" }, -- duplicate_selected = {
bg = { attribute = "bg", highlight = "TabLine" }, -- fg = { attribute = "fg", highlight = "TabLineSel" },
underline = true, -- bg = { attribute = "bg", highlight = "TabLineSel" },
}, -- underline = true,
duplicate = { -- },
fg = { attribute = "fg", highlight = "TabLine" }, -- duplicate_visible = {
bg = { attribute = "bg", highlight = "TabLine" }, -- fg = { attribute = "fg", highlight = "TabLine" },
underline = true, -- bg = { attribute = "bg", highlight = "TabLine" },
}, -- underline = true,
-- },
modified = { -- duplicate = {
fg = { attribute = "fg", highlight = "TabLine" }, -- fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" }, -- bg = { attribute = "bg", highlight = "TabLine" },
}, -- underline = true,
modified_selected = { -- },
fg = { attribute = "fg", highlight = "Normal" }, --
bg = { attribute = "bg", highlight = "Normal" }, -- modified = {
}, -- fg = { attribute = "fg", highlight = "TabLine" },
modified_visible = { -- bg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "TabLine" }, -- },
bg = { attribute = "bg", highlight = "TabLine" }, -- modified_selected = {
}, -- fg = { attribute = "fg", highlight = "Normal" },
-- bg = { attribute = "bg", highlight = "Normal" },
separator = { -- },
fg = { attribute = "bg", highlight = "TabLine" }, -- modified_visible = {
bg = { attribute = "bg", highlight = "TabLine" }, -- fg = { attribute = "fg", highlight = "TabLine" },
}, -- bg = { attribute = "bg", highlight = "TabLine" },
separator_selected = { -- },
fg = { attribute = "bg", highlight = "Normal" }, --
bg = { attribute = "bg", highlight = "Normal" }, -- separator = {
}, -- fg = { attribute = "bg", highlight = "TabLine" },
indicator_selected = { -- bg = { attribute = "bg", highlight = "TabLine" },
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, -- },
bg = { attribute = "bg", highlight = "Normal" }, -- separator_selected = {
}, -- fg = { attribute = "bg", highlight = "Normal" },
}, -- bg = { attribute = "bg", highlight = "Normal" },
}) -- },
end, -- indicator_selected = {
-- fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
-- bg = { attribute = "bg", highlight = "Normal" },
-- },
-- },
-- })
-- end,
} }

View file

@ -372,6 +372,7 @@ return {
NvimTreeNormal = { fg = "$fg", bg = "$bg0" }, NvimTreeNormal = { fg = "$fg", bg = "$bg0" },
NvimTreeIndentMarker = { fg = "#3E4450" }, NvimTreeIndentMarker = { fg = "#3E4450" },
IblIndent = { fg = "#3E4450" }, IblIndent = { fg = "#3E4450" },
NvimTreeFolderIcon = { bg = "NONE", fg = "$blue" },
["@markup.link.url"] = { fg = "$cyan", fmt = "italic" }, ["@markup.link.url"] = { fg = "$cyan", fmt = "italic" },
["@text.uri"] = { fg = "$cyan", fmt = "none" }, ["@text.uri"] = { fg = "$cyan", fmt = "none" },
["@tag.delimiter"] = { fg = "$gray" }, ["@tag.delimiter"] = { fg = "$gray" },

View file

@ -6,6 +6,12 @@ end
local icons = require("user.icons") local icons = require("user.icons")
local use_icons = true local use_icons = true
-- get folder name from current directory
local _get_folder_name = function()
local str = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return " 󱧶 " .. str:lower():gsub("^%l", string.upper) .. " "
end
local function diagnostics_indicator(num, _, diagnostics, _) local function diagnostics_indicator(num, _, diagnostics, _)
local result = {} local result = {}
local symbols = { local symbols = {
@ -58,14 +64,14 @@ bufferline.setup({
offsets = { offsets = {
{ {
filetype = "NvimTree", filetype = "NvimTree",
text = "Explorer", text = _get_folder_name(),
highlight = "Directory", highlight = "Directory",
text_align = "left", text_align = "left",
padding = 1, padding = 1,
}, },
{ {
filetype = "neo-tree", filetype = "neo-tree",
text = "Explorer", text = _get_folder_name(),
highlight = "Directory", highlight = "Directory",
text_align = "left", text_align = "left",
padding = 1, padding = 1,

View file

@ -103,7 +103,8 @@ nvim_tree.setup({
args = {}, args = {},
}, },
renderer = { renderer = {
root_folder_modifier = ":t", -- root_folder_modifier = ":t",
root_folder_label = false,
indent_markers = { indent_markers = {
enable = true, enable = true,
inline_arrows = true, inline_arrows = true,