You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#pragma once
|
|
|
|
|
|
Improved snippets: now supports variables TM_SELECTED_TEXT, TM_CURRENT_LINE, TM_CURRENT_WORD, TM_LINE_INDEX, TM_LINE_NUMBER, TM_FILENAME_BASE, TM_FILENAME, TM_DIRECTORY, TM_FILEPATH, CLIPBOARD, and default values. Binding shortcuts to snippets is also possible by adding key values in snippets.json
6 years ago
|
|
|
#include <gdk/gdk.h>
|
|
|
|
|
#include <regex>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
class Snippets {
|
|
|
|
|
public:
|
|
|
|
|
class Snippet {
|
|
|
|
|
public:
|
|
|
|
|
std::string prefix;
|
Improved snippets: now supports variables TM_SELECTED_TEXT, TM_CURRENT_LINE, TM_CURRENT_WORD, TM_LINE_INDEX, TM_LINE_NUMBER, TM_FILENAME_BASE, TM_FILENAME, TM_DIRECTORY, TM_FILEPATH, CLIPBOARD, and default values. Binding shortcuts to snippets is also possible by adding key values in snippets.json
6 years ago
|
|
|
guint key;
|
|
|
|
|
GdkModifierType modifier;
|
|
|
|
|
std::string body;
|
|
|
|
|
std::string description;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static Snippets &get() {
|
|
|
|
|
static Snippets instance;
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::pair<std::regex, std::vector<Snippet>>> snippets;
|
|
|
|
|
void load();
|
|
|
|
|
};
|