aboutsummaryrefslogtreecommitdiff
path: root/lua/minitab/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/minitab/init.lua')
-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