mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 17:28:39 +02:00
plugins/bufferline: migrate to mkNeovimPlugin
Also resolves https://github.com/nix-community/nixvim/issues/1890 by automatically setting up `diagnostics.update_in_insert` for the user.
This commit is contained in:
parent
db4c4e5b17
commit
cb398ce4ba
2 changed files with 675 additions and 309 deletions
|
@ -6,97 +6,121 @@
|
|||
example = {
|
||||
plugins.bufferline = {
|
||||
enable = true;
|
||||
customFilter = ''
|
||||
function(buf_number, buf_numbers)
|
||||
-- filter out filetypes you don't want to see
|
||||
if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
|
||||
return true
|
||||
end
|
||||
-- filter out by buffer name
|
||||
if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
|
||||
return true
|
||||
end
|
||||
-- filter out based on arbitrary rules
|
||||
-- e.g. filter out vim wiki buffer from tabline in your work repo
|
||||
if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
|
||||
return true
|
||||
end
|
||||
-- filter out by it's index number in list (don't show first buffer)
|
||||
if buf_numbers[1] ~= buf_number then
|
||||
return true
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
getElementIcon = ''
|
||||
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(opts.filetype, { default = false })
|
||||
return icon, hl
|
||||
end
|
||||
'';
|
||||
settings = {
|
||||
options = {
|
||||
custom_filter = # Lua
|
||||
''
|
||||
function(buf_number, buf_numbers)
|
||||
-- filter out filetypes you don't want to see
|
||||
if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
|
||||
return true
|
||||
end
|
||||
-- filter out by buffer name
|
||||
if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
|
||||
return true
|
||||
end
|
||||
-- filter out based on arbitrary rules
|
||||
-- e.g. filter out vim wiki buffer from tabline in your work repo
|
||||
if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
|
||||
return true
|
||||
end
|
||||
-- filter out by it's index number in list (don't show first buffer)
|
||||
if buf_numbers[1] ~= buf_number then
|
||||
return true
|
||||
end
|
||||
end
|
||||
'';
|
||||
get_element_icon = # Lua
|
||||
''
|
||||
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(opts.filetype, { default = false })
|
||||
return icon, hl
|
||||
end
|
||||
'';
|
||||
separator_style = [
|
||||
"|"
|
||||
"|"
|
||||
];
|
||||
sort_by.__raw = ''
|
||||
function(buffer_a, buffer_b)
|
||||
local modified_a = vim.fn.getftime(buffer_a.path)
|
||||
local modified_b = vim.fn.getftime(buffer_b.path)
|
||||
return modified_a > modified_b
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
defaults = {
|
||||
plugins.bufferline = {
|
||||
enable = true;
|
||||
mode = "buffers";
|
||||
themable = true;
|
||||
numbers = "none";
|
||||
bufferCloseIcon = "";
|
||||
modifiedIcon = "●";
|
||||
closeIcon = "";
|
||||
closeCommand = "bdelete! %d";
|
||||
leftMouseCommand = "buffer %d";
|
||||
rightMouseCommand = "bdelete! %d";
|
||||
middleMouseCommand = null;
|
||||
indicator = {
|
||||
icon = "▎";
|
||||
style = "icon";
|
||||
};
|
||||
leftTruncMarker = "";
|
||||
rightTruncMarker = "";
|
||||
separatorStyle = "thin";
|
||||
nameFormatter = null;
|
||||
truncateNames = true;
|
||||
tabSize = 18;
|
||||
maxNameLength = 18;
|
||||
colorIcons = true;
|
||||
showBufferIcons = true;
|
||||
showBufferCloseIcons = true;
|
||||
getElementIcon = null;
|
||||
showCloseIcon = true;
|
||||
showTabIndicators = true;
|
||||
showDuplicatePrefix = true;
|
||||
enforceRegularTabs = false;
|
||||
alwaysShowBufferline = true;
|
||||
persistBufferSort = true;
|
||||
maxPrefixLength = 15;
|
||||
sortBy = "id";
|
||||
diagnostics = false;
|
||||
diagnosticsIndicator = null;
|
||||
diagnosticsUpdateInInsert = true;
|
||||
offsets = null;
|
||||
groups = {
|
||||
items = [ ];
|
||||
settings = {
|
||||
options = {
|
||||
toggleHiddenOnEnter = true;
|
||||
mode = "buffers";
|
||||
themable = true;
|
||||
numbers = "none";
|
||||
buffer_close_icon = "";
|
||||
modified_icon = "●";
|
||||
close_icon = "";
|
||||
close_command = "bdelete! %d";
|
||||
left_mouse_command = "buffer %d";
|
||||
right_mouse_command = "bdelete! %d";
|
||||
middle_mouse_command = null;
|
||||
indicator = {
|
||||
icon = "▎";
|
||||
style = "icon";
|
||||
};
|
||||
left_trunc_marker = "";
|
||||
right_trunc_marker = "";
|
||||
separator_style = "thin";
|
||||
name_formatter = null;
|
||||
truncate_names = true;
|
||||
tab_size = 18;
|
||||
max_name_length = 18;
|
||||
color_icons = true;
|
||||
show_buffer_icons = true;
|
||||
show_buffer_close_icons = true;
|
||||
get_element_icon = null;
|
||||
show_close_icon = true;
|
||||
show_tab_indicators = true;
|
||||
show_duplicate_prefix = true;
|
||||
duplicates_across_groups = true;
|
||||
enforce_regular_tabs = false;
|
||||
always_show_bufferline = true;
|
||||
auto_toggle_bufferline = true;
|
||||
persist_buffer_sort = true;
|
||||
move_wraps_at_ends = false;
|
||||
max_prefix_length = 15;
|
||||
sort_by = "id";
|
||||
diagnostics = false;
|
||||
diagnostics_indicator = null;
|
||||
diagnostics_update_in_insert = true;
|
||||
diagnostics_update_on_event = true;
|
||||
offsets = null;
|
||||
groups = {
|
||||
items = [ ];
|
||||
options = {
|
||||
toggle_hidden_on_enter = true;
|
||||
};
|
||||
};
|
||||
hover = {
|
||||
enabled = false;
|
||||
reveal = [ ];
|
||||
delay = 200;
|
||||
};
|
||||
debug = {
|
||||
logging = false;
|
||||
};
|
||||
custom_filter = null;
|
||||
};
|
||||
highlights = { };
|
||||
};
|
||||
hover = {
|
||||
enabled = false;
|
||||
reveal = [ ];
|
||||
delay = 200;
|
||||
};
|
||||
debug = {
|
||||
logging = false;
|
||||
};
|
||||
customFilter = null;
|
||||
highlights = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue