1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

add vim.Favor

This commit is contained in:
shaoying 2019-11-12 09:50:01 +08:00
parent 7f1e4d2927
commit ae04d14640
4 changed files with 28 additions and 5 deletions

View File

@ -74,6 +74,14 @@ fun! Shy(action, target)
endif
endfun
fun! ShyFavor(note)
if a:note == ""
call ShyPost({"cmd": "favor", "arg": getline("."), "line": getpos(".")[1], "col": getpos(".")[2]})
else
call ShyPost({"cmd": "favor", "note": input("note: "), "arg": getline("."), "line": getpos(".")[1], "col": getpos(".")[2]})
endif
endfun
fun! ShyLogout()
call Shy("logout", "")
let g:ctx_sid = ""
@ -94,8 +102,11 @@ call ShySync("regs")
call ShySync("marks")
call ShySync("tags")
" call ShySync("fixs")
"
nnoremap <C-R><C-R> :call ShyCheck("cache")<CR>
nnoremap <C-R><C-F> :call ShyCheck("favor")<CR>
nnoremap <C-R>F :call ShyFavor("note")<CR>
nnoremap <C-R>f :call ShyFavor("")<CR>
" autocmd BufUnload * call Shy("close", expand("<afile>")) | call ShySync("bufs")
" autocmd CmdlineLeave *

View File

@ -410,6 +410,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
switch arg[0] {
case "show":
if arg[1] == "" {
arg = arg[:1]
}
switch len(arg) {
case 1: // 数据库
m.Confm("flow", []string{m.Option("river"), "data"}, func(key string, value map[string]interface{}) {

View File

@ -830,7 +830,16 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
case "favor":
m.Option("river", m.Conf(cmd, []string{"editor", "hash", m.Option("sid"), "river"}))
m.Cmd("ssh.data", "show", m.Conf(cmd, []string{"editor", "hash", m.Option("sid"), "table"})).Table(func(index int, value map[string]string) {
table := m.Conf(cmd, []string{"editor", "hash", m.Option("sid"), "table"})
if m.Options("line") {
m.Cmd("ssh.data", "insert", table,
"note", m.Option("note"), "word", m.Option("arg"),
"file", m.Option("buf"), "line", m.Option("line"), "col", m.Option("col"),
)
return
}
m.Cmd("ssh.data", "show", table).Table(func(index int, value map[string]string) {
m.Echo("%v:%v:0:(%v): %v\n", value["file"], value["line"], value["note"], value["word"])
}).Set("append")
return

View File

@ -1,14 +1,14 @@
fun tips "便签" private \
select "" name "action" values "show" values "insert" values "update" \
text "tip" name table \
text "tip" name table imports plugin_vim_table action auto \
text "" name index imports plugin_view_tip_id view tiny \
text "" name file imports plugin_vim_file view long \
text "" name line imports plugin_vim_line view tiny \
text "" name word imports plugin_vim_word view long \
textarea "" name note \
feature detail "修改" "复制" "下载" \
exports tip_id id "" vim_file file "" vim_line line "" vim_word word "" \
exports vim_table table "" tip_id id "" vim_file file "" vim_line line "" vim_word word "" \
button "记录" action auto
if $1 == "show"
@ -26,8 +26,8 @@ fun tips "便签" private \
end
kit editor "编辑器" private "web.code.vim" editor \
text "" name sid imports plugin_vim_sid \
text "" name favor \
text "" name sid imports plugin_vim_sid action auto \
text "" name table imports plugin_vim_table \
text "times sids status pid pane" name fields \
exports vim_sid sid \
button "查看" action auto