Support ~/ in insert mode filename completion

This commit is contained in:
Maxime Coste 2016-03-14 13:59:54 +00:00
parent 7ecd65e1af
commit b53f1271a2

View File

@ -178,6 +178,9 @@ InsertCompletion complete_filename(const Buffer& buffer, ByteCoord cursor_pos,
while (begin != buffer.begin() and is_filename(*(begin-1))) while (begin != buffer.begin() and is_filename(*(begin-1)))
--begin; --begin;
if (begin != buffer.begin() and *begin == '/' and *(begin-1) == '~')
--begin;
if (begin == pos) if (begin == pos)
return {}; return {};
@ -186,7 +189,7 @@ InsertCompletion complete_filename(const Buffer& buffer, ByteCoord cursor_pos,
return {}; return {};
InsertCompletion::CandidateList candidates; InsertCompletion::CandidateList candidates;
if (prefix.front() == '/') if (prefix.front() == '/' or prefix.front() == '~')
{ {
for (auto& filename : Kakoune::complete_filename(prefix, Regex{})) for (auto& filename : Kakoune::complete_filename(prefix, Regex{}))
candidates.push_back({ filename, "", filename }); candidates.push_back({ filename, "", filename });