forked from x/ContextOS
add support wuhuan
This commit is contained in:
parent
2b28848b15
commit
2e989b8505
13
etc/auto.vim
13
etc/auto.vim
@ -127,7 +127,7 @@ endfun
|
|||||||
fun! ShyComplete(firststart, base)
|
fun! ShyComplete(firststart, base)
|
||||||
if a:firststart | let line = getline('.') | let start = col('.') - 1
|
if a:firststart | let line = getline('.') | let start = col('.') - 1
|
||||||
" 命令位置
|
" 命令位置
|
||||||
if match(trim(line), "ice ") == 0 | return match(line, "ice ") | endif
|
if match(line, '\s*ice ') == 0 | return match(line, "ice ") | endif
|
||||||
" 符号位置
|
" 符号位置
|
||||||
if line[start-1] !~ '\a' | return start - 1 | end
|
if line[start-1] !~ '\a' | return start - 1 | end
|
||||||
" 单词位置
|
" 单词位置
|
||||||
@ -155,7 +155,7 @@ fun! ShyCome(buf, row, action, extra)
|
|||||||
let a:extra["count"] = 0
|
let a:extra["count"] = 0
|
||||||
endif
|
endif
|
||||||
" 刷新命令
|
" 刷新命令
|
||||||
for line in reverse(split(trim(ShySend({"cmd": "trans", "arg": getbufline(a:buf, a:row)[0]})), "\n"))
|
for line in reverse(split(ShySend({"cmd": "trans", "arg": getbufline(a:buf, a:row)[0]}), "\n"))
|
||||||
call appendbufline(a:buf, a:row, line)
|
call appendbufline(a:buf, a:row, line)
|
||||||
let a:extra["count"] += 1
|
let a:extra["count"] += 1
|
||||||
endfor
|
endfor
|
||||||
@ -169,12 +169,19 @@ fun! ShyUpdate(timer)
|
|||||||
call ShyCome(what["buf"], what["row"], what["action"], what)
|
call ShyCome(what["buf"], what["row"], what["action"], what)
|
||||||
endfun
|
endfun
|
||||||
fun! ShyComes(action)
|
fun! ShyComes(action)
|
||||||
|
" 低配命令
|
||||||
|
if !exists("appendbufline")
|
||||||
|
for line in reverse(split(ShySend({"cmd": "trans", "arg": getline(".")}), "\n"))
|
||||||
|
call append(".", line)
|
||||||
|
endfor
|
||||||
|
return
|
||||||
|
endif
|
||||||
if !exists("b:timer") | let b:timer = -1 | endif
|
if !exists("b:timer") | let b:timer = -1 | endif
|
||||||
" 清除定时
|
" 清除定时
|
||||||
if b:timer > 0 | call timer_stop(b:timer) | let b:timer = -2 | return | endif
|
if b:timer > 0 | call timer_stop(b:timer) | let b:timer = -2 | return | endif
|
||||||
" 添加定时
|
" 添加定时
|
||||||
let b:timer = timer_start(1000, funcref('ShyUpdate'), {"repeat": -1})
|
let b:timer = timer_start(1000, funcref('ShyUpdate'), {"repeat": -1})
|
||||||
let g:ShyComeList[b:timer] = {"buf": bufname(), "row": line("."), "pre": getline("."), "action": a:action, "count": 0}
|
let g:ShyComeList[b:timer] = {"buf": bufname("."), "row": line("."), "pre": getline("."), "action": a:action, "count": 0}
|
||||||
call ShyLog("new timer", b:timer)
|
call ShyLog("new timer", b:timer)
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
|
7
go.mod
7
go.mod
@ -2,9 +2,14 @@ module miss
|
|||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require github.com/shylinux/icebergs v0.1.9
|
require (
|
||||||
|
github.com/shylinux/contexts v0.0.0-00010101000000-000000000000 // indirect
|
||||||
|
github.com/shylinux/icebergs v0.1.9
|
||||||
|
github.com/shylinux/toolkits v0.1.0
|
||||||
|
)
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
|
github.com/shylinux/contexts => ./
|
||||||
github.com/shylinux/icebergs => ../icebergs
|
github.com/shylinux/icebergs => ../icebergs
|
||||||
github.com/shylinux/toolkits => ../toolkits
|
github.com/shylinux/toolkits => ../toolkits
|
||||||
)
|
)
|
||||||
|
1
go.sum
1
go.sum
@ -2,6 +2,7 @@ github.com/gomarkdown/markdown v0.0.0-20200112043221-ec51d717629d h1:Qw3Ku+gg4x3
|
|||||||
github.com/gomarkdown/markdown v0.0.0-20200112043221-ec51d717629d/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=
|
github.com/gomarkdown/markdown v0.0.0-20200112043221-ec51d717629d/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=
|
||||||
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
||||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
|
github.com/shylinux/contexts v0.0.0-20200121121314-2b28848b15ea h1:xmFZmpT3RMt4JnmxSwJ9M552SaiCC8DufYVadssbuS8=
|
||||||
github.com/shylinux/icebergs v0.1.12 h1:pUWWp4p5rF1JT7lcbaBlCJOWzwjPYDzmWcO9+nrNsfs=
|
github.com/shylinux/icebergs v0.1.12 h1:pUWWp4p5rF1JT7lcbaBlCJOWzwjPYDzmWcO9+nrNsfs=
|
||||||
github.com/shylinux/icebergs v0.1.12/go.mod h1:/gccR5uyFaaml8CBSD4BfHmIPOK6QlaFp3sK4eOiv4s=
|
github.com/shylinux/icebergs v0.1.12/go.mod h1:/gccR5uyFaaml8CBSD4BfHmIPOK6QlaFp3sK4eOiv4s=
|
||||||
github.com/shylinux/toolkits v0.1.0 h1:7ghnVEjuwLf7zBsyeR37ahm2gaOKIyjSw9F9Pp9oTBU=
|
github.com/shylinux/toolkits v0.1.0 h1:7ghnVEjuwLf7zBsyeR37ahm2gaOKIyjSw9F9Pp9oTBU=
|
||||||
|
@ -12,6 +12,8 @@ import (
|
|||||||
_ "github.com/shylinux/icebergs/misc/mp"
|
_ "github.com/shylinux/icebergs/misc/mp"
|
||||||
_ "github.com/shylinux/icebergs/misc/pi"
|
_ "github.com/shylinux/icebergs/misc/pi"
|
||||||
_ "github.com/shylinux/icebergs/misc/wx"
|
_ "github.com/shylinux/icebergs/misc/wx"
|
||||||
|
|
||||||
|
_ "github.com/shylinux/contexts/src/support/wuhan"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
24
src/support/wuhan/wuhan.go
Normal file
24
src/support/wuhan/wuhan.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package wuhan
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/shylinux/icebergs"
|
||||||
|
"github.com/shylinux/icebergs/base/cli"
|
||||||
|
"github.com/shylinux/toolkits"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Index = &ice.Context{Name: "wuhan", Help: "武汉加油",
|
||||||
|
Caches: map[string]*ice.Cache{},
|
||||||
|
Configs: map[string]*ice.Config{
|
||||||
|
"wuhan": {Name: "wuhan", Help: "武汉", Value: kit.Data(kit.MDB_SHORT, "name")},
|
||||||
|
},
|
||||||
|
Commands: map[string]*ice.Command{
|
||||||
|
ice.ICE_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||||
|
ice.ICE_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||||
|
|
||||||
|
"wuhan": {Name: "wuhan", Help: "武汉", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
m.Echo("hello world")
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { cli.Index.Register(Index, nil) }
|
1
src/support/wuhan/wuhan.md
Normal file
1
src/support/wuhan/wuhan.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# {{title "wuhan"}}
|
Loading…
x
Reference in New Issue
Block a user