diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-11-29 20:09:37 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-11-29 20:09:37 +0100 |
| commit | 956ac60d4ac1048ca8a5713c9ccc90941288aff0 (patch) | |
| tree | eb7a71bc4eaef5e77b778157de331df4c243cd71 /src/completion.cc | |
| parent | 33482b097969aa5886afe4adc079474c0a91ca10 (diff) | |
add an ignored_files regex option whose matches are not used for completion
Diffstat (limited to 'src/completion.cc')
| -rw-r--r-- | src/completion.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/completion.cc b/src/completion.cc index da5e1387..793b67b2 100644 --- a/src/completion.cc +++ b/src/completion.cc @@ -3,10 +3,13 @@ #include "buffer_manager.hh" #include "utils.hh" #include "file.hh" +#include "context.hh" #include <dirent.h> #include <algorithm> +#include <boost/regex.hpp> + namespace Kakoune { @@ -19,6 +22,11 @@ CandidateList complete_filename(const Context& context, String dirprefix; String fileprefix = real_prefix; + String ignored_files = context.options()["ignored_files"].as_string(); + boost::regex ignored_files_regex; + if (not ignored_files.empty()) + ignored_files_regex = boost::regex(ignored_files.c_str()); + ByteCount dir_end = -1; for (ByteCount i = 0; i < real_prefix.length(); ++i) { @@ -45,6 +53,10 @@ CandidateList complete_filename(const Context& context, if (filename.empty()) continue; + if (not ignored_files.empty() and + boost::regex_match(filename.c_str(), ignored_files_regex)) + continue; + if (filename.substr(0, fileprefix.length()) == fileprefix) { String name = dirprefix + filename; |
