From c7f0678ed4f087e8370ba50a04a355e8dd125ba8 Mon Sep 17 00:00:00 2001 From: tracer Date: Wed, 1 Apr 2026 21:03:04 +0200 Subject: [PATCH] Update Neovim UI tutorial config --- nvim/lua/tracer/init.lua | 1 - nvim/lua/tracer/options.lua | 18 ------- nvim/lua/tracer/plugins.lua | 52 ++++++++++++++++++++ nvim/lua/tracer/plugins/lualine.lua | 76 +++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 19 deletions(-) create mode 100644 nvim/lua/tracer/plugins/lualine.lua diff --git a/nvim/lua/tracer/init.lua b/nvim/lua/tracer/init.lua index 0e8e62f..c6e48fd 100644 --- a/nvim/lua/tracer/init.lua +++ b/nvim/lua/tracer/init.lua @@ -1,4 +1,3 @@ require("tracer.options") require("tracer.plugins") pcall(require, "tracer.plugins.telescope") -require("tracer.statusline") diff --git a/nvim/lua/tracer/options.lua b/nvim/lua/tracer/options.lua index b18b8ee..90fb25c 100644 --- a/nvim/lua/tracer/options.lua +++ b/nvim/lua/tracer/options.lua @@ -18,24 +18,6 @@ opt.wildmode = "longest:full,full" opt.title = true opt.signcolumn = 'yes:1' -vim.cmd.colorscheme("slate") - -local normalfloat_hl = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = false }) -if normalfloat_hl.bg then - vim.api.nvim_set_hl(0, "FloatBorder", { - fg = normalfloat_hl.bg, - bg = normalfloat_hl.bg, - }) -end - -local cursorline_hl = vim.api.nvim_get_hl(0, { name = "CursorLine", link = false }) -if cursorline_hl.bg then - vim.api.nvim_set_hl(0, "CursorLineBg", { - fg = cursorline_hl.bg, - bg = cursorline_hl.bg, - }) -end - local autoread_group = vim.api.nvim_create_augroup("tracer_autoread", { clear = true }) vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave", "BufEnter" }, { diff --git a/nvim/lua/tracer/plugins.lua b/nvim/lua/tracer/plugins.lua index 02dfef7..ae50c14 100644 --- a/nvim/lua/tracer/plugins.lua +++ b/nvim/lua/tracer/plugins.lua @@ -44,6 +44,39 @@ require("packer").startup(function(use) use("tpope/vim-sleuth") -- Allow plugins to enable repeating of commands. use("tpope/vim-repeat") + -- One Dark theme. + use({ + "jessarcher/onedark.nvim", + config = function() + vim.cmd.colorscheme("onedark") + + local normalfloat_hl = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = false }) + if normalfloat_hl.bg then + vim.api.nvim_set_hl(0, "FloatBorder", { + fg = normalfloat_hl.bg, + bg = normalfloat_hl.bg, + }) + end + + local cursorline_hl = vim.api.nvim_get_hl(0, { name = "CursorLine", link = false }) + if cursorline_hl.bg then + vim.api.nvim_set_hl(0, "CursorLineBg", { + fg = cursorline_hl.bg, + bg = cursorline_hl.bg, + }) + end + + vim.api.nvim_set_hl(0, "NvimTreeIndentMarker", { fg = "#30323E" }) + + local statusline_hl = vim.api.nvim_get_hl(0, { name = "StatusLine", link = false }) + vim.api.nvim_set_hl(0, "StatusLineNonText", { + fg = "#5C6370", + bg = statusline_hl.bg, + }) + + vim.api.nvim_set_hl(0, "IndentBlanklineChar", { fg = "#2F313C" }) + end, + }) -- Add more languages. use("sheerun/vim-polyglot") -- Navigate seamlessly between Vim windows and Tmux panes. @@ -169,6 +202,25 @@ require("packer").startup(function(use) end, }) + -- A status line. + use({ + "nvim-lualine/lualine.nvim", + requires = "nvim-tree/nvim-web-devicons", + config = function() + require("tracer.plugins.lualine") + end, + }) + + -- Display buffers as tabs. + use({ + "akinsho/bufferline.nvim", + requires = "nvim-tree/nvim-web-devicons", + after = "onedark.nvim", + config = function() + require("bufferline").setup() + end, + }) + -- File tree sidebar for project-style navigation. use({ "nvim-tree/nvim-tree.lua", diff --git a/nvim/lua/tracer/plugins/lualine.lua b/nvim/lua/tracer/plugins/lualine.lua new file mode 100644 index 0000000..1c2edbd --- /dev/null +++ b/nvim/lua/tracer/plugins/lualine.lua @@ -0,0 +1,76 @@ +local separator = { + "|", + color = "StatusLineNonText", +} + +local non_text_hl = vim.api.nvim_get_hl(0, { name = "NonText" }) +local statusline_hl = vim.api.nvim_get_hl(0, { name = "StatusLine" }) + +vim.api.nvim_set_hl(0, "StatusLineNonText", { + fg = non_text_hl.fg, + bg = statusline_hl.bg, +}) + +local function lsp_clients() + local clients = vim.lsp.get_clients({ bufnr = 0 }) + + if #clients == 0 then + return "" + end + + local names = {} + + for _, client in ipairs(clients) do + names[#names + 1] = client.name + end + + return "LSP: " .. table.concat(names, ", ") +end + +require("lualine").setup({ + options = { + section_separators = '', + component_separators = "", + globalstatus = true, + theme = { + normal = { + a = "StatusLine", + b = "StatusLine", + c = "StatusLine", + }, + }, + }, + sections = { + lualine_a = { + "mode", + separator, + }, + lualine_b = { + "branch", + "diff", + separator, + lsp_clients, + { "diagnostics", sources = { "nvim_diagnostic" } }, + separator, + }, + lualine_c = { + "filename", + }, + lualine_x = { + "filetype", + "encoding", + "fileformat", + }, + lualine_y = { + separator, + function() + return (vim.bo.expandtab and "s" or "t") .. " • " .. vim.bo.shiftwidth + end, + separator, + }, + lualine_z = { + "location", + "progress", + }, + }, +})