[filename] avoid new file status for unnamed (#795)

This commit is contained in:
Hongbo Liu 2022-08-09 15:07:55 +08:00 committed by GitHub
parent 03bcf015d1
commit 7b4b864af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -29,7 +29,8 @@ end
local function is_new_file()
local filename = vim.fn.expand('%')
return vim.bo.buftype == '' and vim.fn.filereadable(filename) == 0
return filename ~= '' and vim.bo.buftype == '' and
vim.fn.filereadable(filename) == 0
end
---shortens path by turning apple/orange -> a/orange