kevinhwang91 / fzf-tmux-script Goto Github PK
View Code? Open in Web Editor NEWfzf tmux scripts
License: BSD 3-Clause "New" or "Revised" License
fzf tmux scripts
License: BSD 3-Clause "New" or "Revised" License
I used this minimal config with tmux -f [config]
set -s focus-events on
# install powerline
# set ctrl space as command
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
# some stuff
set -g default-terminal "tmux-256color"
# set -g default-terminal 'screen-256color'
set -g history-limit 10000
set -s focus-events on
# replace ~/.local/bin/fzf-panes.tmux to your path of fzf-panes.tmux
if-shell '[ -f ~/.tmux/scripts/fzf-panes.tmux ]' {
# if you want to exclude specified session, please set @fzf_panes_ex_session_pat
# for example, value equal to '^(floating)$', will exclude panes in session named 'floating'
# set -g '@fzf_panes_ex_session_pat' '^(floating)$'
set-hook -g pane-focus-in[10] \
"run -b 'bash ~/.tmux/scripts/fzf-panes.tmux update_mru_pane_ids'"
bind w run -b 'bash ~/.tmux/scripts/fzf-panes.tmux new_window'
bind \; run -b 'bash ~/.tmux/scripts/fzf-panes.tmux selectscripts/f_last_pane'
} {
set-hook -ug pane-focus-in[10]
bind w choose-tree -Z
}
And instead of my prompt I get lines like %2 %1
placed in copied mode when starting up and when pressing prefix+w. After pressing a few enters I get to the search panes window, but there are no panes in it, even though I have 3 open.
I'm using the latest tmux from the repo, but the no panes showing up thing was already present in 3.1c. Do you have any idea what might be going on? Your tool looks really cool and I'd like to use it :)
fzfp
does not seem to work when I set $FZF_DEFAULT_OPTS
using multi-lines.
export FZF_DEFAULT_OPTS='
--ansi
--reverse
--bind=ctrl-a:toggle-all
--bind=ctrl-alt-j:preview-down
--bind=ctrl-alt-k:preview-up
--bind=ctrl-d:preview-page-down
--bind=ctrl-u:preview-page-up
--bind=alt-bs:clear-query
--bind=ctrl-h:deselect
--bind=ctrl-l:select
--color fg:#F8F8F2
--color fg+:#F8F8F2
--color bg:-1
--color bg+:-1
--color hl:#50FA7B
--color hl+:#FFB86C
--color info:#BD93F9
--color prompt:#50FA7B
--color pointer:#FF79C6
--color marker:#FF5555
--color spinner:#8BE9FD
--color header:#8BE9FD
'
But if I use J in vim to join the lines into one line, it works. If I echo $FZF_DEFAULT_OPTS
in each case, they are identical.
I generally script the creation of tmux sessions(windows/panes). So i dont "go-inside" to all the panes that were created.
The error i'm getting is reproducible:
Bellow i show you a screenshot in which i know to be 4 panes across 2 windows, but fzf-tmux-pane only sees the first one with the focus on.
Now i went manually and focused every pane and rerun the Prefix+w, which makes it see all the other panes.
Thank you for the scripts! :)
I get an error running the popup though:
$ ls --color=always | fzfp --ansi --width=50% --height=50%
unknown option: --width=50%
Tmux version: 3.1c
Thanks again!
[~]$ dpkg -l '*ncurses*' | grep '^ii'
ii libncurses6:amd64 6.3-2 amd64 shared libraries for terminal handling
ii libncursesw6:amd64 6.3-2 amd64 shared libraries for terminal handling (wide character support)
ii ncurses-base 6.3-2 all basic terminal type definitions
ii ncurses-bin 6.3-2 amd64 terminal-related programs and man pages
configure.ac:47: warning: The macro `AC_PROG_CC_C99' is obsolete.
configure.ac:47: You should run autoupdate.
./lib/autoconf/c.m4:1659: AC_PROG_CC_C99 is expanded from...
configure.ac:47: the top level
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for bison... bison -y
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for bitstring.h... no
checking for dirent.h... yes
checking for fcntl.h... yes
checking for inttypes.h... (cached) yes
checking for libproc.h... no
checking for libutil.h... no
checking for ndir.h... no
checking for paths.h... yes
checking for pty.h... yes
checking for stdint.h... (cached) yes
checking for sys/dir.h... yes
checking for sys/ndir.h... no
checking for sys/tree.h... no
checking for ucred.h... no
checking for util.h... no
checking for library containing sys_signame... no
checking for fmod in -lm... yes
checking for library containing flock... none required
checking for dirfd... yes
checking for flock... yes
checking for prctl... yes
checking for proc_pidinfo... no
checking for getpeerucred... no
checking for sysconf... yes
checking for asprintf... yes
checking for cfmakeraw... yes
checking for clock_gettime... yes
checking for closefrom... yes
checking for explicit_bzero... yes
checking for fgetln... no
checking for freezero... no
checking for getdtablecount... no
checking for getdtablesize... yes
checking for getpeereid... no
checking for getline... yes
checking for getprogname... no
checking for memmem... yes
checking for setenv... yes
checking for setproctitle... no
checking for strcasestr... yes
checking for strlcat... no
checking for strlcpy... no
checking for strndup... yes
checking for strsep... yes
checking for working strnlen... yes
checking for working strtonum... no
checking for working reallocarray... yes
checking for working recallocarray... no
checking for library containing clock_gettime... none required
checking for libevent_core >= 2... yes
checking for event2/event.h... yes
checking for tinfo... no
checking for ncurses... no
checking for ncursesw... no
checking for library containing setupterm... no
checking for setupterm in -lcurses... no
checking for curses.h... no
configure: error: "curses not found"```
</p>
</details>
I am having trouble replicating the functionality you showcased in your 'popups' demonstration video (https://user-images.githubusercontent.com/17562139/77829950-406e7000-7160-11ea-85aa-0f966feeb237.gif)
Could you please share your .tmux.conf, fzfp wrapper scripts, and any other configuration that makes this possible? For example, opening a file selected inside of the popup window inside of a vim buffer. Not sure how you are performing different send-keys functions on the same popup?
CONFIG PLZ :)
After following the installation instructions and pressing prefix+w, I was presented with an empty window:
During troubleshooting, I struck two different issues
panes_info=$(tmux list-panes -aF \
'#D #{s| |_|:#{=|9|…:session_name}} #I.#P#{?window_zoomed_flag,⬢,❄} #{pane_tty} #{pane_current_path} #T' |
sed -E "/^$cur_id /d")
ttys=$(awk '{printf("%s,", $4)}' <<<$panes_info | sed 's/,$//')
ttys
somehow translated to what was in #{pane_current_path}
, not #{pane_tty}
. This is because the second column of panes_info
#{s| |_|:#{=|9|…:session_name}}
actually isn't being populated. When I try tmux display-message -p '#{s| |_|:#{=|9|…:session_name}}'
I get an empty result. I couldn't figure out how to format that to get the same result you are getting, so I worked around it by replacing with #{session_name}
(I currently don't use spaces when naming sessions)
Fixing that, next issue:
ps_info=$(ps -t$ttys -o stat,pid,pcpu,mem,thcount,time,tname,cmd |
awk '$1~/\+/ {$1="";print $0}')
Here, I received an issue error: unknown user-defined format specifier "mem"
. Consulting the docs of the regular ps
bundled on arch linux, I replaced mem
with pmem
and it finally seems like my installation somewhat replicates the use case screencasts.
program is working, but configuration code is throwing errors in fish shell. can you please give equivalent fish code for configuration ?
Try it yourself. There are too many possible variables.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.