From b53f1271a227719b5b4bf7bff33cb5ce04892214 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 14 Mar 2016 13:59:54 +0000 Subject: [PATCH] Support ~/ in insert mode filename completion --- src/insert_completer.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 5fa34c72..961ae14d 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -178,6 +178,9 @@ InsertCompletion complete_filename(const Buffer& buffer, ByteCoord cursor_pos, while (begin != buffer.begin() and is_filename(*(begin-1))) --begin; + if (begin != buffer.begin() and *begin == '/' and *(begin-1) == '~') + --begin; + if (begin == pos) return {}; @@ -186,7 +189,7 @@ InsertCompletion complete_filename(const Buffer& buffer, ByteCoord cursor_pos, return {}; InsertCompletion::CandidateList candidates; - if (prefix.front() == '/') + if (prefix.front() == '/' or prefix.front() == '~') { for (auto& filename : Kakoune::complete_filename(prefix, Regex{})) candidates.push_back({ filename, "", filename });