1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-03 18:19:17 +03:00
kakoune/src/scope.hh
Maxime Coste d49555fc75 Move highlighters into Scopes
That means we can now have highlighters active at global, buffer, and
window scope. The add-highlighter and remove-highlighter syntax changed
to take the parent path (scope/group/...) as a mandatory argument,
superseeding the previous -group switch.
2017-10-28 13:43:04 +08:00

60 lines
1.7 KiB
C++

#ifndef scope_hh_INCLUDED
#define scope_hh_INCLUDED
#include "alias_registry.hh"
#include "hook_manager.hh"
#include "keymap_manager.hh"
#include "option_manager.hh"
#include "highlighter_group.hh"
#include "utils.hh"
namespace Kakoune
{
class Scope
{
public:
Scope(Scope& parent)
: m_options(parent.options()),
m_hooks(parent.hooks()),
m_keymaps(parent.keymaps()),
m_aliases(parent.aliases()),
m_highlighters(parent.highlighters()) {}
OptionManager& options() { return m_options; }
const OptionManager& options() const { return m_options; }
HookManager& hooks() { return m_hooks; }
const HookManager& hooks() const { return m_hooks; }
KeymapManager& keymaps() { return m_keymaps; }
const KeymapManager& keymaps() const { return m_keymaps; }
AliasRegistry& aliases() { return m_aliases; }
const AliasRegistry& aliases() const { return m_aliases; }
Highlighters& highlighters() { return m_highlighters; }
const Highlighters& highlighters() const { return m_highlighters; }
private:
friend class GlobalScope;
Scope() = default;
OptionManager m_options;
HookManager m_hooks;
KeymapManager m_keymaps;
AliasRegistry m_aliases;
Highlighters m_highlighters;
};
class GlobalScope : public Scope, public Singleton<GlobalScope>
{
public:
GlobalScope() : m_option_registry(m_options) {}
OptionsRegistry& option_registry() { return m_option_registry; }
const OptionsRegistry& option_registry() const { return m_option_registry; }
private:
OptionsRegistry m_option_registry;
};
}
#endif // scope_hh_INCLUDED