Fixed bufferline bullshit

This commit is contained in:
_N0x 2024-10-30 23:37:45 +01:00
parent 4a8e5bc3fa
commit 09966d3ae6
3 changed files with 71 additions and 84 deletions

View File

@ -2,7 +2,6 @@ require "keymap"
require "options" require "options"
require "plugins" require "plugins"
require "vars" require "vars"
--require "bufferline"
-- Color Theme -- Color Theme
vim.cmd [[ vim.cmd [[
@ -11,8 +10,6 @@ try
endtry endtry
]] ]]
require("bufferline").setup()
-- Mason Setup -- Mason Setup
require("mason").setup({ require("mason").setup({
ui = { ui = {
@ -255,3 +252,73 @@ require('lualine').setup {
options = { theme = 'nord' } options = { theme = 'nord' }
} }
local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then
return
end
require('bufferline').setup {
options = {
mode = "buffers", -- set to "tabs" to only show tabpages instead
style_preset = bufferline.style_preset.default, -- or bufferline.style_preset.minimal,
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
close_command = "bdelete! %d", -- can be a string | function, | false see "Mouse actions"
right_mouse_command = "bdelete! %d", -- can be a string | function | false, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, | false see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, | false see "Mouse actions"
indicator = {
icon = '', -- this should be omitted if indicator style is not 'icon'
style = 'icon', --| 'underline' | 'none',
},
buffer_close_icon = '󰅖',
modified_icon = '',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
--- name_formatter can be used to change the buffer's label in the bufferline.
--- Please note some names can/will break the
--- bufferline so use this at your discretion knowing that it has
--- some limitations that will *NOT* be fixed.
max_name_length = 18,
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
truncate_names = true, -- whether or not tab names should be truncated
tab_size = 18,
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = false, -- only applies to coc
diagnostics_update_on_event = true, -- use nvim's diagnostic handler
-- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",-- | function ,
text_align = "left",-- | "center" | "right"
separator = true
}
},
color_icons = true, -- whether or not to add the filetype icon highlights
show_buffer_icons = true , -- disable filetype icons for buffers
show_buffer_close_icons = true ,
show_close_icon = true,
show_tab_indicators = true ,
show_duplicate_prefix = true , -- whether to show duplicate buffer prefix
duplicates_across_groups = true, -- whether to consider duplicate paths in different groups as duplicates
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
move_wraps_at_ends = false, -- whether or not the move command "wraps" at the first or last position
-- can also be a table containing 2 custom separators
-- [focused and unfocused]. eg: { '|', '|' }
separator_style = "thin", --| "slope" | "thick" | "thin" | { 'any', 'any' },
enforce_regular_tabs = true,--| true,
always_show_bufferline = true,-- | false,
auto_toggle_bufferline = true,-- | false,
hover = {
enabled = true,
delay = 200,
reveal = {'close'}
},
sort_by = 'insert_after_current',
pick = {
alphabet = "abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ1234567890",
},
}
}

View File

@ -1,81 +0,0 @@
local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then
return
end
bufferline.setup {
options = {
mode = "buffers", -- set to "tabs" to only show tabpages instead
style_preset = bufferline.style_preset.default, -- or bufferline.style_preset.minimal,
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
close_command = "bdelete! %d", -- can be a string | function, | false see "Mouse actions"
right_mouse_command = "bdelete! %d", -- can be a string | function | false, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, | false see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, | false see "Mouse actions"
indicator = {
icon = '', -- this should be omitted if indicator style is not 'icon'
style = 'icon', --| 'underline' | 'none',
},
buffer_close_icon = '󰅖',
modified_icon = '',
close_icon = '',
left_trunc_marker = '',
right_trunc_marker = '',
--- name_formatter can be used to change the buffer's label in the bufferline.
--- Please note some names can/will break the
--- bufferline so use this at your discretion knowing that it has
--- some limitations that will *NOT* be fixed.
max_name_length = 18,
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
truncate_names = true, -- whether or not tab names should be truncated
tab_size = 18,
diagnostics = "nvim_lsp",
diagnostics_update_in_insert = false, -- only applies to coc
diagnostics_update_on_event = true, -- use nvim's diagnostic handler
-- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting
offsets = {
{
filetype = "NvimTree",
text = "File Explorer",-- | function ,
text_align = "left",-- | "center" | "right"
separator = true
}
},
color_icons = true, -- whether or not to add the filetype icon highlights
get_element_icon = function(element)
-- element consists of {filetype: string, path: string, extension: string, directory: string}
-- This can be used to change how bufferline fetches the icon
-- for an element e.g. a buffer or a tab.
-- e.g.
local icon, hl = require('nvim-web-devicons').get_icon_by_filetype(element.filetype, { default = false })
return icon, hl
-- or
--local custom_map = {my_thing_ft: {icon = "my_thing_icon", hl}}
--return custom_map[element.filetype]
end,
show_buffer_icons = true , -- disable filetype icons for buffers
show_buffer_close_icons = true ,
show_close_icon = true,
show_tab_indicators = true ,
show_duplicate_prefix = true , -- whether to show duplicate buffer prefix
duplicates_across_groups = true, -- whether to consider duplicate paths in different groups as duplicates
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
move_wraps_at_ends = false, -- whether or not the move command "wraps" at the first or last position
-- can also be a table containing 2 custom separators
-- [focused and unfocused]. eg: { '|', '|' }
separator_style = "thin", --| "slope" | "thick" | "thin" | { 'any', 'any' },
enforce_regular_tabs = true,--| true,
always_show_bufferline = true,-- | false,
auto_toggle_bufferline = true,-- | false,
hover = {
enabled = true,
delay = 200,
reveal = {'close'}
},
sort_by = 'insert_after_current',
pick = {
alphabet = "abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ1234567890",
},
}
}

View File

@ -76,6 +76,7 @@ return packer.startup(function(use)
-- Bufferline -- Bufferline
use {'akinsho/bufferline.nvim', requires = 'nvim-tree/nvim-web-devicons'} use {'akinsho/bufferline.nvim', requires = 'nvim-tree/nvim-web-devicons'}
use 'moll/vim-bbye'
-- VimWiki -- VimWiki
use { 'vimwiki/vimwiki', branch='dev'} use { 'vimwiki/vimwiki', branch='dev'}