Skip to content

Commit d9b69ea

Browse files
committed
fix: improve annoy blink
1 parent 4564dd2 commit d9b69ea

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ A: **This one can jump between panes**
1515

1616
```bash
1717
# Basic binding
18-
bind s run-shell "tmux neww ~/.tmux-easymotion/easymotion.py"
18+
bind s run-shell "tmux neww -d ~/.tmux-easymotion/easymotion.py"
1919

2020
# Or with custom environment variables
21-
bind s run-shell "tmux neww TMUX_EASYMOTION_KEYS='asdfjkl;' ~/.tmux-easymotion/easymotion.py"
21+
bind s run-shell "tmux neww -d 'TMUX_EASYMOTION_KEYS=asdfjkl; ~/.tmux-easymotion/easymotion.py'"
2222

2323
# Vim-like binding
2424
set-window-option -g mode-keys vi

easymotion.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def get_initial_tmux_info():
238238
'#{pane_top},#{pane_height},#{pane_left},#{pane_width},' + \
239239
'#{pane_in_mode},#{scroll_position}'
240240

241-
cmd = ['tmux', 'list-panes', '-F', format_str, '-t', '{last}']
241+
cmd = ['tmux', 'list-panes', '-F', format_str]
242242
output = sh(cmd).strip()
243243

244244
panes_info = []
@@ -294,17 +294,7 @@ def __init__(self, pane_id, start_y, height, start_x, width):
294294
def tmux_pane_id():
295295
# Get the ID of the pane that launched this script
296296
source_pane = os.environ.get('TMUX_PANE')
297-
if not source_pane:
298-
return '%0'
299-
300-
# We're in a new window, get the pane from the previous window
301-
previous_pane = sh(
302-
['tmux', 'list-panes', '-F', '#{pane_id}', '-t', '{last}']).strip()
303-
if re.match(r'%\d+', previous_pane):
304-
return previous_pane.split('\n')[0]
305-
306-
# Fallback to current pane if can't get previous
307-
return sh(['tmux', 'display-message', '-p', '#{pane_id}']).strip()
297+
return source_pane or '%0'
308298

309299

310300
def get_terminal_size():
@@ -494,6 +484,7 @@ def main(screen: Screen):
494484

495485
draw_all_panes(panes, max_x, padding_cache, terminal_height, screen)
496486
screen.refresh()
487+
sh(['tmux', 'select-window', '-t', '{end}'])
497488

498489
hints = generate_hints(KEYS)
499490
search_ch = getch()

0 commit comments

Comments
 (0)