aboutsummaryrefslogtreecommitdiff
path: root/lua/minitab
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2024-11-27 23:30:04 -0600
committerTim Keller <tjkeller.xyz>2024-11-27 23:30:04 -0600
commit222a35646d3cecac905c248ff7786b3c4dff764e (patch)
treef834b5266332b59635311edc3764e4f3aa2c2875 /lua/minitab
parenta02c093408f78de0f864dbef565fe6b348f25916 (diff)
downloadminitab.nvim-222a35646d3cecac905c248ff7786b3c4dff764e.tar.xz
minitab.nvim-222a35646d3cecac905c248ff7786b3c4dff764e.zip
modulenames
Diffstat (limited to 'lua/minitab')
-rw-r--r--lua/minitab/init.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/lua/minitab/init.lua b/lua/minitab/init.lua
index 0504d42..1ef909c 100644
--- a/lua/minitab/init.lua
+++ b/lua/minitab/init.lua
@@ -1,14 +1,15 @@
-local M = {}
+local M = {
+ moduleNames = { 'init.lua', '__init__.py', }
+}
M.fileTitle = function(file)
file = vim.fn.fnamemodify(file, ':p:~')
local tail = vim.fn.fnamemodify(file, ':t')
- if not tail then
- return vim.fn.fnamemodify(file, ':p:~:h') .. '/' -- e.g. ~/dir/
- elseif tail == 'init.lua'
- or tail == '__init__.py' then
- return vim.fn.fnamemodify(vim.fn.fnamemodify(file, ':h'), ':t') .. '/' .. tail -- e.g. luatab/init.lua
+ if tail == '' then
+ return vim.fn.fnamemodify(file, ':p:~') -- netrw; e.g. ~/dir/
+ elseif vim.tbl_contains(M.moduleNames, tail) then
+ return vim.fn.fnamemodify(vim.fn.fnamemodify(file, ':h'), ':t') .. '/' .. tail -- e.g. minitab/init.lua
else
return tail
end