add an ignored_files regex option whose matches are not used for completion
This commit is contained in:
parent
33482b0979
commit
956ac60d4a
|
@ -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;
|
||||
|
|
|
@ -98,6 +98,7 @@ GlobalOptions::GlobalOptions()
|
|||
set_option("eolformat", Option("lf"));
|
||||
set_option("BOM", Option("no"));
|
||||
set_option("complete_prefix", Option(1));
|
||||
set_option("ignored_files", Option(R"(^(\..*|.*\.(o|so|a))$)"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user