neovim-ide/dotfiles/.config/nvim/lua/plugins/ui.lua

286 lines
12 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ── plugins/ui.lua ────────────────────────────────────────────────────────────
return {
-- ── Colorscheme: Kanagawa Wave (desktop) / habamax (mobile) ───────────────
-- kanagawa requires termguicolors which Termius mangles as purple.
-- habamax is built-in, renders cleanly in 256-color (retrobox caused
-- redraw corruption on Termius, habamax does not).
{
"rebelot/kanagawa.nvim",
priority = 1000,
config = function()
if vim.env.MOBILE == "1" then
vim.cmd("colorscheme habamax")
return
end
require("kanagawa").setup({
compile = true,
undercurl = true,
theme = "wave",
background = {
dark = "wave",
light = "lotus",
},
colors = {
theme = {
wave = {
ui = {
bg_gutter = "none",
},
},
},
},
overrides = function(colors)
local theme = colors.theme
return {
Pmenu = { fg = theme.ui.shade0, bg = theme.ui.bg_p1 },
PmenuSbar = { bg = theme.ui.bg_m1 },
PmenuThumb = { bg = theme.ui.bg_p2 },
CursorLine = { bg = theme.ui.bg_p1 },
}
end,
})
vim.cmd("colorscheme kanagawa-wave")
end,
},
-- ── Statusline: lualine ───────────────────────────────────────────────────
-- theme = "auto" derives from active colorscheme — works for both
-- kanagawa (desktop) and habamax (mobile) without hex colors
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("lualine").setup({
options = {
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
globalstatus = true,
},
sections = {
lualine_a = { { "mode", icon = "" } },
lualine_b = {
{ "branch", icon = "" },
{ "diff",
symbols = { added = " ", modified = " ", removed = " " },
},
},
lualine_c = {
{ "filename", path = 1, symbols = { modified = "", readonly = "" } },
},
lualine_x = {
{ "diagnostics",
symbols = { error = " ", warn = " ", info = " ", hint = "󰌵 " },
},
"filetype",
},
lualine_y = { "progress" },
lualine_z = { { "location", icon = "" } },
},
})
end,
},
-- ── Bufferline (desktop only) ─────────────────────────────────────────────
-- Renders truecolor backgrounds for tabs which Termius shows as purple bars.
{
"akinsho/bufferline.nvim",
enabled = function() return vim.env.MOBILE ~= "1" end,
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("bufferline").setup({
options = {
mode = "buffers",
separator_style = "slant",
show_close_icon = false,
show_buffer_close_icons = false,
diagnostics = "nvim_lsp",
diagnostics_indicator = function(_, _, diag)
local icons = { error = " ", warning = " " }
local ret = (diag.error and icons.error .. diag.error .. " " or "")
.. (diag.warning and icons.warning .. diag.warning or "")
return vim.trim(ret)
end,
offsets = {
{ filetype = "oil", text = "File Explorer", separator = true },
},
},
})
end,
},
-- ── File explorer: oil.nvim ───────────────────────────────────────────────
-- Edit the filesystem like a buffer. Very Arch: does one thing, perfectly.
{
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("oil").setup({
default_file_explorer = true,
columns = {
"icon",
"permissions",
"size",
"mtime",
},
view_options = {
show_hidden = true,
},
keymaps = {
["<C-h>"] = false, -- don't hijack window nav
["<C-l>"] = false,
["q"] = "actions.close",
},
})
end,
},
-- ── Fuzzy finder: Telescope ───────────────────────────────────────────────
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
-- Native FZF sorter — faster than the lua one
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
config = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.setup({
defaults = {
prompt_prefix = " ",
selection_caret = "",
-- Kanagawa-inspired layout
layout_strategy = "horizontal",
layout_config = { prompt_position = "top", width = 0.9 },
sorting_strategy = "ascending",
mappings = {
i = {
["<Esc>"] = actions.close,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
},
},
})
telescope.load_extension("fzf")
end,
},
-- ── Which-key ─────────────────────────────────────────────────────────────
{
"folke/which-key.nvim",
event = "VeryLazy",
config = function()
require("which-key").setup({
preset = "modern",
delay = 400,
icons = { separator = "" },
})
end,
},
-- ── Git signs in gutter ───────────────────────────────────────────────────
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "" },
topdelete = { text = "" },
changedelete = { text = "" },
untracked = { text = "" },
},
on_attach = function(buf)
local gs = require("gitsigns")
local m = function(k, fn, d)
vim.keymap.set("n", k, fn, { buffer = buf, desc = d })
end
m("]c", gs.next_hunk, "Next hunk")
m("[c", gs.prev_hunk, "Prev hunk")
m("<leader>hs", gs.stage_hunk, "Stage hunk")
m("<leader>hr", gs.reset_hunk, "Reset hunk")
m("<leader>hp", gs.preview_hunk, "Preview hunk")
m("<leader>hb", gs.blame_line, "Blame line")
end,
})
end,
},
-- ── Indent guides ─────────────────────────────────────────────────────────
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
config = function()
require("ibl").setup({
indent = { char = "" },
scope = { char = "" },
})
-- Link to existing highlight groups instead of hex (mobile-safe)
vim.cmd("hi! link IblIndent Comment")
vim.cmd("hi! link IblScope LineNr")
end,
},
-- ── Dashboard ─────────────────────────────────────────────────────────────
{
"goolord/alpha-nvim",
event = "VimEnter",
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
-- Mobile-friendly ASCII (heavy blocks render as red bars in Termius)
dashboard.section.header.val = {
" ",
" ┌─┐┬─┐┌─┐┬ ┬ ┌┬┐┌─┐┬ ┬ ",
" ├─┤├┬┘│ ├─┤───│││├┤ └┐┌┘ ",
" ┴ ┴┴└─└─┘┴ ┴ ─┴┘└─┘ └┘ ",
" ",
" riced neovim ide · arch linux · v1.7 ",
}
dashboard.section.buttons.val = {
dashboard.button("f", " Find file", "<cmd>Telescope find_files<cr>"),
dashboard.button("r", " Recent files", "<cmd>Telescope oldfiles<cr>"),
dashboard.button("g", " Live grep", "<cmd>Telescope live_grep<cr>"),
dashboard.button("e", " Explorer", "<cmd>Oil<cr>"),
dashboard.button("l", " Lazy", "<cmd>Lazy<cr>"),
dashboard.button("q", " Quit", "<cmd>qa<cr>"),
}
dashboard.section.header.opts.hl = "Comment"
dashboard.section.footer.opts.hl = "NonText"
alpha.setup(dashboard.opts)
end,
},
-- ── Smooth scrolling ──────────────────────────────────────────────────────
{
"karb94/neoscroll.nvim",
config = function()
require("neoscroll").setup({ mappings = { "<C-u>","<C-d>","<C-b>","<C-f>" } })
end,
},
-- ── Color previews inline (desktop only) ──────────────────────────────────
-- Renders hex as RGB which Termius mangles. Skip on mobile.
{
"NvChad/nvim-colorizer.lua",
enabled = function() return vim.env.MOBILE ~= "1" end,
config = function()
require("colorizer").setup({ "*" }, { mode = "virtualtext" })
end,
},
-- Web devicons (used everywhere)
{ "nvim-tree/nvim-web-devicons", lazy = true },
}