fish-shell/src/builtin_bind.h
Fabian Homborg 444f9f8715 Add separation of "preset" bindings
This allows for marking certain bindings as part of a preset, which allows us to

- only erase those when switching presets
- go back to the preset binding when erasing a user binding
- only show user customization if requested
- make bare bind statements in config.fish work (!!!11elf!!!)

Fixes #5191.
Fixes #3699.
2018-09-30 16:54:56 +02:00

41 lines
1.4 KiB
C++

// Prototypes for executing builtin_bind function.
#ifndef FISH_BUILTIN_BIND_H
#define FISH_BUILTIN_BIND_H
#include "common.h"
#define DEFAULT_BIND_MODE L"default"
class parser_t;
struct io_streams_t;
struct bind_cmd_opts_t;
class builtin_bind_t {
public:
int builtin_bind(parser_t &parser, io_streams_t &streams, wchar_t **argv);
private:
bind_cmd_opts_t *opts;
void list(const wchar_t *bind_mode, bool user, io_streams_t &streams);
void key_names(bool all, io_streams_t &streams);
void function_names(io_streams_t &streams);
bool add(const wchar_t *seq, const wchar_t *const *cmds, size_t cmds_len,
const wchar_t *mode, const wchar_t *sets_mode, bool terminfo, bool user,
io_streams_t &streams);
bool erase(wchar_t **seq, bool all, const wchar_t *mode, bool use_terminfo, bool user,
io_streams_t &streams);
bool get_terminfo_sequence(const wchar_t *seq, wcstring *out_seq, io_streams_t &streams);
bool insert(int optind, int argc, wchar_t **argv,
io_streams_t &streams);
void list_modes(io_streams_t &streams);
bool list_one(const wcstring &seq, const wcstring &bind_mode, bool user, io_streams_t &streams);
bool list_one(const wcstring &seq, const wcstring &bind_mode, bool user, bool preset, io_streams_t &streams);
};
inline int builtin_bind(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
builtin_bind_t bind;
return bind.builtin_bind(parser, streams, argv);
}
#endif