summaryrefslogtreecommitdiff
path: root/src/normal.hh
blob: 080c3d015721789b00e84bc78c210b67c4ee9ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef normal_hh_INCLUDED
#define normal_hh_INCLUDED

#include "optional.hh"
#include "keys.hh"
#include "keymap_manager.hh"
#include "string.hh"
#include "exception.hh"

namespace Kakoune
{

class Buffer;
class Context;

struct no_selections_remaining : runtime_error
{
    no_selections_remaining() : runtime_error("no selections remaining") {}
};

struct NormalParams
{
    int count;
    char reg;
};

struct NormalCmd
{
    StringView docstring = {};
    void (*func)(Context& context, NormalParams params) = nullptr;
};

Optional<NormalCmd> get_normal_command(Key key);

struct KeyInfo
{
    ConstArrayView<Key> keys;
    StringView docstring;
};

String build_autoinfo_for_mapping(const Context& context, KeymapMode mode,
                                  ConstArrayView<KeyInfo> built_ins);

enum class PasteMode
{
    Append,
    Insert,
    Replace
};

BufferCoord paste_pos(Buffer& buffer, BufferCoord min, BufferCoord max, PasteMode mode, bool linewise);

}

#endif // normal_hh_INCLUDED