Skip to content

Instantly share code, notes, and snippets.

View yixizhang's full-sized avatar

Yixi Zhang yixizhang

  • bay area
View GitHub Profile
@yixizhang
yixizhang / _readme.md
Created May 30, 2017 02:03 — forked from mislav/_readme.md
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

def comb(n, k):
if k == n:
return [[1 for _ in range(n)]]
if k > n:
return False
if k == 0:
return [[0 for _ in range(n)]]
if k == 1:
ret = []
for i in range(n):