#include "util.h"
#include "searchengine.h"
#include "history.h"
+#include "bookmark.h"
extern VbCore vb;
extern const unsigned int INPUT_LENGTH;
static CommandInfo cmd_list[] = {
- /* command function arg mode */
- {"open", command_open, {VB_TARGET_CURRENT, ""}},
- {"tabopen", command_open, {VB_TARGET_NEW, ""}},
- {"open-closed", command_open_closed, {VB_TARGET_CURRENT}},
- {"tabopen-closed", command_open_closed, {VB_TARGET_NEW}},
- {"input", command_input, {0, ":"}},
- {"inputuri", command_input, {VB_INPUT_CURRENT_URI, ":"}},
- {"quit", command_close, {0}},
- {"source", command_view_source, {0}},
- {"back", command_navigate, {VB_NAVIG_BACK}},
- {"forward", command_navigate, {VB_NAVIG_FORWARD}},
- {"reload", command_navigate, {VB_NAVIG_RELOAD}},
- {"reload!", command_navigate, {VB_NAVIG_RELOAD_FORCE}},
- {"stop", command_navigate, {VB_NAVIG_STOP_LOADING}},
- {"jumpleft", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_LEFT}},
- {"jumpright", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_RIGHT}},
- {"jumptop", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_TOP}},
- {"jumpbottom", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_DOWN}},
- {"pageup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_PAGE}},
- {"pagedown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_PAGE}},
- {"halfpageup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_HALFPAGE}},
- {"halfpagedown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_HALFPAGE}},
- {"scrollleft", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_LEFT | VB_SCROLL_UNIT_LINE}},
- {"scrollright", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_RIGHT | VB_SCROLL_UNIT_LINE}},
- {"scrollup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_LINE}},
- {"scrolldown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_LINE}},
- {"nmap", command_map, {VB_MODE_NORMAL}},
- {"imap", command_map, {VB_MODE_INSERT}},
- {"cmap", command_map, {VB_MODE_COMMAND}},
- {"hmap", command_map, {VB_MODE_HINTING}},
- {"smap", command_map, {VB_MODE_SEARCH}},
- {"nunmap", command_unmap, {VB_MODE_NORMAL}},
- {"iunmap", command_unmap, {VB_MODE_INSERT}},
- {"cunmap", command_unmap, {VB_MODE_COMMAND}},
- {"hunmap", command_unmap, {VB_MODE_HINTING}},
- {"sunmap", command_map, {VB_MODE_SEARCH}},
- {"set", command_set, {0}},
- {"complete", command_complete, {0}},
- {"complete-back", command_complete, {1}},
- {"inspect", command_inspect, {0}},
- {"hint-link", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_OPEN, "."}},
- {"hint-link-new", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_OPEN | HINTS_OPEN_NEW, ","}},
- {"hint-input-open", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_INPUT, ";o"}},
- {"hint-input-tabopen", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_INPUT | HINTS_OPEN_NEW, ";t"}},
- {"hint-yank", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_YANK, ";y"}},
- {"hint-image-open", command_hints, {HINTS_TYPE_IMAGE | HINTS_PROCESS_OPEN, ";i"}},
- {"hint-image-tabopen", command_hints, {HINTS_TYPE_IMAGE | HINTS_PROCESS_OPEN | HINTS_OPEN_NEW, ";I"}},
- {"hint-focus-next", command_hints_focus, {0}},
- {"hint-focus-prev", command_hints_focus, {1}},
- {"yank-uri", command_yank, {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_URI}},
- {"yank-selection", command_yank, {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_SELECTION}},
- {"open-clipboard", command_paste, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | VB_TARGET_CURRENT}},
- {"tabopen-clipboard", command_paste, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | VB_TARGET_NEW}},
- {"search-forward", command_search, {VB_SEARCH_FORWARD}},
- {"search-backward", command_search, {VB_SEARCH_BACKWARD}},
- {"searchengine-add", command_searchengine,{1}},
- {"searchengine-remove", command_searchengine,{0}},
- {"searchengine-default", command_searchengine_default,{0}},
- {"zoomin", command_zoom, {COMMAND_ZOOM_IN}},
- {"zoomout", command_zoom, {COMMAND_ZOOM_OUT}},
- {"zoominfull", command_zoom, {COMMAND_ZOOM_IN | COMMAND_ZOOM_FULL}},
- {"zoomoutfull", command_zoom, {COMMAND_ZOOM_OUT | COMMAND_ZOOM_FULL}},
- {"zoomreset", command_zoom, {COMMAND_ZOOM_RESET}},
- {"hist-next", command_history, {0}},
- {"hist-prev", command_history, {1}},
- {"run", command_run_multi, {0}},
+ /* command function mode */
+ {"open", command_open, {VB_TARGET_CURRENT, ""}},
+ {"tabopen", command_open, {VB_TARGET_NEW, ""}},
+ {"open-closed", command_open_closed, {VB_TARGET_CURRENT}},
+ {"tabopen-closed", command_open_closed, {VB_TARGET_NEW}},
+ {"input", command_input, {0, ":"}},
+ {"inputuri", command_input, {VB_INPUT_CURRENT_URI, ":"}},
+ {"quit", command_close, {0}},
+ {"source", command_view_source, {0}},
+ {"back", command_navigate, {VB_NAVIG_BACK}},
+ {"forward", command_navigate, {VB_NAVIG_FORWARD}},
+ {"reload", command_navigate, {VB_NAVIG_RELOAD}},
+ {"reload!", command_navigate, {VB_NAVIG_RELOAD_FORCE}},
+ {"stop", command_navigate, {VB_NAVIG_STOP_LOADING}},
+ {"jumpleft", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_LEFT}},
+ {"jumpright", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_RIGHT}},
+ {"jumptop", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_TOP}},
+ {"jumpbottom", command_scroll, {VB_SCROLL_TYPE_JUMP | VB_SCROLL_DIRECTION_DOWN}},
+ {"pageup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_PAGE}},
+ {"pagedown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_PAGE}},
+ {"halfpageup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_HALFPAGE}},
+ {"halfpagedown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_HALFPAGE}},
+ {"scrollleft", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_LEFT | VB_SCROLL_UNIT_LINE}},
+ {"scrollright", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_RIGHT | VB_SCROLL_UNIT_LINE}},
+ {"scrollup", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_TOP | VB_SCROLL_UNIT_LINE}},
+ {"scrolldown", command_scroll, {VB_SCROLL_TYPE_SCROLL | VB_SCROLL_DIRECTION_DOWN | VB_SCROLL_UNIT_LINE}},
+ {"nmap", command_map, {VB_MODE_NORMAL}},
+ {"imap", command_map, {VB_MODE_INSERT}},
+ {"cmap", command_map, {VB_MODE_COMMAND}},
+ {"hmap", command_map, {VB_MODE_HINTING}},
+ {"smap", command_map, {VB_MODE_SEARCH}},
+ {"nunmap", command_unmap, {VB_MODE_NORMAL}},
+ {"iunmap", command_unmap, {VB_MODE_INSERT}},
+ {"cunmap", command_unmap, {VB_MODE_COMMAND}},
+ {"hunmap", command_unmap, {VB_MODE_HINTING}},
+ {"sunmap", command_map, {VB_MODE_SEARCH}},
+ {"set", command_set, {0}},
+ {"complete", command_complete, {0}},
+ {"complete-back", command_complete, {1}},
+ {"inspect", command_inspect, {0}},
+ {"hint-link", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_OPEN, "."}},
+ {"hint-link-new", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_OPEN | HINTS_OPEN_NEW, ","}},
+ {"hint-input-open", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_INPUT, ";o"}},
+ {"hint-input-tabopen", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_INPUT | HINTS_OPEN_NEW, ";t"}},
+ {"hint-yank", command_hints, {HINTS_TYPE_LINK | HINTS_PROCESS_YANK, ";y"}},
+ {"hint-image-open", command_hints, {HINTS_TYPE_IMAGE | HINTS_PROCESS_OPEN, ";i"}},
+ {"hint-image-tabopen", command_hints, {HINTS_TYPE_IMAGE | HINTS_PROCESS_OPEN | HINTS_OPEN_NEW, ";I"}},
+ {"hint-focus-next", command_hints_focus, {0}},
+ {"hint-focus-prev", command_hints_focus, {1}},
+ {"yank-uri", command_yank, {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_URI}},
+ {"yank-selection", command_yank, {COMMAND_YANK_PRIMARY | COMMAND_YANK_SECONDARY | COMMAND_YANK_SELECTION}},
+ {"open-clipboard", command_paste, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | VB_TARGET_CURRENT}},
+ {"tabopen-clipboard", command_paste, {VB_CLIPBOARD_PRIMARY | VB_CLIPBOARD_SECONDARY | VB_TARGET_NEW}},
+ {"search-forward", command_search, {VB_SEARCH_FORWARD}},
+ {"search-backward", command_search, {VB_SEARCH_BACKWARD}},
+ {"searchengine-add", command_searchengine, {1}},
+ {"searchengine-remove", command_searchengine, {0}},
+ {"searchengine-default", command_searchengine_default, {0}},
+ {"zoomin", command_zoom, {COMMAND_ZOOM_IN}},
+ {"zoomout", command_zoom, {COMMAND_ZOOM_OUT}},
+ {"zoominfull", command_zoom, {COMMAND_ZOOM_IN | COMMAND_ZOOM_FULL}},
+ {"zoomoutfull", command_zoom, {COMMAND_ZOOM_OUT | COMMAND_ZOOM_FULL}},
+ {"zoomreset", command_zoom, {COMMAND_ZOOM_RESET}},
+ {"hist-next", command_history, {0}},
+ {"hist-prev", command_history, {1}},
+ {"run", command_run_multi, {0}},
+ {"bookmark-add", command_bookmark, {1}},
};
return TRUE;
}
+
+gboolean command_bookmark(const Arg *arg)
+{
+ bookmark_add(webkit_web_view_get_uri(vb.gui.webview), arg->s);
+ vb_set_mode(VB_MODE_NORMAL, false);
+ return TRUE;
+}