aboutsummaryrefslogtreecommitdiffstats
path: root/twittperator/rt.tw
blob: 29d5e2ca760b455bde6173eef30bc79d86c0f3f7 (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
/*
 * Please write the below line into .vimperatorrc.
 * let g:twittperator_plugin_rt = 1
 */

(function () {
  const TW = liberator.plugins.twittperator;

  TW.SubCommands.add(
    TW.SubCommand({
      command: ['rt'],
      description: 'Official retweet',
      action: function(arg) {
        setTimeout(function () {
          commandline.open(':', 'tw RT ' + arg, modes.EX);
        }, 100);
      },
      timelineComplete: true,
      completer: TW.Completers.name_id(function(s) s.id)
    })
  );

  TW.SubCommands.add(
    TW.SubCommand({
      command: ['urt'],
      description: 'Unofficial retweet',
      action: function(arg) {
        arg.match(/^@([a-zA-Z0-9_]+)#\d+: (.*)$/);
        var screen_name = RegExp.$1;
        var text = RegExp.$2;
        if (screen_name && text) {
          setTimeout(function () {
            commandline.open(':', 'tw RT @' + screen_name + ': ' + text, modes.EX);
          }, 100);
        }
      },
      timelineComplete: true,
      completer: TW.Completers.name_id_text(function(s) s.id)
    })
  );

})();

// vim: set et fdm=syntax ft=javascript sts=2 sw=2 ts=2 :