From a17d66df454852a5ff7cf002c6d5631a3cd4b385 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Mon, 12 Nov 2012 21:32:27 +0100 Subject: [PATCH] Added command to start completion. Doing this it's possible to set a special keybinding to complete commands and settings. --- doc/config | 2 ++ src/command.c | 10 ++++++++++ src/command.h | 1 + 3 files changed, 13 insertions(+) diff --git a/doc/config b/doc/config index 9a5a0e1..dbd6123 100644 --- a/doc/config +++ b/doc/config @@ -21,3 +21,5 @@ nmap h scrollleft nmap l scrollright nmap k scrollup nmap j scrolldown +cmap complete +cmap complete-back diff --git a/src/command.c b/src/command.c index c0aabc3..41c7547 100644 --- a/src/command.c +++ b/src/command.c @@ -21,6 +21,7 @@ #include "command.h" #include "keybind.h" #include "setting.h" +#include "completion.h" extern const char *inputbox_font[2]; extern const char *inputbox_fg[2]; @@ -58,6 +59,8 @@ static CommandInfo cmd_list[] = { {"iunmap", command_unmap, {VP_MODE_INSERT}, VP_MODE_NORMAL}, {"cunmap", command_unmap, {VP_MODE_COMMAND}, VP_MODE_NORMAL}, {"set", command_set, {0}, VP_MODE_NORMAL}, + {"complete", command_complete, {0}, VP_MODE_COMMAND | VP_MODE_COMPLETE}, + {"complete-back", command_complete, {1}, VP_MODE_COMMAND | VP_MODE_COMPLETE}, }; void command_init(void) @@ -247,3 +250,10 @@ gboolean command_set(const Arg* arg) return success; } + +gboolean command_complete(const Arg* arg) +{ + completion_complete(arg->i ? TRUE : FALSE); + + return TRUE; +} diff --git a/src/command.h b/src/command.h index 25a8616..1f10a49 100644 --- a/src/command.h +++ b/src/command.h @@ -44,5 +44,6 @@ gboolean command_scroll(const Arg* arg); gboolean command_map(const Arg* arg); gboolean command_unmap(const Arg* arg); gboolean command_set(const Arg* arg); +gboolean command_complete(const Arg* arg); #endif /* end of include guard: COMMAND_H */ -- 2.20.1