Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
05da892c
Commit
05da892c
authored
10 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
On writing fzf-tmux combo
parent
f6b1a627
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+33
-0
33 additions, 0 deletions
README.md
with
33 additions
and
0 deletions
README.md
+
33
−
0
View file @
05da892c
...
...
@@ -487,6 +487,39 @@ fzf() {
}
```
### Using fzf with tmux splits
It isn't too hard to write your own fzf-tmux combo like the default
CTRL-T key binding. (Or is it?)
```
sh
# This is a helper function that splits the current pane to start the given
# command ($1) and sends its output back to the original pane with any number of
# optional keys (shift; $*).
fzf_tmux_helper
()
{
[
-n
"
$TMUX_PANE
"
]
||
return
local
cmd
=
$1
shift
tmux split-window
-p
40
\
"bash -c
\"\$
(tmux send-keys -t
$TMUX_PANE
\"\$
(source ~/.fzf.bash;
$cmd
)
\"
$*
)
\"
"
}
# This is the function we are going to run in the split pane.
# - "find" to list the directories
# - "sed" will escape spaces in the paths.
# - "paste" will join the selected paths into a single line
fzf_tmux_dir
()
{
fzf_tmux_helper
\
'find * -path "*/\.*" -prune -o -type d -print 2> /dev/null |
fzf --multi |
sed "s/ /\\\\ /g" |
paste -sd" " -'
Space
}
# Bind CTRL-X-CTRL-D to fzf_tmux_dir
bind
'"\C-x\C-d": "$(fzf_tmux_dir)\e\C-e"'
```
### Fish shell
It's
[
a known bug of fish
](
https://github.com/fish-shell/fish-shell/issues/1362
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment