2 *new { this.shouldNotImplement(thisMethod) }
3 *serverlist { ^"vim --serverlist".unixCmdGetStdOut }
4 *remote_send { | servername keys | ^("vim --servername" + servername + "--remote-send" + "'" ++ keys ++ "'").unixCmdGetStdOut }
5 *remote_expr { | servername expr | ^("vim --servername" + servername + "--remote-expr" + "'" ++ expr ++ "'").unixCmdGetStdOut }
8 VimDocument : Document {
10 var <servername, title, <file;
13 "rm -f /tmp/SCVIM*".systemCmd;
14 Document.implementationClass = VimDocument;
15 Document.autoRun = false;
25 if(post.notNil) { post.name_(" post ") }
27 this.setTheme('default');
30 *new { | title="Untitled" string="" makeListener=false |
31 ^super.prBasicNew.initByString(title, string.asString, makeListener);
39 alwaysOnTop_ { |boolean=true| }
40 alwaysOnTop { ^false }
43 promptToSave_ { | bool | }
44 promptToSave { ^true }
45 underlineSelection { }
49 // if range is -1 apply to whole doc
50 setFont { | font, rangeStart= -1, rangeSize=100 |
51 //XXX this only works for the whole server as that is the way vim works
52 //only works with graphical vim
53 Vim.remote_send(servername, "<Esc>:set guifont=" ++
54 font.replace(" ", "\\\\\\ ") ++ "<CR>");
56 setTextColor { | color, rangeStart = -1, rangeSize = 0 | }
60 = Vim.remote_expr(servername, "getbufline(bufnr(\"" ++ file ++ "\"), 1, \"$\")");
61 ^string.copyRange(0, (string.size - 2));
65 selectUnderlinedText { | clickPos | }
66 selectedRangeLocation { ^0 }
67 selectedRangeSize { ^0 }
69 rangeText { | rangestart=0, rangesize=1 |
71 Vim.remote_expr(servername, "getbufline(bufnr(\"" ++ file ++ "\"), " ++
72 (rangestart + 1) ++ ", " ++
73 (rangestart + rangesize) ++ ")");
74 ^string.copyRange(0, (string.size - 2));
77 insertTextRange { | string, rangestart, rangesize | }
78 linkAtClickPos { | clickPos | ^nil }
81 *prnumberOfOpen { ^0 }
82 *prGetIndexOfListener { ^0 }
83 *prSetSyntaxColorTheme{ |textC, classC, stringC, symbolC, commentC, numberC| }
85 propen { | path selectionStart=0 selectionLength=0 |
86 var rcfile = this.prfindRcFile;
88 servername = "scvim";//this.prnextVimServerName;
89 ("vim --servername " + servername + " --remote-tab " + file).unixCmd;
90 //XXX I'm not sure what this means
95 prinitByString { | title str makeListener |
97 file = this.prGetTmpFile;
99 File.open(file, "w").write(str).close;
101 //XXX I'm not sure what this means
105 prinitByIndex { | idx | }
106 prGetLastIndex { ^idx }
107 prIsEditable_{ | editable=true | }
108 prSetTitle { | argName | title = argName }
109 prGetTitle { ^title }
110 prGetFileName { ^nil }
111 prSetFileName { | apath | }
113 prSelectLine { | line | }
114 prinsertText { | dataPtr, txt | }
116 prGetBounds { | argBounds | ^nil }
117 prSetBounds { | argBounds | }
118 prSetBackgroundColor { | color | }
119 prGetBackgroundColor { | color | ^nil }
120 prSetSelectedBackgroundColor { | color | }
121 prGetSelectedBackgroundColor { | color | ^nil }
124 var tmp = "/tmp/scvimdocument-tmp" ++ idx ++ ".sc";
130 var homercfile = "~/.scvimrc";
131 var localrcfile = "/usr/local/share/scvim/scvimrc";
132 var usrrcfile = "/usr/share/scvim/scvimrc";
134 if (File.exists(homercfile)) {
137 if (File.exists(localrcfile)) {
140 if (File.exists(usrrcfile)) {