1

Handle files with no extensions

This commit is contained in:
Alex Yatskov 2022-10-03 20:22:04 -07:00
parent 64346078d3
commit b0c825af3a

View File

@ -36,12 +36,13 @@ local function hflip()
local path = vim.api.nvim_buf_get_name(index) local path = vim.api.nvim_buf_get_name(index)
local name, ext = split_ext(path) local name, ext = split_ext(path)
ext = ext:lower() if ext ~= nil then
local ext_lower = ext:lower()
local flip_path local flip_path
if header_exts[ext] then if header_exts[ext_lower] then
flip_path = locate_flip_path(name, source_exts) flip_path = locate_flip_path(name, source_exts)
elseif source_exts[ext] then elseif source_exts[ext_lower] then
flip_path = locate_flip_path(name, header_exts) flip_path = locate_flip_path(name, header_exts)
end end
@ -49,6 +50,7 @@ local function hflip()
vim.cmd(string.format('e %s', flip_path)) vim.cmd(string.format('e %s', flip_path))
end end
end end
end
return { return {
hflip = hflip hflip = hflip