I'm currently running OS X and I'm using filetype * open in the settings to tell vifm to open all the filetypes that have not been explicitly defined in the settings to open with the default program. This a flexible solution, because I don't have to manually enter every single type of file there is and just use what OS X uses by default. The only problem is that I want to open files without extensions with vi, as they are almost always text files in my case. Is there a way of having the best of both worlds?
filetype * open
You need to use regular expression patterns for this, they should be specified in slashes. Either explicitly set how to handle files with a dot with vim:
filetype /^[^.]+$/ vim
filetype * open
or use open only for files with dots:
filetype /\\./ open
and a variant that takes hidden files into account:
filetype /[^.].*\\.|^\\..*\\./ open
But they are not always dot files.
Not sure I follow, extension is something that is separated from name part by a dot. So files with a dot are those that have extension (except if they just start with a dot), and files without extension don't have any dot (again, excluding possibly leading dot). Maybe just provide an example where you think above commands won't work as expected.
Oh! My bad. In my first message, by "exceptions" I meant "extensions". Some files have no extension (sometext, as opposed to sometext.txt).
I'd like to open these files with vi, but keep opening files with extensions that are undefined in vimrc with OS X's open.
The problem is that this Regex: filetype * open matches extension-less files too.
I didn't even notice the typo before. Everything is right then. filetype * open uses globs, which are not capable of specifying files without extensions.
uses open only for files that has dot, e.g. file.ext as well as for .file, while
will use open for .file.ext and file.ext, but not for .file.
The rest of files will be opened according to 'vicmd' option.
Much better ! Thanks.