• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión518ebafd9dc2fa0f316f6e9522e7c6c1a97ed6b4 (tree)
Tiempo2023-02-07 22:01:43
Autorbadcoff33 <none@none>
Commiterbadcoff33

Log Message

vcs.vim is specialized on Hg

Cambiar Resumen

Diferencia incremental

--- /dev/null
+++ b/plugin/hg.vim
@@ -0,0 +1,39 @@
1+vim9script
2+
3+import autoload 'run.vim' as run
4+
5+def GetCompleteCandidates(): list<string>
6+ var options: list<string>
7+ var filename: string
8+
9+ options = ["commit", "status", "heads", "resolve", "bookmark", "last", "log"]
10+
11+ for e in systemlist("hg st") # returns list in format "[M|R|A] <FILENAME>"
12+ filename = split(e, " ")[1]
13+ options = add(options, filename)
14+ endfor
15+
16+ return options
17+enddef
18+
19+def CompleteHg(arg_lead: string, cmd_line: string, cur_pos: number): string
20+ var matching_keys: string
21+ var candidates: list<string>
22+ var filename: string
23+
24+ candidates = GetCompleteCandidates()
25+
26+ for k in sort(candidates)
27+ if match(k, arg_lead) >= 0
28+ matching_keys = matching_keys .. k .. "\n"
29+ endif
30+ endfor
31+ return matching_keys
32+enddef
33+
34+command! -complete=custom,CompleteHg -nargs=+ Hg run.Run({cmd: 'hg <args>', name: "HG-OUTPUT"})
35+
36+nnoremap <Leader>v :<C-u>Hg<Space>
37+
38+# Uncomment when testing
39+defcompile
--- a/plugin/vcs.vim
+++ /dev/null
@@ -1,69 +0,0 @@
1-vim9script
2-
3-import autoload 'run.vim' as run
4-
5-def g:WhichVcs(): string
6- if isdirectory(".git")
7- return "git"
8- elseif isdirectory(".hg")
9- return "hg"
10- else
11- return ""
12- endif
13-enddef
14-
15-def CompleteCandidatesHg(): list<string>
16- var options: list<string>
17- var filename: string
18-
19- options = ["commit", "status", "heads", "resolve", "bookmark", "last", "log"]
20- for e in systemlist("hg st") # returns list in format "[M|R|A] <FILENAME>"
21- filename = split(e, " ")[1]
22- options = add(options, filename)
23- endfor
24- return options
25-enddef
26-
27-
28-def CompleteCandidatesGit(): list<string>
29- var options: list<string>
30- var filename: string
31-
32- options = [ "commit", "status", "add" ]
33- for e in systemlist("git st")
34- var ee = split(e, " ")
35- if len(ee) >= 1 && ee[0] == "M"
36- filename = ee[1]
37- options = add(options, filename)
38- endif
39- endfor
40- return options
41-enddef
42-
43-def CompleteVcs(arg_lead: string, cmd_line: string, cur_pos: number): string
44- var matching_keys: string
45- var candidates: list<string>
46- var filename: string
47-
48- if g:WhichVcs() == "git"
49- candidates = CompleteCandidatesGit()
50- elseif g:WhichVcs() == "hg"
51- candidates = CompleteCandidatesHg()
52- else
53- candidates = []
54- endif
55-
56- for k in sort(candidates)
57- if match(k, arg_lead) >= 0
58- matching_keys = matching_keys .. k .. "\n"
59- endif
60- endfor
61- return matching_keys
62-enddef
63-
64-command! -complete=custom,CompleteVcs -nargs=+ Vcs run.Run({cmd: g:WhichVcs() .. ' <args>', name: "VCS-OUTPUT"})
65-
66-nnoremap <Leader>v :<C-u>Vcs<Space>
67-
68-# Uncomment when testing
69-defcompile