native #1

Merged
lucy merged 15 commits from native into master 2026-06-01 12:02:39 +00:00
Showing only changes of commit bda58fea24 - Show all commits

replace bufferline with lualine

lucy 2026-04-13 10:45:05 +02:00

367
init.lua
View file

@ -18,122 +18,111 @@ opt.winborder = "single"
opt.shiftwidth = 8 opt.shiftwidth = 8
vim.diagnostic.config({ vim.diagnostic.config({
virtual_text = { virtual_text = {
spacing = 4, spacing = 4,
source = true, source = true,
}, },
}) })
-- add plugins -- add plugins
vim.pack.add({ vim.pack.add({
"https://github.com/folke/snacks.nvim", "https://github.com/folke/snacks.nvim",
"https://github.com/nvim-lualine/lualine.nvim", "https://github.com/nvim-lualine/lualine.nvim",
"https://github.com/tinted-theming/tinted-vim", "https://github.com/tinted-theming/tinted-vim",
"https://github.com/akinsho/bufferline.nvim", "https://github.com/nvimdev/lspsaga.nvim",
"https://github.com/nvimdev/lspsaga.nvim", "https://github.com/neovim/nvim-lspconfig",
"https://github.com/neovim/nvim-lspconfig", "https://github.com/nvim-treesitter/nvim-treesitter",
"https://github.com/nvim-treesitter/nvim-treesitter", "https://github.com/vyfor/cord.nvim",
"https://github.com/vyfor/cord.nvim", "https://github.com/mason-org/mason-lspconfig.nvim.git",
"https://github.com/mason-org/mason-lspconfig.nvim.git", "https://github.com/mason-org/mason.nvim.git",
"https://github.com/mason-org/mason.nvim.git", { src = "https://github.com/Saghen/blink.cmp", version = "v1" },
{ src = "https://github.com/Saghen/blink.cmp", version = "v1" },
}) })
-- function to set colorsceme -- function to set colorsceme
local default_theme = "base16-oceanicnext" local default_theme = "base16-oceanicnext"
local function get_tinty_theme() local function get_tinty_theme()
local theme_name = vim.fn.system("cat /home/lucy/.local/share/tinted-theming/tinty/current_scheme") local theme_name = vim.fn.system("cat /home/lucy/.local/share/tinted-theming/tinty/current_scheme")
if vim.v.shell_error ~= 0 then if vim.v.shell_error ~= 0 then
return default_theme return default_theme
else else
return vim.trim(theme_name) return vim.trim(theme_name)
end end
end end
vim.cmd("colorscheme " .. get_tinty_theme()) vim.cmd("colorscheme " .. get_tinty_theme())
-- set up qmlls to point to the right binary -- set up qmlls to point to the right binary
vim.lsp.config("qmlls", { vim.lsp.config("qmlls", {
cmd = { "qmlls6" }, cmd = { "qmlls6" },
}) })
require("blink.cmp").setup({ require("blink.cmp").setup({
fuzzy = { implementation = "prefer_rust_with_warning" }, fuzzy = { implementation = "prefer_rust_with_warning" },
completion = { completion = {
menu = { menu = {
auto_show = false, auto_show = false,
}, },
}, },
sources = { sources = {
default = { "lsp", "path", "snippets", "buffer" }, default = { "lsp", "path", "snippets", "buffer" },
}, },
}) })
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup() require("mason-lspconfig").setup()
require("bufferline").setup({
options = {
themable = true,
numbers = "ordinal",
indicator = {
icon = "",
style = "underline",
},
},
})
require("snacks").setup({ require("snacks").setup({
notifier = { enabled = true }, notifier = { enabled = true },
statuscolumn = { enabled = true }, statuscolumn = { enabled = true },
picker = {}, picker = {},
dashboard = { dashboard = {
enabled = true, enabled = true,
width = 60, width = 60,
row = nil, -- dashboard position. nil for center row = nil, -- dashboard position. nil for center
col = nil, -- dashboard position. nil for center col = nil, -- dashboard position. nil for center
pane_gap = 4, -- empty columns between vertical panes pane_gap = 4, -- empty columns between vertical panes
autokeys = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -- autokey sequence autokeys = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -- autokey sequence
-- These settings are used by some built-in sections -- These settings are used by some built-in sections
preset = { preset = {
-- Defaults to a picker that supports `fzf-lua`, `telescope.nvim` and `mini.pick` -- Defaults to a picker that supports `fzf-lua`, `telescope.nvim` and `mini.pick`
---@type fun(cmd:string, opts:table)|nil ---@type fun(cmd:string, opts:table)|nil
pick = nil, pick = nil,
-- Used by the `keys` section to show keymaps. -- Used by the `keys` section to show keymaps.
-- Set your custom keymaps here. -- Set your custom keymaps here.
-- When using a function, the `items` argument are the default keymaps. -- When using a function, the `items` argument are the default keymaps.
---@type snacks.dashboard.Item[] ---@type snacks.dashboard.Item[]
keys = { keys = {
{ {
icon = "", icon = "",
key = "f", key = "f",
desc = "Find File", desc = "Find File",
action = ":lua Snacks.dashboard.pick('files')", action = ":lua Snacks.dashboard.pick('files')",
}, },
{ icon = "", key = "n", desc = "New File", action = ":ene | startinsert" }, { icon = "", key = "n", desc = "New File", action = ":ene | startinsert" },
{ {
icon = "", icon = "",
key = "g", key = "g",
desc = "Find Text", desc = "Find Text",
action = ":lua Snacks.dashboard.pick('live_grep')", action = ":lua Snacks.dashboard.pick('live_grep')",
}, },
{ {
icon = "", icon = "",
key = "r", key = "r",
desc = "Recent Files", desc = "Recent Files",
action = ":lua Snacks.dashboard.pick('oldfiles')", action = ":lua Snacks.dashboard.pick('oldfiles')",
}, },
{ {
icon = "", icon = "",
key = "c", key = "c",
desc = "Config", desc = "Config",
action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})",
}, },
{ icon = "", key = "s", desc = "Restore Session", section = "session" }, { icon = "", key = "s", desc = "Restore Session", section = "session" },
{ {
icon = "󰒲 ", icon = "󰒲 ",
key = "L", key = "L",
desc = "Lazy", desc = "Lazy",
action = ":Lazy", action = ":Lazy",
enabled = package.loaded.lazy ~= nil, enabled = package.loaded.lazy ~= nil,
}, },
{ icon = "", key = "q", desc = "Quit", action = ":qa" }, { icon = "", key = "q", desc = "Quit", action = ":qa" },
}, },
-- Used by the `header` section -- Used by the `header` section
header = [[ header = [[
⠀⠀⠀⠀⠀⠀⣠⡤⠶⠒⠛⠉⠙⠛⠒⠶⢤⣀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⣠⡤⠶⠒⠛⠉⠙⠛⠒⠶⢤⣀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠈⠙⢦⡀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠁⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠈⠙⢦⡀⠀⠀⠀
⠀⠀⠀⠀⣀⣠⠤⠤⡴⠻⢓⣶⠦⠤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀ ⠀⠀⠀⠀⣀⣠⠤⠤⡴⠻⢓⣶⠦⠤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀
@ -145,79 +134,91 @@ require("snacks").setup({
⠀⠀⢠⢿⣠⠟⠓⠛⠉⠛⡟⠛⠛⠛⠛⠒⠒⠚⠉⠉⠁⠀⠀⠀⠀⠀⢀⡴⠋⠀ ⠀⠀⢠⢿⣠⠟⠓⠛⠉⠛⡟⠛⠛⠛⠛⠒⠒⠚⠉⠉⠁⠀⠀⠀⠀⠀⢀⡴⠋⠀
⠀⠀⠈⠛⢯⣀⣀⣀⡤⠤⠤⠤⢤⣤⣀⣀⣀⣀⣀⣀⣀⣤⠤⠴⠒⠋⠁⠀⠀⠀ ⠀⠀⠈⠛⢯⣀⣀⣀⡤⠤⠤⠤⢤⣤⣀⣀⣀⣀⣀⣀⣀⣤⠤⠴⠒⠋⠁⠀⠀⠀
]], ]],
}, },
-- item field formatters -- item field formatters
formats = { formats = {
icon = function(item) icon = function(item)
if item.file and item.icon == "file" or item.icon == "directory" then if item.file and item.icon == "file" or item.icon == "directory" then
return Snacks.dashboard.icon(item.file, item.icon) return Snacks.dashboard.icon(item.file, item.icon)
end end
return { item.icon, width = 2, hl = "icon" } return { item.icon, width = 2, hl = "icon" }
end, end,
footer = { "%s", align = "center" }, footer = { "%s", align = "center" },
header = { "%s", align = "center" }, header = { "%s", align = "center" },
file = function(item, ctx) file = function(item, ctx)
local fname = vim.fn.fnamemodify(item.file, ":~") local fname = vim.fn.fnamemodify(item.file, ":~")
fname = ctx.width and #fname > ctx.width and vim.fn.pathshorten(fname) or fname fname = ctx.width and #fname > ctx.width and vim.fn.pathshorten(fname) or fname
if #fname > ctx.width then if #fname > ctx.width then
local dir = vim.fn.fnamemodify(fname, ":h") local dir = vim.fn.fnamemodify(fname, ":h")
local file = vim.fn.fnamemodify(fname, ":t") local file = vim.fn.fnamemodify(fname, ":t")
if dir and file then if dir and file then
file = file:sub(-(ctx.width - #dir - 2)) file = file:sub(-(ctx.width - #dir - 2))
fname = dir .. "/…" .. file fname = dir .. "/…" .. file
end end
end end
local dir, file = fname:match("^(.*)/(.+)$") local dir, file = fname:match("^(.*)/(.+)$")
return dir and { { dir .. "/", hl = "dir" }, { file, hl = "file" } } or { { fname, hl = "file" } } return dir and { { dir .. "/", hl = "dir" }, { file, hl = "file" } } or
end, { { fname, hl = "file" } }
}, end,
sections = { },
{ section = "header" }, sections = {
{ section = "keys", gap = 1, padding = 1 }, { section = "header" },
}, { section = "keys", gap = 1, padding = 1 },
}, },
},
}) })
require("lspsaga").setup({ require("lspsaga").setup({
symbol_in_winbar = { enable = true }, symbol_in_winbar = { enable = true },
lightbulb = { lightbulb = {
enable = true, enable = true,
sign = false, sign = false,
}, },
hover = { hover = {
max_width = 0.6, max_width = 0.6,
open_link = "gx", open_link = "gx",
open_browser = "!google-chrome", open_browser = "!google-chrome",
}, },
}) })
require("cord").setup({ require("cord").setup({
display = { display = {
theme = "atom", theme = "atom",
}, },
editor = { tooltip = "ur gay x3" }, editor = { tooltip = "ur gay x3" },
}) })
require("lualine").setup({ require("lualine").setup({
options = { options = {
section_separators = { left = "", right = "" }, section_separators = { left = "", right = "" },
component_separators = { left = "|", right = "|" }, component_separators = { left = "|", right = "|" },
}, globalstatus = true,
sections = { always_divide_middle = true,
lualine_a = { "mode" }, },
lualine_b = { "diagnostics" }, sections = {
lualine_c = { "filename", "branch", "navic" }, lualine_a = { "mode" },
lualine_x = { "lsp_status", "filetype", "filesize" }, lualine_b = { "diagnostics" },
lualine_y = { "" }, lualine_c = { "filename", "filesize", },
lualine_z = { "location" }, lualine_x = { "lsp_status", "filetype" },
}, lualine_y = { "" },
lualine_z = { "location" },
},
tabline = {
lualine_a = { { 'buffers', mode = 2, show_modified_status = true, } },
lualine_b = { 'branch' },
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { 'tabs' }
}
}) })
-- keymaps -- keymaps
local map = vim.keymap.set local map = vim.keymap.set
map("n", "<leader>ff", function() map("n", "<leader>ff", function()
Snacks.picker.files() Snacks.picker.files()
end) end)
map("n", "<leader>lg", function() map("n", "<leader>lg", function()
Snacks.picker.grep() Snacks.picker.grep()
end) end)
map("n", "<C-h>", "<C-w>h") map("n", "<C-h>", "<C-w>h")
@ -234,19 +235,19 @@ map("n", "go", "<cmd> Lspsaga goto_definition<cr>")
map("n", "gr", "<cmd> Lspsaga finder<cr>") map("n", "gr", "<cmd> Lspsaga finder<cr>")
map("n", "<leader>qf", "<cmd> Lspsaga code_action<cr>") map("n", "<leader>qf", "<cmd> Lspsaga code_action<cr>")
map("n", "<C-f>", function() map("n", "<C-f>", function()
vim.lsp.buf.format() vim.lsp.buf.format()
end) end)
-- bufferline keybinds -- buffer keybinds
map("n", "<A-1>", "<cmd> BufferLineGoToBuffer 1 <cr>") map("n", "<A-1>", "<cmd> LualineBuffersJump! 1 <cr>")
map("n", "<A-2>", "<cmd> BufferLineGoToBuffer 2 <cr>") map("n", "<A-2>", "<cmd> LualineBuffersJump! 2 <cr>")
map("n", "<A-3>", "<cmd> BufferLineGoToBuffer 3 <cr>") map("n", "<A-3>", "<cmd> LualineBuffersJump! 3 <cr>")
map("n", "<A-4>", "<cmd> BufferLineGoToBuffer 4 <cr>") map("n", "<A-4>", "<cmd> LualineBuffersJump! 4 <cr>")
map("n", "<A-5>", "<cmd> BufferLineGoToBuffer 5 <cr>") map("n", "<A-5>", "<cmd> LualineBuffersJump! 5 <cr>")
map("n", "<A-6>", "<cmd> BufferLineGoToBuffer 6 <cr>") map("n", "<A-6>", "<cmd> LualineBuffersJump! 6 <cr>")
map("n", "<A-7>", "<cmd> BufferLineGoToBuffer 7 <cr>") map("n", "<A-7>", "<cmd> LualineBuffersJump! 7 <cr>")
map("n", "<A-8>", "<cmd> BufferLineGoToBuffer 8 <cr>") map("n", "<A-8>", "<cmd> LualineBuffersJump! 8 <cr>")
map("n", "<A-9>", "<cmd> BufferLineGoToBuffer 9 <cr>") map("n", "<A-9>", "<cmd> LualineBuffersJump! 9 <cr>")
map("n", "<A-0>", "<cmd> BufferLineGoToBuffer last <cr>") map("n", "<A-0>", "<cmd> LualineBuffersJump! last <cr>")
map("n", "<leader>w", "<cmd> bdelete! <cr>") map("n", "<leader>w", "<cmd> bdelete! <cr>")
-- util keybinds -- util keybinds
@ -258,26 +259,26 @@ map("i", "<C-space>", vim.lsp.completion.get, { desc = "trigger autocompletion"
-- tinty function -- tinty function
local function handle_focus_gained() local function handle_focus_gained()
local new_theme_name = get_tinty_theme() local new_theme_name = get_tinty_theme()
local current_theme_name = vim.g.colors_name local current_theme_name = vim.g.colors_name
if current_theme_name ~= new_theme_name then if current_theme_name ~= new_theme_name then
vim.cmd("colorscheme " .. new_theme_name) vim.cmd("colorscheme " .. new_theme_name)
require("lualine").setup() require("lualine").setup()
end end
require("lualine").setup() require("lualine").setup()
end end
local function main() local function main()
vim.o.termguicolors = true vim.o.termguicolors = true
vim.g.tinted_colorspace = 256 vim.g.tinted_colorspace = 256
local current_theme_name = get_tinty_theme() local current_theme_name = get_tinty_theme()
vim.cmd("colorscheme " .. current_theme_name) vim.cmd("colorscheme " .. current_theme_name)
vim.api.nvim_create_autocmd("FocusGained", { vim.api.nvim_create_autocmd("FocusGained", {
callback = handle_focus_gained, callback = handle_focus_gained,
}) })
end end
main() main()