• 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

Revisão282d908ad76cd0ff22aba003cb2a6bbef7def353 (tree)
Hora2023-01-17 00:54:09
Autorbadcoff33 <none@none>
Commiterbadcoff33

Mensagem de Log

prepared for git

Mudança Sumário

Diff

--- a/plugin/hg.vim
+++ /dev/null
@@ -1,26 +0,0 @@
1-vim9script
2-
3-import autoload 'run.vim' as run
4-
5-def CompleteHg(arg_lead: string, cmd_line: string, cur_pos: number): string
6- var matching_keys = ""
7- var options: list<string>
8- var filename: string
9-
10- options = ["commit", "status", "heads", "resolve", "bookmark", "last", "log"]
11- for e in systemlist("hg st")
12- filename = split(e, " ")[1]
13- options = add(options, filename)
14- endfor
15- for k in sort(options)
16- if match(k, arg_lead) >= 0
17- matching_keys = matching_keys .. k .. "\n"
18- endif
19- endfor
20- return matching_keys
21-enddef
22-
23-command! -complete=custom,CompleteHg -nargs=+ Hg run.Run({cmd: 'hg <args>', name: "HG-OUTPUT"})
24-
25-nnoremap <Leader>v :<C-u>Hg<Space>
26-
--- /dev/null
+++ b/plugin/vcs.vim
@@ -0,0 +1,69 @@
1+vim9script
2+
3+import autoload 'run.vim' as run
4+
5+def 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 WhichVcs() == "git"
49+ candidates = CompleteCandidatesGit()
50+ elseif 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: "HG-OUTPUT"})
65+
66+nnoremap <Leader>v :<C-u>Vcs<Space>
67+
68+# Uncomment when testing
69+defcompile