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: using `<c-x>`, followed, by:
* *f* : filename completion * *f* : filename completion
* *w* : buffer word completion * *w* : word completion (current buffer)
* *l* : buffer line completion * *W* : word completion (all buffers)
* *l* : line completion (current buffer)
Completion candidates can be selected using `<c-n>` and `<c-p>`. Completion candidates can be selected using `<c-n>` and `<c-p>`.

View File

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

View File

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

View File

@ -548,7 +548,13 @@ void InsertCompleter::explicit_file_complete()
m_explicit_completer = complete_filename<false>; 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>); try_complete(complete_word<true>);
m_explicit_completer = complete_word<true>; m_explicit_completer = complete_word<true>;

View File

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