updated bufferline
This commit is contained in:
parent
9f9d663f0b
commit
ffdb9eb0e5
1
init.lua
1
init.lua
|
@ -346,6 +346,7 @@ vim.opt.rtp:prepend(lazypath)
|
||||||
-- To update plugins you can run
|
-- To update plugins you can run
|
||||||
-- :Lazy update
|
-- :Lazy update
|
||||||
--
|
--
|
||||||
|
vim.o.mouse = 'a'
|
||||||
-- NOTE: Here is where you install your plugins.
|
-- NOTE: Here is where you install your plugins.
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
-- ~/.config/nvim/lua/custom/config/lualine_config.lua
|
|
||||||
|
|
||||||
local lualine = require 'lualine'
|
local lualine = require 'lualine'
|
||||||
|
|
||||||
-- Color table for highlights
|
-- Color table for highlights
|
||||||
|
@ -35,68 +33,49 @@ local conditions = {
|
||||||
-- Config
|
-- Config
|
||||||
local config = {
|
local config = {
|
||||||
options = {
|
options = {
|
||||||
-- Disable sections and component separators
|
|
||||||
component_separators = '',
|
component_separators = '',
|
||||||
section_separators = '',
|
section_separators = '',
|
||||||
-- theme = {
|
theme = {
|
||||||
-- -- We are going to use lualine_c and lualine_x as left and
|
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
-- -- right sections. Both are highlighted by the c theme.
|
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||||
-- -- So we are just setting default looks of statusline
|
},
|
||||||
-- normal = { c = { fg = colors.fg, bg = colors.bg } },
|
|
||||||
-- inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
|
||||||
-- },
|
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
-- these are to remove the defaults
|
|
||||||
lualine_a = {
|
|
||||||
-- {
|
|
||||||
-- 'buffers',
|
|
||||||
-- show_filename_only = false,
|
|
||||||
-- },
|
|
||||||
},
|
|
||||||
lualine_b = {},
|
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {},
|
|
||||||
-- These will be filled later
|
|
||||||
lualine_c = {},
|
|
||||||
lualine_x = {},
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
-- these are to remove the defaults
|
|
||||||
lualine_a = {},
|
lualine_a = {},
|
||||||
lualine_b = {},
|
lualine_b = {},
|
||||||
lualine_y = {},
|
|
||||||
lualine_z = {},
|
|
||||||
lualine_c = {},
|
lualine_c = {},
|
||||||
lualine_x = {},
|
lualine_x = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Inserts a component in lualine_c at the left section
|
|
||||||
local function ins_left(component)
|
local function ins_left(component)
|
||||||
table.insert(config.sections.lualine_c, component)
|
table.insert(config.sections.lualine_c, component)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Inserts a component in lualine_x at the right section
|
|
||||||
local function ins_right(component)
|
local function ins_right(component)
|
||||||
table.insert(config.sections.lualine_x, component)
|
table.insert(config.sections.lualine_x, component)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Left components
|
||||||
ins_left {
|
ins_left {
|
||||||
function()
|
function() return '▊' end,
|
||||||
return '▊'
|
color = { fg = colors.blue },
|
||||||
end,
|
padding = { left = 0, right = 1 },
|
||||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
|
||||||
padding = { left = 0, right = 1 }, -- No space before this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ins_left {
|
ins_left {
|
||||||
-- mode component
|
function() return '' end,
|
||||||
function()
|
|
||||||
return ''
|
|
||||||
end,
|
|
||||||
color = function()
|
color = function()
|
||||||
-- Auto change color according to Neovim's mode
|
|
||||||
local mode_color = {
|
local mode_color = {
|
||||||
n = colors.red,
|
n = colors.red,
|
||||||
i = colors.green,
|
i = colors.green,
|
||||||
|
@ -124,21 +103,25 @@ ins_left {
|
||||||
padding = { right = 1 },
|
padding = { right = 1 },
|
||||||
}
|
}
|
||||||
|
|
||||||
ins_left {
|
-- THIS IS THE MODIFIED COMPONENT (shows path)
|
||||||
-- filesize component
|
|
||||||
'filesize',
|
|
||||||
cond = conditions.buffer_not_empty,
|
|
||||||
}
|
|
||||||
|
|
||||||
ins_left {
|
ins_left {
|
||||||
'filename',
|
'filename',
|
||||||
cond = conditions.buffer_not_empty,
|
cond = conditions.buffer_not_empty,
|
||||||
color = { fg = colors.magenta, gui = 'bold' },
|
color = { fg = colors.magenta, gui = 'bold' },
|
||||||
|
path = 1, -- Show relative path (2-3 parent directories)
|
||||||
}
|
}
|
||||||
|
|
||||||
ins_left { 'location', show_filename_only = false }
|
ins_left {
|
||||||
|
function()
|
||||||
|
local buf_count = #vim.fn.getbufinfo({buflisted = 1})
|
||||||
|
return 'Buffers: ' .. buf_count
|
||||||
|
end,
|
||||||
|
color = { fg = colors.cyan },
|
||||||
|
}
|
||||||
|
|
||||||
|
ins_left { 'location' }
|
||||||
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
|
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
|
||||||
ins_left { 'buffers', show_filename_only = false }
|
|
||||||
ins_left {
|
ins_left {
|
||||||
'diagnostics',
|
'diagnostics',
|
||||||
sources = { 'nvim_diagnostic' },
|
sources = { 'nvim_diagnostic' },
|
||||||
|
@ -150,23 +133,14 @@ ins_left {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Insert mid section. You can make any number of sections in Neovim :)
|
ins_left { function() return '%=' end }
|
||||||
-- for lualine it's any number greater than 2
|
|
||||||
ins_left {
|
|
||||||
function()
|
|
||||||
return '%='
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
ins_left {
|
ins_left {
|
||||||
-- Lsp server name
|
|
||||||
function()
|
function()
|
||||||
local msg = 'No Active Lsp'
|
local msg = 'No Active Lsp'
|
||||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||||
local clients = vim.lsp.get_active_clients()
|
local clients = vim.lsp.get_active_clients()
|
||||||
if next(clients) == nil then
|
if next(clients) == nil then return msg end
|
||||||
return msg
|
|
||||||
end
|
|
||||||
for _, client in ipairs(clients) do
|
for _, client in ipairs(clients) do
|
||||||
local filetypes = client.config.filetypes
|
local filetypes = client.config.filetypes
|
||||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||||
|
@ -179,10 +153,10 @@ ins_left {
|
||||||
color = { fg = '#ffffff', gui = 'bold' },
|
color = { fg = '#ffffff', gui = 'bold' },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Add components to right sections
|
-- Right components
|
||||||
ins_right {
|
ins_right {
|
||||||
'o:encoding', -- option component same as &encoding in viml
|
'o:encoding',
|
||||||
fmt = string.upper, -- Convert to uppercase
|
fmt = string.upper,
|
||||||
cond = conditions.hide_in_width,
|
cond = conditions.hide_in_width,
|
||||||
color = { fg = colors.green, gui = 'bold' },
|
color = { fg = colors.green, gui = 'bold' },
|
||||||
}
|
}
|
||||||
|
@ -190,19 +164,18 @@ ins_right {
|
||||||
ins_right {
|
ins_right {
|
||||||
'fileformat',
|
'fileformat',
|
||||||
fmt = string.upper,
|
fmt = string.upper,
|
||||||
icons_enabled = false, -- Disable icons
|
icons_enabled = false,
|
||||||
color = { fg = colors.green, gui = 'bold' },
|
color = { fg = colors.green, gui = 'bold' },
|
||||||
}
|
}
|
||||||
|
|
||||||
ins_right {
|
ins_right {
|
||||||
'branch',
|
'branch',
|
||||||
icon = '',
|
icon = '',
|
||||||
color = { fg = colors.red, gui = 'bold' },
|
color = { fg = colors.violet, gui = 'bold' },
|
||||||
}
|
}
|
||||||
|
|
||||||
ins_right {
|
ins_right {
|
||||||
'diff',
|
'diff',
|
||||||
-- Symbols for diff
|
|
||||||
symbols = { added = ' ', modified = ' ', removed = ' ' },
|
symbols = { added = ' ', modified = ' ', removed = ' ' },
|
||||||
diff_color = {
|
diff_color = {
|
||||||
added = { fg = colors.green },
|
added = { fg = colors.green },
|
||||||
|
@ -213,12 +186,9 @@ ins_right {
|
||||||
}
|
}
|
||||||
|
|
||||||
ins_right {
|
ins_right {
|
||||||
function()
|
function() return '▊' end,
|
||||||
return '▊'
|
|
||||||
end,
|
|
||||||
color = { fg = colors.blue },
|
color = { fg = colors.blue },
|
||||||
padding = { left = 1 },
|
padding = { left = 1 },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Initialize lualine with the configuration
|
|
||||||
lualine.setup(config)
|
lualine.setup(config)
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
return {
|
return {
|
||||||
'goolord/alpha-nvim',
|
'goolord/alpha-nvim',
|
||||||
|
priority = 1000,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
|
'echasnovski/mini.icons',
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
|
require('alpha').setup(require('alpha.themes.theta').config)
|
||||||
local alpha = require 'alpha'
|
local alpha = require 'alpha'
|
||||||
local dashboard = require 'alpha.themes.startify'
|
local dashboard = require 'alpha.themes.startify'
|
||||||
|
|
||||||
|
@ -25,7 +29,34 @@ return {
|
||||||
[[ ]],
|
[[ ]],
|
||||||
[[ ]],
|
[[ ]],
|
||||||
}
|
}
|
||||||
|
-- dashboard.section.header.val = {
|
||||||
|
-- [[ ]],
|
||||||
|
-- [[ ]],
|
||||||
|
-- [[ ]],
|
||||||
|
-- [[ ]],
|
||||||
|
-- [[ .-') _ ('-. (`-. _ .-') ]],
|
||||||
|
-- [[ ( OO ) )_( OO) _(OO )_ ( '.( OO )_ ]],
|
||||||
|
-- [[,--./ ,--,'(,------. .-'),-----. ,--(_/ ,. \ ,-.-') ,--. ,--.)]],
|
||||||
|
-- [[| \ | |\ | .---'( OO' .-. '\ \ /(__/ | |OO)| `.' | ]],
|
||||||
|
-- [[| \| | )| | / | | | | \ \ / / | | \| | ]],
|
||||||
|
-- [[| . |/(| '--. \_) | |\| | \ ' /, | |(_/| |'.'| | ]],
|
||||||
|
-- [[| |\ | | .--' \ | | | | \ /__),| |_.'| | | | ]],
|
||||||
|
-- [[| | \ | | `---. `' '-' ' \ / (_| | | | | | ]],
|
||||||
|
-- [[`--' `--' `------' `-----' `-' `--' `--' `--' ]],
|
||||||
|
-- [[ ]],
|
||||||
|
-- [[ ]],
|
||||||
|
-- [[ ]],
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- dashboard.section.header.val = {
|
||||||
|
--
|
||||||
|
-- [[ _ _ _ ]],
|
||||||
|
-- [[ | \| | ___ ___ __ __ (_) _ __ ]],
|
||||||
|
-- [[ | .` | / -_) / _ \ \ V / | | | ' \ ]],
|
||||||
|
-- [[ |_|\_| \___| \___/ _\_/_ _|_|_ |_|_|_| ]],
|
||||||
|
-- [[ _|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| ]],
|
||||||
|
-- [[ "`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-' ]],
|
||||||
|
-- }
|
||||||
alpha.setup(dashboard.opts)
|
alpha.setup(dashboard.opts)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,46 @@
|
||||||
return {
|
return {
|
||||||
'akinsho/bufferline.nvim',
|
'akinsho/bufferline.nvim',
|
||||||
version = "*",
|
version = '*',
|
||||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||||
config = function()
|
config = function()
|
||||||
require("bufferline").setup{}
|
require('bufferline').setup {
|
||||||
end
|
options = {
|
||||||
|
diagnostics = 'nvim_lsp',
|
||||||
|
diagnostics_indicator = function(count, level)
|
||||||
|
local icon = level:match 'error' and ' ' or ' '
|
||||||
|
return ' ' .. icon .. count
|
||||||
|
end,
|
||||||
|
hover = {
|
||||||
|
enabled = true,
|
||||||
|
delay = 200,
|
||||||
|
reveal = { 'close' },
|
||||||
|
},
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = 'NvimTree',
|
||||||
|
text = function()
|
||||||
|
return vim.fn.getcwd()
|
||||||
|
end,
|
||||||
|
highlight = 'Directory',
|
||||||
|
text_align = 'left',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
vim.keymap.set('n', 'bk', ':BufferLinePick<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', 'bkk', ':BufferLinePickClose<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', 'bl', ':BufferLineCloseLeft<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', 'br', ':BufferLineCloseRight<CR>', { silent = true })
|
||||||
|
-- Remaps
|
||||||
|
vim.keymap.set('n', '<leader>1', ':BufferLineGoToBuffer 1<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>2', ':BufferLineGoToBuffer 2<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>3', ':BufferLineGoToBuffer 3<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>4', ':BufferLineGoToBuffer 4<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>5', ':BufferLineGoToBuffer 5<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>6', ':BufferLineGoToBuffer 6<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>7', ':BufferLineGoToBuffer 7<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>8', ':BufferLineGoToBuffer 8<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>9', ':BufferLineGoToBuffer 9<CR>', { silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>$', ':BufferLineGoToBuffer -1<CR>', { silent = true })
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
return {
|
||||||
|
'nvim-telescope/telescope-file-browser.nvim',
|
||||||
|
dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' },
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<space>fb", ":Telescope file_browser<CR>"),
|
||||||
|
|
||||||
|
-- open file_browser with the path of the current buffer
|
||||||
|
vim.keymap.set("n", "<space>fb", ":Telescope file_browser path=%:p:h select_buffer=true<CR>"),
|
||||||
|
|
||||||
|
-- Alternatively, using lua API
|
||||||
|
vim.keymap.set("n", "<space>fb", function()
|
||||||
|
require("telescope").extensions.file_browser.file_browser()
|
||||||
|
end)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue