Add distinct w (curr buf) / W (all buf) word completion for <c-x>

This commit is contained in:
Delapouite 2017-10-24 22:41:13 +02:00
parent 30ce5a0055
commit d5b6669a83
5 changed files with 21 additions and 7 deletions

View File

@ -1224,8 +1224,9 @@ reached (see `idle_timeout` option). Insert mode completion can be explicitly tr
using `<c-x>`, followed, by:
* *f* : filename completion
* *w* : buffer word completion
* *l* : buffer line completion
* *w* : word completion (current buffer)
* *W* : word completion (all buffers)
* *l* : line completion (current buffer)
Completion candidates can be selected using `<c-n>` and `<c-p>`.

View File

@ -50,7 +50,10 @@ Insert mode
explicit file completion
*w*:::
explicit word completion
explicit word completion (current buffer)
*W*:::
explicit word completion (all buffers)
*l*:::
explicit line completion

View File

@ -1208,12 +1208,15 @@ public:
if (key.key == 'f')
m_completer.explicit_file_complete();
if (key.key == 'w')
m_completer.explicit_word_complete();
m_completer.explicit_word_buffer_complete();
if (key.key == 'W')
m_completer.explicit_word_all_complete();
if (key.key == 'l')
m_completer.explicit_line_complete();
}, "enter completion type",
"f: filename\n"
"w: word\n"
"w: word (current buffer)\n"
"W: word (all buffers)\n"
"l: line\n");
update_completions = false;
}

View File

@ -548,7 +548,13 @@ void InsertCompleter::explicit_file_complete()
m_explicit_completer = complete_filename<false>;
}
void InsertCompleter::explicit_word_complete()
void InsertCompleter::explicit_word_buffer_complete()
{
try_complete(complete_word<false>);
m_explicit_completer = complete_word<false>;
}
void InsertCompleter::explicit_word_all_complete()
{
try_complete(complete_word<true>);
m_explicit_completer = complete_word<true>;

View File

@ -86,7 +86,8 @@ public:
void reset();
void explicit_file_complete();
void explicit_word_complete();
void explicit_word_buffer_complete();
void explicit_word_all_complete();
void explicit_line_complete();
private: