nvim: add psoxizsh.plugins.ui
This commit is contained in:
parent
1613c7b94d
commit
ecb1bc2965
|
@ -1,19 +0,0 @@
|
|||
return function()
|
||||
local bl, key, util = require 'bufferline', require 'psoxizsh.key.map', require 'psoxizsh.util'
|
||||
|
||||
local defaults = {
|
||||
always_show_bufferline = true,
|
||||
numbers = 'none',
|
||||
diagnostics = false,
|
||||
offsets = {{
|
||||
filetype = 'neo-tree',
|
||||
text = 'File Explorer',
|
||||
text_align = 'center'
|
||||
}},
|
||||
show_buffer_close_icons = false,
|
||||
separator_style = 'slope',
|
||||
sort_by = 'relative_directory',
|
||||
}
|
||||
|
||||
bl.setup(util.mconfig('config.bufferline', { options = defaults }))
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
return function()
|
||||
local dressing, util = require 'dressing', require 'psoxizsh.util'
|
||||
local K = require('psoxizsh.key.map').Plugin.Dressing
|
||||
|
||||
local defaults = {
|
||||
input = {
|
||||
default_prompt = '<|>',
|
||||
|
||||
mappings = { i = {
|
||||
[K.Input.Close.key] = 'Close',
|
||||
[K.Input.Confirm.key] = 'Confirm',
|
||||
[K.Input.Prev.key] = 'HistoryPrev',
|
||||
[K.Input.Next.key] = 'HistoryNext',
|
||||
}},
|
||||
},
|
||||
|
||||
select = {
|
||||
backend = { 'telescope', 'builtin' }
|
||||
},
|
||||
}
|
||||
|
||||
dressing.setup(util.mconfig('config.dressing', defaults))
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
return function()
|
||||
local fidget, util = require 'fidget', require 'psoxizsh.util'
|
||||
|
||||
local defaults = {
|
||||
progress = {
|
||||
display = {
|
||||
progress_icon = {
|
||||
pattern = "dots_snake",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
notification = {
|
||||
view = {
|
||||
stack_upwards = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fidget.setup(util.mconfig('config.fidget', defaults))
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
return function()
|
||||
local gitsigns, util = require 'gitsigns', require 'psoxizsh.util'
|
||||
|
||||
local defaults = {
|
||||
sign_priority = 100,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol',
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
},
|
||||
}
|
||||
|
||||
gitsigns.setup(util.mconfig('config.gitsigns', defaults))
|
||||
end
|
|
@ -1,65 +0,0 @@
|
|||
return function()
|
||||
local ll, util, nwd = require 'lualine', require 'psoxizsh.util', require("nvim-web-devicons")
|
||||
|
||||
local file_color = function()
|
||||
local _, color = nwd.get_icon_colors_by_filetype(vim.bo.filetype)
|
||||
|
||||
return { fg = color }
|
||||
end
|
||||
local diff_source = function()
|
||||
-- May be nil if gitsigns hasn't populated yet
|
||||
local gs = vim.b.gitsigns_status_dict or {}
|
||||
|
||||
return {
|
||||
added = gs.added,
|
||||
modified = gs.changed,
|
||||
removed = gs.removed,
|
||||
}
|
||||
end
|
||||
|
||||
local filename = {
|
||||
'filename',
|
||||
icon = 'ƒ',
|
||||
symbols = { modified = '|', readonly = '|', unnamed = '〜' },
|
||||
color = file_color,
|
||||
}
|
||||
local branch = { 'b:gitsigns_head', icon = '', color = { gui = 'bold' } }
|
||||
local diagnostics = { 'diagnostics', sources = { 'nvim_diagnostic' }, update_in_insert = true }
|
||||
local diff = { 'diff', source = diff_source }
|
||||
|
||||
local defaults = {
|
||||
options = {
|
||||
theme = 'auto',
|
||||
icons_enabled = true,
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = true,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { branch, diff, diagnostics },
|
||||
lualine_c = { filename },
|
||||
lualine_x = {'filetype', 'encoding', 'fileformat'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { filename },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
extensions = { 'fugitive', 'quickfix', 'man', 'fzf', 'neo-tree', 'toggleterm' }
|
||||
}
|
||||
|
||||
ll.setup(util.mconfig('config.lualine', defaults))
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
return function()
|
||||
local notify, util = require 'notify', require 'psoxizsh.util'
|
||||
local loaded = _G._psoxizsh_plug_config_notify_loaded
|
||||
|
||||
local defaults = {
|
||||
background_colour = "#000000",
|
||||
timeout = 2000,
|
||||
top_down = false,
|
||||
}
|
||||
|
||||
notify.setup(util.mconfig('config.notify', defaults))
|
||||
|
||||
-- Set notify as the default Neovim notification service
|
||||
-- However, weird stuff happens if we set this multiple times
|
||||
-- so guard against that
|
||||
if not loaded then
|
||||
vim.notify = notify
|
||||
_G._psoxizsh_plug_config_notify_loaded = true
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,101 @@
|
|||
-- NeoVim UI elements
|
||||
--
|
||||
-- These are constant features of your window, plus any pop-in elements, like
|
||||
-- vim.notify, vim.ui, or virtual text handlers
|
||||
|
||||
local logo = string.rep('\n', 8) .. [[
|
||||
██████╗ ███████╗ ██████╗ ██╗ ██╗██╗███████╗███████╗██╗ ██╗
|
||||
██╔══██╗██╔════╝██╔═══██╗╚██╗██╔╝██║╚══███╔╝██╔════╝██║ ██║
|
||||
██████╔╝███████╗██║ ██║ ╚███╔╝ ██║ ███╔╝ ███████╗███████║
|
||||
██╔═══╝ ╚════██║██║ ██║ ██╔██╗ ██║ ███╔╝ ╚════██║██╔══██║
|
||||
██║ ███████║╚██████╔╝██╔╝ ██╗██║███████╗███████║██║ ██║
|
||||
╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
|
||||
]] .. '\n\n'
|
||||
|
||||
return {
|
||||
-- Setting our logo for empty `nvim` loads
|
||||
{ 'nvimdev/dashboard-nvim',
|
||||
opts = function(_, opts)
|
||||
opts.config = opts.config or {}
|
||||
|
||||
opts.config.header = vim.split(logo, '\n')
|
||||
end
|
||||
},
|
||||
|
||||
-- vim.notify handler
|
||||
{ 'rcarriga/nvim-notify', version = '^3.0.0' },
|
||||
|
||||
-- Bottom line integrations
|
||||
{ 'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
{ 'kyazdani42/nvim-web-devicons', version = false },
|
||||
{ 'lewis6991/gitsigns.nvim' },
|
||||
},
|
||||
|
||||
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/ui.lua#L96
|
||||
opts = {
|
||||
extensions = { 'fugitive', 'quickfix', 'man', 'fzf', 'neo-tree', 'toggleterm' }
|
||||
},
|
||||
},
|
||||
|
||||
-- Top line plugin
|
||||
{ 'akinsho/bufferline.nvim',
|
||||
version = '^4.0.0',
|
||||
dependencies = { { 'kyazdani42/nvim-web-devicons', version = false } },
|
||||
|
||||
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/ui.lua#L39
|
||||
opts = {
|
||||
options = {
|
||||
numbers = 'none',
|
||||
diagnostics = false,
|
||||
always_show_bufferline = true,
|
||||
show_buffer_close_icons = false,
|
||||
separator_style = 'slope',
|
||||
sort_by = 'relative_directory',
|
||||
},
|
||||
},
|
||||
keys = function()
|
||||
return {
|
||||
{ '<TAB>' , '<cmd>BufferLineCycleNext<CR>' , desc = "Next Buffer" },
|
||||
{ '<S-TAB>' , '<cmd>BufferLineCyclePrev<CR>' , desc = "Prev Buffer" },
|
||||
}
|
||||
end
|
||||
},
|
||||
|
||||
-- Git integration
|
||||
{ 'lewis6991/gitsigns.nvim',
|
||||
commit = 'd44a7948ffc717af578c424add818b7684c7ed68',
|
||||
requires = { { 'nvim-lua/plenary.nvim', version = false } },
|
||||
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/editor.lua#L247
|
||||
opts = {
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol',
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- vim.ui.input & vim.ui.select handler
|
||||
{ 'stevearc/dressing.nvim',
|
||||
name = 'dressing',
|
||||
branch = 'master',
|
||||
opts = {
|
||||
input = {
|
||||
default_prompt = '<|>',
|
||||
|
||||
mappings = { i = {
|
||||
['<ESC>'] = 'Close',
|
||||
['<CR>'] = 'Confirm',
|
||||
['<Up>'] = 'HistoryPrev',
|
||||
['<Down>'] = 'HistoryNext',
|
||||
}},
|
||||
},
|
||||
|
||||
select = { backend = { 'telescope', 'builtin' } },
|
||||
},
|
||||
},
|
||||
|
||||
}
|
Loading…
Reference in New Issue