Implement custom tabline with configurable path shortening

Add a custom tabline function to enhance path display in Neovim.
Users can configure the number of full parent directories and the
length of shortened directory names for better context and
manageability.
This commit is contained in:
Ray Elliott 2026-01-12 22:08:43 +00:00
commit 87ea788dee
5 changed files with 147 additions and 0 deletions

View file

@ -16,6 +16,26 @@ vim.opt.autochdir = false -- Keep working directory at project root
vim.opt.exrc = true -- Load .nvim.lua from project root
vim.opt.secure = true -- Prompt before loading untrusted files
-- Custom tabline configuration
-- Load utils module for custom tabline function
local utils = require('utils')
-- Configure number of parent directories to show in full (default: 1)
-- Examples:
-- 1: /path/to/my/project/src/file.txt → pat/to/my/project/src/file.txt
-- 2: /path/to/my/project/src/file.txt → pat/to/my/project/src/file.txt
utils.tabline_full_parents = 1
-- Configure number of characters to show for shortened directories (default: 3)
-- Examples:
-- 3: /path/to/my → pat/to/my
-- 1: /path/to/my → p/t/m
utils.tabline_shorten_length = 4
-- Use custom tabline function
vim.opt.tabline = '%!v:lua.require("utils").custom_tabline()'
vim.opt.showtabline = 1 -- Show tabline only when there are 2+ tabs
-- Phase 3.2: non-plugin settings (legacy values where specified)
-- Completion UI for nvim-cmp
vim.opt.completeopt = { "menu", "menuone", "noselect" }