Example #1
0
def set_bindings(prefix_cmd, keys):
    tmux_cmd("bind-key -n Up run-shell -b", prefix_cmd % "-k Up")
    tmux_cmd("bind-key -n Down run-shell -b", prefix_cmd % "-k Down")
    tmux_cmd("bind-key -t emacs-copy Escape copy-pipe",
             prefix_cmd % "-k Escape")
    for k in keys:
        tmux_cmd("bind-key -t emacs-copy %s copy-pipe" % k,
                 prefix_cmd % ("-c %s" % k))
Example #2
0
def list_selection(prefix, argv, list_func, callback):
    prefix_cmd = prefix + " %s"
    if argv:
        if argv[0] == "-s":
            res = list_func(*argv[1:])
            list_show(res)
            tmux_cmd("copy-mode")
            set_bindings(prefix_cmd, callback.keys())
            tmux_send_keys("M-R C-a C-Space C-e")
            raw_input()
        elif argv[0] == "-c":
            with_selection(callback[argv[1]], callback.keys())
        elif argv[0] == "-k":
            if argv[1] == "Up":
                jump_prev()
            elif argv[1] == "Down":
                jump_next()
            elif argv[1] == "Escape":
                tmux_send_keys("Enter")
        else:
            start_list_selection(prefix_cmd, argv)
    else:
        start_list_selection(prefix_cmd, argv)
Example #3
0
def list_selection(prefix, argv, list_func, callback):
    prefix_cmd = prefix + " %s"
    if argv:
        if argv[0] == "-s":
            res = list_func(*argv[1:])
            list_show(res)
            tmux_cmd("copy-mode")
            set_bindings(prefix_cmd, callback.keys())
            tmux_send_keys("M-R C-a C-Space C-e")
            raw_input()
        elif argv[0] == "-c":
            with_selection(callback[argv[1]], callback.keys())
        elif argv[0] == "-k":
            if argv[1] == "Up":
                jump_prev()
            elif argv[1] == "Down":
                jump_next()
            elif argv[1] == "Escape":
                tmux_send_keys("Enter")
        else:
            start_list_selection(prefix_cmd, argv)
    else:
        start_list_selection(prefix_cmd, argv)
Example #4
0
def start_list_selection(prefix_cmd, argv):
    tmux_cmd("split-window -h -l 30", prefix_cmd % ("-s %s" % " ".join(argv)))
Example #5
0
def unset_bindings(keys):
    tmux_cmd("unbind-key -n Up")
    tmux_cmd("unbind-key -n Down")
    tmux_cmd("unbind-key -t emacs-copy Escape")
    for k in keys:
        tmux_cmd("unbind-key -t emacs-copy %s" % k)
Example #6
0
def start_list_selection(prefix_cmd, argv):
    tmux_cmd("split-window -h -l 30", prefix_cmd % ("-s %s" % " ".join(argv)))
Example #7
0
def unset_bindings(keys):
    tmux_cmd("unbind-key -n Up")
    tmux_cmd("unbind-key -n Down")
    tmux_cmd("unbind-key -t emacs-copy Escape")
    for k in keys:
        tmux_cmd("unbind-key -t emacs-copy %s" % k)
Example #8
0
def set_bindings(prefix_cmd, keys):
    tmux_cmd("bind-key -n Up run-shell -b", prefix_cmd % "-k Up")
    tmux_cmd("bind-key -n Down run-shell -b", prefix_cmd % "-k Down")
    tmux_cmd("bind-key -t emacs-copy Escape copy-pipe", prefix_cmd % "-k Escape")
    for k in keys:
        tmux_cmd("bind-key -t emacs-copy %s copy-pipe" % k, prefix_cmd % ("-c %s" % k))