forked from x/ContextOS
opt auto
This commit is contained in:
parent
aa0f3ea799
commit
d84c970e09
2
.gitignore
vendored
2
.gitignore
vendored
@ -23,4 +23,4 @@
|
|||||||
pkg/
|
pkg/
|
||||||
var/
|
var/
|
||||||
usr/publish
|
usr/publish
|
||||||
etc/init.shy
|
etc/local.shy
|
||||||
|
13
bin/ice.sh
13
bin/ice.sh
@ -1,12 +1,13 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
export PATH=${PWD}:${PWD}/bin:$PATH
|
export PATH=${PWD}/bin:${PWD}:$PATH
|
||||||
export ctx_pid=${ctx_pid:=var/run/ice.pid}
|
export ctx_pid=${ctx_pid:=var/run/ice.pid}
|
||||||
export ctx_log=${ctx_log:=bin/boot.log}
|
export ctx_log=${ctx_log:=bin/boot.log}
|
||||||
|
export ctx_mod=${ctx_mod:="ssh ctx log gdb"}
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
[ -d bin ] || mkdir bin
|
[ -d bin ] || mkdir bin
|
||||||
[ -e bin/ice.sh ] || curl $ctx_dev/publish/ice.sh -o bin/ice.sh && chmod u+x bin/ice.sh
|
[ -e bin/ice.sh ] || curl -sq $ctx_dev/publish/ice.sh -o bin/ice.sh && chmod u+x bin/ice.sh
|
||||||
[ -e bin/ice.bin ] && chmod u+x bin/ice.bin && return
|
[ -e bin/ice.bin ] && chmod u+x bin/ice.bin && return
|
||||||
|
|
||||||
bin="ice"
|
bin="ice"
|
||||||
@ -20,22 +21,22 @@ prepare() {
|
|||||||
i686) bin=${bin}.386 ;;
|
i686) bin=${bin}.386 ;;
|
||||||
arm*) bin=${bin}.arm ;;
|
arm*) bin=${bin}.arm ;;
|
||||||
esac
|
esac
|
||||||
curl $ctx_dev/publish/${bin} -o bin/ice.bin && chmod u+x bin/ice.bin
|
curl -sq $ctx_dev/publish/${bin} -o bin/ice.bin && chmod u+x bin/ice.bin
|
||||||
}
|
}
|
||||||
start() {
|
start() {
|
||||||
trap HUP hup && while true; do
|
trap HUP hup && while true; do
|
||||||
date && ice.bin $@ 2>$ctx_log && echo -e "\n\nrestarting..." || break
|
date && ice.bin $@ 2>$ctx_log && echo -e "\n\nrestarting..." || break
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
serve() {
|
|
||||||
prepare && shutdown && start $@
|
|
||||||
}
|
|
||||||
restart() {
|
restart() {
|
||||||
[ -e $ctx_pid ] && kill -2 `cat $ctx_pid` || echo
|
[ -e $ctx_pid ] && kill -2 `cat $ctx_pid` || echo
|
||||||
}
|
}
|
||||||
shutdown() {
|
shutdown() {
|
||||||
[ -e $ctx_pid ] && kill -3 `cat $ctx_pid` || echo
|
[ -e $ctx_pid ] && kill -3 `cat $ctx_pid` || echo
|
||||||
}
|
}
|
||||||
|
serve() {
|
||||||
|
prepare && shutdown && start $@
|
||||||
|
}
|
||||||
|
|
||||||
cmd=$1 && [ -n "$cmd" ] && shift || cmd=serve
|
cmd=$1 && [ -n "$cmd" ] && shift || cmd=serve
|
||||||
$cmd $*
|
$cmd $*
|
||||||
|
183
etc/auto.sh
183
etc/auto.sh
@ -1,183 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ "${ctx_dev}" = "" ] || [ "${ctx_dev}" = "-" ]; then
|
|
||||||
ctx_dev="http://localhost:9095"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ctx_url=$ctx_dev"/code/zsh"
|
|
||||||
ctx_get=${ctx_get:="wget -q"}
|
|
||||||
ctx_curl=${ctx_curl:="curl"}
|
|
||||||
ctx_head=${ctx_head:="Content-Type: application/json"}
|
|
||||||
ctx_sid=${ctx_sid:=""}
|
|
||||||
|
|
||||||
ctx_silent=${ctx_silent:=""}
|
|
||||||
ctx_err=${ctx_err:="/dev/null"}
|
|
||||||
ctx_welcome=${ctx_welcome:="^_^ Welcome to Context world ^_^"}
|
|
||||||
ctx_goodbye=${ctx_goodbye:="^_^ Goodbye to Context world ^_^"}
|
|
||||||
|
|
||||||
ShyRight() {
|
|
||||||
[ "$1" = "" ] && return 1
|
|
||||||
[ "$1" = "0" ] && return 1
|
|
||||||
[ "$1" = "false" ] && return 1
|
|
||||||
[ "$1" = "true" ] && return 0
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
ShyEcho() {
|
|
||||||
ShyRight "$ctx_silent" || echo "$@"
|
|
||||||
}
|
|
||||||
ShyLog() {
|
|
||||||
echo "$@" > $ctx_err
|
|
||||||
}
|
|
||||||
|
|
||||||
ShyWord() {
|
|
||||||
echo "$*"|sed -e 's/\ /%20/g' -e 's/\n/\\n/g'
|
|
||||||
}
|
|
||||||
ShyForm() {
|
|
||||||
while [ $# -gt 1 ]; do
|
|
||||||
echo -n "`ShyWord "$1"`=`ShyWord "$2"`"
|
|
||||||
shift 2 && [ $# -gt 1 ] && echo -n "&"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
ShyGet() {
|
|
||||||
local data=`ShyForm "$@" SHELL "${SHELL}" pwd "${PWD}" sid "${ctx_sid}"`
|
|
||||||
${ctx_get} "${ctx_url}?${data}"
|
|
||||||
}
|
|
||||||
ShyLine() {
|
|
||||||
echo "$*"|sed -e 's/\"/\\\"/g' -e 's/\n/\\n/g'
|
|
||||||
}
|
|
||||||
ShyJSON() {
|
|
||||||
[ $# -eq 1 ] && echo \"`ShyLine "$1"`\" && return
|
|
||||||
echo -n "{"
|
|
||||||
while [ $# -gt 1 ]; do
|
|
||||||
echo -n \"`ShyLine "$1"`\"\:\"`ShyLine "$2"`\"
|
|
||||||
shift 2 && [ $# -gt 1 ] && echo -n ","
|
|
||||||
done
|
|
||||||
echo -n "}"
|
|
||||||
}
|
|
||||||
ShyPost() {
|
|
||||||
if [ "$SHELL" = "/bin/zsh" ]; then
|
|
||||||
ShyJSON "$@" SHELL "${SHELL}" pwd "${PWD}" sid "${ctx_sid}"|read data
|
|
||||||
else
|
|
||||||
local data=`ShyJSON "$@" SHELL "${SHELL}" pwd "${PWD}" sid "${ctx_sid}"`
|
|
||||||
fi
|
|
||||||
${ctx_curl} -s "${ctx_url}" -H "${ctx_head}" -d "${data}"
|
|
||||||
}
|
|
||||||
ShyDownload() {
|
|
||||||
${ctx_curl} -s "${ctx_url}" -F "cmd=download" -F "arg=$1" -F "sid=$ctx_sid"
|
|
||||||
}
|
|
||||||
ShyUpload() {
|
|
||||||
${ctx_curl} -s "${ctx_url}" -F "cmd=upload" -F "upload=@$1" -F "sid=$ctx_sid"
|
|
||||||
}
|
|
||||||
ShyBench() {
|
|
||||||
${ctx_curl} -s "${ctx_dev}/publish/boot.sh" | sh -s installs context
|
|
||||||
}
|
|
||||||
ShySend() {
|
|
||||||
local TEMP=`mktemp /tmp/tmp.XXXXXX` && "$@" > $TEMP
|
|
||||||
ShyRight "$ctx_silent" || cat $TEMP
|
|
||||||
${ctx_curl} -s "${ctx_url}" -F "cmd=sync" -F "arg=$1" -F "args=$*" -F "sub=@$TEMP"\
|
|
||||||
-F "SHELL=${SHELL}" -F "pwd=${PWD}" -F "sid=${ctx_sid}"
|
|
||||||
}
|
|
||||||
ShySends() {
|
|
||||||
local cmd=$1 && shift
|
|
||||||
local arg=$2 && shift
|
|
||||||
local TEMP=`mktemp /tmp/tmp.XXXXXX` && echo "$@" > $TEMP
|
|
||||||
ShyRight "$ctx_silent" || cat $TEMP
|
|
||||||
${ctx_curl} -s "${ctx_url}" -F "cmd=$cmd" -F "arg=$arg" -F "sub=@$TEMP" \
|
|
||||||
-F "SHELL=${SHELL}" -F "pwd=${PWD}" -F "sid=${ctx_sid}"
|
|
||||||
}
|
|
||||||
ShyRun() {
|
|
||||||
ctx_silent=false ShySend "$@"
|
|
||||||
}
|
|
||||||
Shy() {
|
|
||||||
local ctx_res=`ShyPost cmd "$1" arg "$2"`
|
|
||||||
case "$ctx_res" in
|
|
||||||
"PS1");;
|
|
||||||
*) [ -n "${ctx_res}" ] && ShyPost cmd "$1" arg "$2" res `sh -c ${ctx_res}`
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
ShyLogout() {
|
|
||||||
echo ${ctx_goodbye} && [ "$ctx_sid" != "" ] && Shy logout
|
|
||||||
}
|
|
||||||
ShyLogin() {
|
|
||||||
HOST=`hostname` ctx_sid=`ShyPost cmd login share "${ctx_share}" pid "$$" pane "${TMUX_PANE}" hostname "${HOST}" username "${USER}"`
|
|
||||||
[ "$ctx_begin" = "" ] && ctx_begin=`history|tail -n1|awk '{print $1}'` && echo "begin: ${ctx_begin}"
|
|
||||||
echo "sid: ${ctx_sid}"
|
|
||||||
}
|
|
||||||
ShyFavor() {
|
|
||||||
[ "$READLINE_LINE" != "" ] && set $READLINE_LINE && READLINE_LINE=""
|
|
||||||
[ "$1" != "" ] && ctx_tab=$1 && shift; [ "$1" != "" ] && ctx_note=$1 && shift
|
|
||||||
[ "$1" != "" ] && ctx_word=$1 || ctx_word=`history|tail -n1|head -n1`
|
|
||||||
ShyPost cmd favor arg "${ctx_word}" tab "${ctx_tab}" note "${ctx_note}"
|
|
||||||
}
|
|
||||||
ShyFavors() {
|
|
||||||
[ "$READLINE_LINE" != "" ] && set $READLINE_LINE && READLINE_LINE=""
|
|
||||||
ShyPost cmd favor tab "$1" limit "$2"
|
|
||||||
}
|
|
||||||
ShySync() {
|
|
||||||
[ "$ctx_sid" = "" ] && ShyLogin
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
"history")
|
|
||||||
ctx_end=`history|tail -n1|awk '{print $1}'`
|
|
||||||
ctx_begin=${ctx_begin:=$ctx_end}
|
|
||||||
ctx_count=`expr $ctx_end - $ctx_begin`
|
|
||||||
ShyEcho "sync $ctx_begin-$ctx_end count $ctx_count to $ctx_dev"
|
|
||||||
history|tail -n $ctx_count |while read line; do
|
|
||||||
ShySends history sub "$line"
|
|
||||||
done
|
|
||||||
ctx_begin=$ctx_end
|
|
||||||
;;
|
|
||||||
ps) ShySend ps -ef ;;
|
|
||||||
*) ShySend "$@"
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
ShySyncs() {
|
|
||||||
case "$1" in
|
|
||||||
"base")
|
|
||||||
ShySync df &>/dev/null
|
|
||||||
ShySync ps &>/dev/null
|
|
||||||
ShySync env &>/dev/null
|
|
||||||
ShySync free &>/dev/null
|
|
||||||
ShySync history
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
ShyHelp() {
|
|
||||||
ShyPost cmd help arg "$@"
|
|
||||||
}
|
|
||||||
ShyInit() {
|
|
||||||
[ "$ctx_begin" = "" ] && ctx_begin=`history|tail -n1|awk '{print $1}'`
|
|
||||||
|
|
||||||
case "${SHELL##*/}" in
|
|
||||||
"zsh")
|
|
||||||
PROMPT='%![%*]%c$ '
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
PS1="\!-$$-\t[\u@\h]\W\$ "
|
|
||||||
PS1="\e[32m\!\e[0m-$$-\e[31m$SPY_OWNER\e[0m@\e[33m$SPY_ROLE\e[0m[\e[32m\t\e[0m]\W\$ "
|
|
||||||
PS1="\!-$$-\t[\u@\h]\W\$ "
|
|
||||||
PS1="\!-$$-\u@\h[\t]\W\$ "
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if bind &>/dev/null; then
|
|
||||||
bind -x '"\C-G\C-R":ShySyncs base'
|
|
||||||
bind -x '"\C-G\C-F":ShyFavor'
|
|
||||||
bind -x '"\C-Gf":ShyFavor'
|
|
||||||
bind -x '"\C-GF":ShyFavors'
|
|
||||||
elif bindkey &>/dev/null; then
|
|
||||||
bindkey -s '\C-G\C-R' 'ShySyncs base\n'
|
|
||||||
setopt nosharehistory
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "url: ${ctx_url}"
|
|
||||||
echo "pid: $$"
|
|
||||||
echo "begin: ${ctx_begin}"
|
|
||||||
echo "share: ${ctx_share}"
|
|
||||||
echo "pane: $TMUX_PANE"
|
|
||||||
}
|
|
||||||
|
|
||||||
ShyInit && trap ShyLogout EXIT
|
|
||||||
|
|
210
etc/auto.vim
210
etc/auto.vim
@ -1,210 +0,0 @@
|
|||||||
" 变量定义
|
|
||||||
func! ShyDefine(name, value)
|
|
||||||
if !exists("name") | exec "let " . a:name . " = \"" . a:value . "\"" | endif
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" 输出日志
|
|
||||||
call ShyDefine("g:ShyLog", "/dev/null")
|
|
||||||
fun! ShyLog(...)
|
|
||||||
call writefile([strftime("%Y-%m-%d %H:%M:%S ") . join(a:000, " ")], g:ShyLog, "a")
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 后端通信
|
|
||||||
call ShyDefine("g:ctx_sid", "")
|
|
||||||
call ShyDefine("g:ctx_url", (len($ctx_dev) > 1? $ctx_dev: "http://127.0.0.1:9020") . "/code/vim")
|
|
||||||
fun! ShySend(arg)
|
|
||||||
if has_key(a:arg, "sub") && a:arg["sub"] != ""
|
|
||||||
let temp = tempname()
|
|
||||||
call writefile(split(a:arg["sub"], "\n"), temp, "b")
|
|
||||||
let a:arg["sub"] = "@" . temp
|
|
||||||
endif
|
|
||||||
|
|
||||||
let a:arg["buf"] = bufname("%")
|
|
||||||
let a:arg["sid"] = g:ctx_sid
|
|
||||||
let a:arg["pwd"] = getcwd()
|
|
||||||
let args = ""
|
|
||||||
for k in sort(keys(a:arg))
|
|
||||||
let args = args . " -F '" . k . "=" . a:arg[k] . "' "
|
|
||||||
endfor
|
|
||||||
return system("curl -s " . g:ctx_url . args . " 2>/dev/null")
|
|
||||||
endfun
|
|
||||||
fun! ShySends(...)
|
|
||||||
let args = {}
|
|
||||||
if len(a:000) > 0 | let args["cmd"] = a:000[0] | endif
|
|
||||||
if len(a:000) > 1 | let args["arg"] = a:000[1] | endif
|
|
||||||
if len(a:000) > 2 | let args["sub"] = a:000[2] | endif
|
|
||||||
return ShySend(args)
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 用户登录
|
|
||||||
fun! ShyLogout()
|
|
||||||
if g:ctx_sid == "" | return | endif
|
|
||||||
call ShySends("logout")
|
|
||||||
endfun
|
|
||||||
fun! ShyLogin()
|
|
||||||
let g:ctx_sid = ShySend({"cmd": "login", "share": $ctx_share, "pid": getpid(), "pane": $TMUX_PANE, "hostname": hostname(), "username": $USER})
|
|
||||||
endfun
|
|
||||||
call ShyLogin()
|
|
||||||
|
|
||||||
" 收藏列表
|
|
||||||
fun! ShyFavor()
|
|
||||||
if !exists("g:favor_tab") | let g:favor_tab = "" | endif
|
|
||||||
if !exists("g:favor_note") | let g:favor_note = "" | endif
|
|
||||||
let g:favor_tab = input("tab: ", g:favor_tab)
|
|
||||||
let g:favor_note = input("note: ", g:favor_note)
|
|
||||||
call ShySend({"cmd": "favor", "tab": g:favor_tab, "note": g:favor_note, "arg": getline("."), "line": getpos(".")[1], "col": getpos(".")[2]})
|
|
||||||
endfun
|
|
||||||
fun! ShyFavors()
|
|
||||||
let res = split(ShySend({"cmd": "favor", "tab": input("tab: ")}), "\n")
|
|
||||||
let page = "" | let note = ""
|
|
||||||
for i in range(0, len(res)-1, 2)
|
|
||||||
if res[i] != page
|
|
||||||
if note != "" | lexpr note | lopen | let note = "" | endif
|
|
||||||
execute exists(":TabooOpen")? "TabooOpen " . res[i]: "tabnew"
|
|
||||||
endif
|
|
||||||
let page = res[i] | let note .= res[i+1] . "\n"
|
|
||||||
endfor
|
|
||||||
if note != "" | lexpr note | lopen | let note = "" | endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 数据同步
|
|
||||||
fun! ShySync(target)
|
|
||||||
if bufname("%") == "ControlP" | return | end
|
|
||||||
|
|
||||||
if a:target == "read" || a:target == "write"
|
|
||||||
call ShySend({"cmd": a:target, "arg": expand("<afile>")})
|
|
||||||
elseif a:target == "exec"
|
|
||||||
call ShySend({"cmd": a:target, "arg": getcmdline()})
|
|
||||||
elseif a:target == "insert"
|
|
||||||
call ShySend({"cmd": a:target, "sub": getreg("."), "row": line("."), "col": col(".")})
|
|
||||||
else
|
|
||||||
let cmd = {"bufs": "buffers", "regs": "registers", "marks": "marks", "tags": "tags", "fixs": "clist"}
|
|
||||||
call ShySend({"cmd": "sync", "arg": a:target, "sub": execute(cmd[a:target])})
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
fun! ShyCheck(target)
|
|
||||||
if a:target == "cache"
|
|
||||||
call ShySync("bufs")
|
|
||||||
call ShySync("regs")
|
|
||||||
call ShySync("marks")
|
|
||||||
call ShySync("tags")
|
|
||||||
elseif a:target == "fixs"
|
|
||||||
let l = len(getqflist())
|
|
||||||
if l > 0
|
|
||||||
execute "copen " . (l > 10? 10: l + 1)
|
|
||||||
call ShySync("fixs")
|
|
||||||
else
|
|
||||||
cclose
|
|
||||||
end
|
|
||||||
end
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 任务列表
|
|
||||||
fun! ShyTask()
|
|
||||||
call ShySend({"cmd": "tasklet", "arg": input("target: "), "sub": input("detail: ")})
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 标签列表
|
|
||||||
fun! ShyGrep(word)
|
|
||||||
if !exists("g:grep_dir") | let g:grep_dir = "./" | endif
|
|
||||||
let g:grep_dir = input("dir: ", g:grep_dir, "file")
|
|
||||||
execute "grep -rn --exclude tags --exclude '*.tags' '\<" . a:word . "\>' " . g:grep_dir
|
|
||||||
endfun
|
|
||||||
fun! ShyTag(word)
|
|
||||||
execute "tag " . a:word
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 输入转换
|
|
||||||
fun! ShyTrans(code)
|
|
||||||
return split(ShySend({"cmd": "trans", "arg": a:code, "pre": getline("."), "row": line("."), "col": col(".")}), "\n")
|
|
||||||
endfun
|
|
||||||
fun! ShyInput()
|
|
||||||
call ShyLog("input", v:char, line("."), col("."))
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 输入补全
|
|
||||||
fun! ShyComplete(firststart, base)
|
|
||||||
if a:firststart | let line = getline('.') | let start = col('.') - 1
|
|
||||||
" 命令位置
|
|
||||||
if match(line, '\s*ice ') == 0 | return match(line, "ice ") | endif
|
|
||||||
" 符号位置
|
|
||||||
if line[start-1] !~ '\a' | return start - 1 | end
|
|
||||||
" 单词位置
|
|
||||||
while start > 0 && line[start - 1] =~ '\a' | let start -= 1 | endwhile
|
|
||||||
return start
|
|
||||||
endif
|
|
||||||
|
|
||||||
" 符号转换
|
|
||||||
if a:base == "," | return [",", ","] | end
|
|
||||||
if a:base == "." | return ["。", "."] | end
|
|
||||||
if a:base == "\\" | return ["、", "\\"] | end
|
|
||||||
" 单词转换
|
|
||||||
let list = ShyTrans(a:base)
|
|
||||||
call ShyLog("trans", a:base, list)
|
|
||||||
return list
|
|
||||||
endfun
|
|
||||||
set completefunc=ShyComplete
|
|
||||||
|
|
||||||
" 自动刷新
|
|
||||||
let ShyComeList = {}
|
|
||||||
fun! ShyCome(buf, row, action, extra)
|
|
||||||
if a:action == "refresh"
|
|
||||||
" 清空历史
|
|
||||||
if a:extra["count"] > 0 | call deletebufline(a:buf, a:row+1, a:row+a:extra["count"]) | endif
|
|
||||||
let a:extra["count"] = 0
|
|
||||||
endif
|
|
||||||
" 刷新命令
|
|
||||||
for line in reverse(split(ShySend({"cmd": "trans", "arg": getbufline(a:buf, a:row)[0]}), "\n"))
|
|
||||||
call appendbufline(a:buf, a:row, line)
|
|
||||||
let a:extra["count"] += 1
|
|
||||||
endfor
|
|
||||||
" 插入表头
|
|
||||||
call appendbufline(a:buf, a:row, strftime(" ~~ %Y-%m-%d %H:%M:%S"))
|
|
||||||
let a:extra["count"] += 1
|
|
||||||
endfun
|
|
||||||
fun! ShyUpdate(timer)
|
|
||||||
let what = g:ShyComeList[a:timer]
|
|
||||||
call ShyLog("timer", a:timer, what)
|
|
||||||
call ShyCome(what["buf"], what["row"], what["action"], what)
|
|
||||||
endfun
|
|
||||||
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 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 g:ShyComeList[b:timer] = {"buf": bufname("."), "row": line("."), "pre": getline("."), "action": a:action, "count": 0}
|
|
||||||
call ShyLog("new timer", b:timer)
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 帮助信息
|
|
||||||
fun! ShyHelp()
|
|
||||||
echo ShySend({"cmd": "help"})
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" 事件回调
|
|
||||||
autocmd! VimLeave * call ShyLogout()
|
|
||||||
autocmd! BufReadPost * call ShySync("bufs")
|
|
||||||
autocmd! BufReadPost * call ShySync("read")
|
|
||||||
autocmd! BufWritePre * call ShySync("write")
|
|
||||||
autocmd! CmdlineLeave * call ShySync("exec")
|
|
||||||
autocmd! QuickFixCmdPost * call ShyCheck("fixs")
|
|
||||||
autocmd! InsertLeave * call ShySync("insert")
|
|
||||||
autocmd! InsertCharPre * call ShyInput()
|
|
||||||
|
|
||||||
" 按键映射
|
|
||||||
nnoremap <C-G><C-G> :call ShyGrep(expand("<cword>"))<CR>
|
|
||||||
nnoremap <C-G><C-R> :call ShyCheck("cache")<CR>
|
|
||||||
nnoremap <C-G><C-F> :call ShyFavor()<CR>
|
|
||||||
nnoremap <C-G>f :call ShyFavors()<CR>
|
|
||||||
nnoremap <C-G><C-T> :call ShyTask()<CR>
|
|
||||||
nnoremap <C-G><C-K> :call ShyComes("refresh")<CR>
|
|
||||||
inoremap <C-K> <C-X><C-U>
|
|
||||||
|
|
4
etc/exit.shy
Normal file
4
etc/exit.shy
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
~web.code.input
|
||||||
|
save person
|
||||||
|
|
||||||
|
|
26
etc/init.shy
Normal file
26
etc/init.shy
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
~web.code
|
||||||
|
publish etc/auto.sh
|
||||||
|
publish etc/auto.vim
|
||||||
|
|
||||||
|
~web.code.tmux
|
||||||
|
init
|
||||||
|
|
||||||
|
~web.code.docker
|
||||||
|
init
|
||||||
|
|
||||||
|
~web.code.git
|
||||||
|
repos toolkits usr/toolkits
|
||||||
|
repos icebergs usr/icebergs
|
||||||
|
repos learning usr/learning
|
||||||
|
repos wubi-dict usr/wubi-dict
|
||||||
|
init
|
||||||
|
|
||||||
|
~web.code.input
|
||||||
|
load usr/wubi-dict/person
|
||||||
|
load
|
||||||
|
|
||||||
|
~web.wiki
|
||||||
|
config word meta.path usr/learning
|
||||||
|
|
||||||
|
~ssh
|
||||||
|
source etc/local.shy
|
16
go.mod
16
go.mod
@ -1,15 +1,9 @@
|
|||||||
module miss
|
module contexts
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require github.com/shylinux/icebergs v0.1.15 // indirect
|
||||||
github.com/shylinux/contexts v0.0.0-00010101000000-000000000000
|
|
||||||
github.com/shylinux/icebergs v0.1.9
|
|
||||||
github.com/shylinux/toolkits v0.1.0
|
|
||||||
)
|
|
||||||
|
|
||||||
replace (
|
replace github.com/shylinux/icebergs => ./usr/icebergs
|
||||||
github.com/shylinux/contexts => ./
|
|
||||||
github.com/shylinux/icebergs => ./usr/icebergs
|
replace github.com/shylinux/toolkits => ./usr/toolkits
|
||||||
github.com/shylinux/toolkits => ./usr/toolkits
|
|
||||||
)
|
|
||||||
|
9
go.sum
9
go.sum
@ -2,11 +2,10 @@ 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.15 h1:91PvNU8vN/WYirN1lZ4lWu0Cf8rWKUYVFvMpj2f1ERw=
|
||||||
github.com/shylinux/icebergs v0.1.12 h1:pUWWp4p5rF1JT7lcbaBlCJOWzwjPYDzmWcO9+nrNsfs=
|
github.com/shylinux/icebergs v0.1.15/go.mod h1:DlvFxCjJFfvDIzhN5rKBwObRLRiztu3uwXQ5P7KfnTo=
|
||||||
github.com/shylinux/icebergs v0.1.12/go.mod h1:/gccR5uyFaaml8CBSD4BfHmIPOK6QlaFp3sK4eOiv4s=
|
github.com/shylinux/toolkits v0.1.1 h1:w/EjFjRB4V/fIRGXl3zU8MEf647DH2oLswTwGIwF3VM=
|
||||||
github.com/shylinux/toolkits v0.1.0 h1:7ghnVEjuwLf7zBsyeR37ahm2gaOKIyjSw9F9Pp9oTBU=
|
github.com/shylinux/toolkits v0.1.1/go.mod h1:Y68Ot6xOmo1bun67YvqC3chDGeU2gDxtsUnvVDGJm4g=
|
||||||
github.com/shylinux/toolkits v0.1.0/go.mod h1:Y68Ot6xOmo1bun67YvqC3chDGeU2gDxtsUnvVDGJm4g=
|
|
||||||
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086 h1:RYiqpb2ii2Z6J4x0wxK46kvPBbFuZcdhS+CIztmYgZs=
|
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086 h1:RYiqpb2ii2Z6J4x0wxK46kvPBbFuZcdhS+CIztmYgZs=
|
||||||
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
|
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
|
||||||
golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ=
|
golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ=
|
||||||
|
@ -7,12 +7,11 @@ import (
|
|||||||
_ "github.com/shylinux/icebergs/misc"
|
_ "github.com/shylinux/icebergs/misc"
|
||||||
|
|
||||||
_ "github.com/shylinux/icebergs/misc/alpha"
|
_ "github.com/shylinux/icebergs/misc/alpha"
|
||||||
|
_ "github.com/shylinux/icebergs/misc/chrome"
|
||||||
_ "github.com/shylinux/icebergs/misc/lark"
|
_ "github.com/shylinux/icebergs/misc/lark"
|
||||||
_ "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() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user