wex
v21.04.0
|
Offers vi mode. More...
#include <wex/vi-mode.h>
Public Types | |
enum | state_t { COMMAND , INSERT , INSERT_BLOCK , VISUAL , VISUAL_LINE , VISUAL_BLOCK } |
The possible vi mode states. More... | |
Public Member Functions | |
vi_mode (vi *vi, std::function< void(const std::string &command)> insert=nullptr, std::function< void()> f=nullptr) | |
Constructor,. More... | |
~vi_mode () | |
Destructor. | |
bool | escape () |
escapes current mode. | |
state_t | get () const |
Returns the state we are in. | |
bool | is_command () const |
Returns true if in command mode. | |
bool | is_insert () const |
Returns true if in insert mode. | |
bool | is_visual () const |
Returns true if in visual mode. | |
const auto & | insert_commands () const |
Returns insert commands. | |
const std::string | str () const |
Returns mode as a string. | |
bool | transition (std::string &command) |
transitions to other mode depending on command. More... | |
Offers vi mode.
wex::vi_mode::vi_mode | ( | vi * | vi, |
std::function< void(const std::string &command)> | insert = nullptr , |
||
std::function< void()> | f = nullptr |
||
) |
Constructor,.
vi | specify vi component |
insert | method to be called when going into insert mode |
f | method to be called when going back to command mode |
bool wex::vi_mode::transition | ( | std::string & | command | ) |
transitions to other mode depending on command.
Returns true if command represents a mode change, otherwise false. If true is returned, it does not mean that mode was changed, in case of readonly doc.