From d5b6669a837ce1a28dd8fe9c86e6ab9bf643172c Mon Sep 17 00:00:00 2001 From: Delapouite Date: Tue, 24 Oct 2017 22:41:13 +0200 Subject: [PATCH] Add distinct w (curr buf) / W (all buf) word completion for --- README.asciidoc | 5 +++-- doc/manpages/keys.asciidoc | 5 ++++- src/input_handler.cc | 7 +++++-- src/insert_completer.cc | 8 +++++++- src/insert_completer.hh | 3 ++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 7e08b364..d92233af 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1224,8 +1224,9 @@ reached (see `idle_timeout` option). Insert mode completion can be explicitly tr using ``, 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 `` and ``. diff --git a/doc/manpages/keys.asciidoc b/doc/manpages/keys.asciidoc index aaa8048a..160afa7a 100644 --- a/doc/manpages/keys.asciidoc +++ b/doc/manpages/keys.asciidoc @@ -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 diff --git a/src/input_handler.cc b/src/input_handler.cc index 25ceacc3..73e3649e 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -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; } diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 61670c5c..518216a3 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -548,7 +548,13 @@ void InsertCompleter::explicit_file_complete() m_explicit_completer = complete_filename; } -void InsertCompleter::explicit_word_complete() +void InsertCompleter::explicit_word_buffer_complete() +{ + try_complete(complete_word); + m_explicit_completer = complete_word; +} + +void InsertCompleter::explicit_word_all_complete() { try_complete(complete_word); m_explicit_completer = complete_word; diff --git a/src/insert_completer.hh b/src/insert_completer.hh index ca04e3de..e9c73d3f 100644 --- a/src/insert_completer.hh +++ b/src/insert_completer.hh @@ -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: