From bddad6839c0a1e6c9c34c304cab7bb842954c7ab Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 12 Nov 2019 20:37:31 +0800 Subject: [PATCH] add some --- etc/conf/auto.sh | 8 +++++--- etc/conf/tmux.conf | 4 ++-- src/contexts/ctx/misc.go | 4 ++-- src/examples/code/code.go | 7 +++++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/etc/conf/auto.sh b/etc/conf/auto.sh index b092cadb..0e43d902 100644 --- a/etc/conf/auto.sh +++ b/etc/conf/auto.sh @@ -10,7 +10,7 @@ ctx_sync=${ctx_sync:=""} ctx_sid=${ctx_sid:=""} ctx_welcome=${ctx_welcome:="^_^ Welcome to Context world ^_^"} -ctx_goodbye=${ctx_goodbye:="^_^ Welcome to Context world ^_^"} +ctx_goodbye=${ctx_goodbye:="^_^ Goodbye to Context world ^_^"} ShyWord() { echo "$*"|sed -e 's/\ /%20/g' -e 's/\n/\\n/g' @@ -139,17 +139,19 @@ ShyLogin() { echo "url: ${ctx_url}" echo "sid: ${ctx_sid:0:6}" echo "pid: $$" + echo "pane: $TMUX_PANE" echo "begin: ${ctx_begin}" } ShyInit() { + ctx_begin=`cat $HISTFILE|wc -l` case "$SHELL" in "/bin/zsh");; *) ctx_begin=`history|tail -n1|awk '{print $1}'` bind -x '"\C-t":ShySyncs base' # bind -x '"\C-gl":ShySync input' - # PS1="\!-\t[\u@\h]\W\$ " - PS1="\!-\t\$ " + PS1="\!-\t[\u@\h]\W\$ " + # PS1="\!-\t\$ " ;; esac } diff --git a/etc/conf/tmux.conf b/etc/conf/tmux.conf index f2d40912..fd6ff00e 100644 --- a/etc/conf/tmux.conf +++ b/etc/conf/tmux.conf @@ -17,8 +17,8 @@ set -g set-titles on set -g set-titles-string "#(whoami)@#h/#{session_name}:#{window_name}.#{pane_index} #{pane_current_command}" set -g status-interval 1 -set -g status-left-length 200 -set -g status-right-length 200 +set -g status-left-length 60 +set -g status-right-length 60 # set -g status-left "#[bg=red]\ [#H/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ " set -g status-left "#[bg=red]\ [#h/#S]\ #[bg=yellow]\ [#{cursor_y},#{cursor_x};#{pane_height},#{pane_width}]\ " set -g status-right "#[bg=yellow]\ [#(date '+%Y-%m-%d %H:%M:%S')]\ #[bg=red]\ [#{pane_current_path}]\ " diff --git a/src/contexts/ctx/misc.go b/src/contexts/ctx/misc.go index 2634cdc8..0e326ea8 100644 --- a/src/contexts/ctx/misc.go +++ b/src/contexts/ctx/misc.go @@ -601,7 +601,7 @@ func (m *Message) Grows(key string, args interface{}, cb interface{}) map[string begin := end - limit data := make([]interface{}, 0, limit) - m.Log("info", "read current %v+%d %v-%v", current, len(list), begin, end) + m.Log("info", "read %v-%v from %v-%v", begin, end, current, current+len(list)) if begin < current { store, _ := meta["record"].([]interface{}) for s := len(store) - 1; s > -1; s-- { @@ -660,8 +660,8 @@ func (m *Message) Grows(key string, args interface{}, cb interface{}) map[string if begin < current { begin = current } + m.Log("info", "cache %v-%v", begin-current, end-current) for i := begin - current; i < end-current; i++ { - m.Log("info", "cache data %v %v", i+current, list[i]) data = append(data, list[i]) } return kit.Map(map[string]interface{}{"meta": meta, "list": data}, "", cb) diff --git a/src/examples/code/code.go b/src/examples/code/code.go index d6ee1919..83e12529 100644 --- a/src/examples/code/code.go +++ b/src/examples/code/code.go @@ -290,6 +290,9 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心", m.Push(fields, kit.Shortm(value, "times", "files", "sids")) } }) + if arg[0] == "df" { + m.Sort("size", "int_r") + } m.Table() case "free": if len(arg) > 3 { @@ -753,11 +756,11 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心", } fallthrough case "editor": - if arg[2] != "" { + if len(arg) > 2 && arg[2] != "" { m.Conf(cmd, []string{arg[0], "hash", arg[1], "table"}, arg[2]) m.Conf(cmd, []string{arg[0], "hash", arg[1], "river"}, m.Option("river")) } - if arg[1] != "" { + if len(arg) > 1 && arg[1] != "" { m.Option("table.format", "table") m.Confm(cmd, []string{arg[0], "hash", arg[1]}, func(key string, value string) { m.Push(key, value)