I have 2 ways to open a file for editing:
:b <filename>
to switch to an opened buffer -- imagine that I have a lot of folders containingindex.html
so by using:b
I know I am working on the one that I should be working on.Fuzzy File Search (
:FZF
) just in case I haven't opened the file or I have killed the buffer with:bd
.
My question: Is there a way to automate, such that if :b <filename>
fails (E94: No matching buffer), nvim will call :FZF
and use <filename>
to search?
P.S. It'd be best if I used :b107
and I mistyped the number, FZF
will not be triggered. (distinguishing cases whether I use :b
with string or number)