Compare commits
3 commits
123dfb81f9
...
adcdd78525
Author | SHA1 | Date | |
---|---|---|---|
adcdd78525 | |||
5e7f438410 | |||
e9902fad73 |
7 changed files with 129 additions and 1 deletions
|
@ -32,6 +32,10 @@ with final.pkgs.lib; let
|
|||
# Base
|
||||
lz-n
|
||||
snacks-nvim
|
||||
|
||||
# UI
|
||||
mini-icons
|
||||
bufferline-nvim
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
|
|
|
@ -11,4 +11,4 @@ require('autocmds')
|
|||
|
||||
require('snacks-nvim')
|
||||
|
||||
-- require('lz.n').load('plugins')
|
||||
require('lz.n').load('plugins')
|
||||
|
|
8
nvim/lua/icons.lua
Normal file
8
nvim/lua/icons.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
diagnostics = {
|
||||
Error = ' ',
|
||||
Warn = ' ',
|
||||
Hint = ' ',
|
||||
Info = ' ',
|
||||
},
|
||||
}
|
11
nvim/lua/lib/marleyvim/init.lua
Normal file
11
nvim/lua/lib/marleyvim/init.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local M = {}
|
||||
|
||||
---@param prefix string The string to prefix to all req calls.
|
||||
function M.localRequire(prefix)
|
||||
---@param mod string The module to require.
|
||||
return function(mod)
|
||||
return require(prefix .. '.' .. mod)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
79
nvim/lua/plugins/ui/bufferline-nvim.lua
Normal file
79
nvim/lua/plugins/ui/bufferline-nvim.lua
Normal file
|
@ -0,0 +1,79 @@
|
|||
return {
|
||||
'bufferline.nvim',
|
||||
event = 'DeferredUIEnter',
|
||||
keys = {
|
||||
{ '<LEADER>bp', '<CMD>BufferLineTogglePin<CR>', desc = 'Toggle pin' },
|
||||
{
|
||||
'<LEADER>bP',
|
||||
'<CMD>BufferLineGroupClose ungrouped<CR>',
|
||||
desc = 'Delete non-pinned buffers',
|
||||
},
|
||||
{
|
||||
'<LEADER>br',
|
||||
'<CMD>BufferLineCloseRight<CR>',
|
||||
desc = 'Delete buffers to the right',
|
||||
},
|
||||
{
|
||||
'<LEADER>bl',
|
||||
'<CMD>BufferLineCloseLeft<CR>',
|
||||
desc = 'Delete buffers to the left',
|
||||
},
|
||||
{ '<S-H>', '<CMD>BufferLineCyclePrev<CR>', desc = 'Previous buffer' },
|
||||
{ '<S-L>', '<CMD>BufferLineCycleNext<CR>', desc = 'Next buffer' },
|
||||
{ '[b', '<CMD>BufferLineCyclePrev<CR>', desc = 'Previous buffer' },
|
||||
{ ']b', '<CMD>BufferLineCycleNext<CR>', desc = 'Next buffer' },
|
||||
{ '[B', '<CMD>BufferLineMovePrev<CR>', desc = 'Move buffer left' },
|
||||
{ ']B', '<CMD>BufferLineMoveNext<CR>', desc = 'Move buffer right' },
|
||||
},
|
||||
before = function()
|
||||
require('lz.n').trigger_load('mini.icons')
|
||||
end,
|
||||
after = function()
|
||||
require('bufferline').setup({
|
||||
options = {
|
||||
always_show_bufferline = true,
|
||||
|
||||
close_command = function(n)
|
||||
Snacks.bufdelete(n)
|
||||
end,
|
||||
right_mouse_command = function(n)
|
||||
Snacks.bufdelete(n)
|
||||
end,
|
||||
|
||||
diagnostics = 'nvim_lsp',
|
||||
diagnostics_indicator = function(_, _, diag)
|
||||
local icons = require('icons').diagnostics
|
||||
local ret = (diag.error and icons.Error .. diag.error .. ' ' or '')
|
||||
.. (diag.warning and icons.Warn .. diag.warning or '')
|
||||
|
||||
return vim.trim(ret)
|
||||
end,
|
||||
|
||||
offsets = {
|
||||
{
|
||||
filetype = 'neo-tree',
|
||||
text = 'Explorer',
|
||||
highlight = 'Directory',
|
||||
text_align = 'center',
|
||||
},
|
||||
},
|
||||
|
||||
get_element_icon = function(elem)
|
||||
local icon, hl, _ =
|
||||
require('mini.icons').get('filetype', elem.filetype)
|
||||
|
||||
return icon, hl
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufAdd', 'BufDelete' }, {
|
||||
desc = 'Fix bufferline when restoring a session',
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
pcall(nvim_bufferline)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
6
nvim/lua/plugins/ui/init.lua
Normal file
6
nvim/lua/plugins/ui/init.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local req = require('lib.marleyvim').localRequire('plugins.ui')
|
||||
|
||||
return {
|
||||
req('bufferline-nvim'),
|
||||
req('mini-icons'),
|
||||
}
|
20
nvim/lua/plugins/ui/mini-icons.lua
Normal file
20
nvim/lua/plugins/ui/mini-icons.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
'mini.icons',
|
||||
after = function()
|
||||
require('mini.icons').setup({
|
||||
file = {
|
||||
['.keep'] = { glyph = '', hl = 'MiniIconsGrey' },
|
||||
['devcontainer.json'] = { glyph = '', hl = 'MiniIconsAzure' },
|
||||
},
|
||||
filetype = {
|
||||
dotenv = { glyph = '', hl = 'MiniIconsYellow' },
|
||||
},
|
||||
})
|
||||
|
||||
package.preload['nvim-web-devicons'] = function()
|
||||
require('mini.icons').mock_nvim_web_devicons()
|
||||
|
||||
return package.loaded['nvim-web-devicons']
|
||||
end
|
||||
end,
|
||||
}
|
Loading…
Reference in a new issue