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
ac0a62e4
Commit
ac0a62e4
authored
9 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Plain Diff
Merge pull request #446 from chaoren/master
Fix CTRL-T in tmux
parents
a07944a5
54b4b0c5
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
shell/key-bindings.bash
+21
-5
21 additions, 5 deletions
shell/key-bindings.bash
with
21 additions
and
5 deletions
shell/key-bindings.bash
+
21
−
5
View file @
ac0a62e4
...
...
@@ -25,7 +25,15 @@ __fzf_select_tmux__() {
else
height
=
"-l
$height
"
fi
tmux split-window
$height
"cd
$(
printf
%q
"
$PWD
"
)
; FZF_CTRL_T_COMMAND=
$(
printf
%q
"
$FZF_CTRL_T_COMMAND
"
)
bash -c 'source ~/.fzf.bash; tmux send-keys -t
$TMUX_PANE
\"\$
(__fzf_select__)
\"
'"
tmux split-window
$height
"cd
$(
printf
%q
"
$PWD
"
)
; PATH=
$(
printf
%q
"
$PATH
"
)
FZF_CTRL_T_COMMAND=
$(
printf
%q
"
$FZF_CTRL_T_COMMAND
"
)
bash -c 'source
\"
${
BASH_SOURCE
[0]
}
\"
; tmux send-keys -t
$TMUX_PANE
\"\$
(__fzf_select__)
\"
'"
}
__fzf_select_tmux_auto__
()
{
if
[
${
FZF_TMUX
:-
1
}
-ne
0
-a
${
LINES
:-
40
}
-gt
15
]
;
then
__fzf_select_tmux__
else
tmux send-keys
-t
$TMUX_PANE
"
$(
__fzf_select__
)
"
fi
}
__fzf_cd__
()
{
...
...
@@ -50,7 +58,11 @@ __fzf_history__() (
)
__use_tmux
=
0
[
-n
"
$TMUX_PANE
"
-a
${
FZF_TMUX
:-
1
}
-ne
0
-a
${
LINES
:-
40
}
-gt
15
]
&&
__use_tmux
=
1
__use_tmux_auto
=
0
if
[
-n
"
$TMUX_PANE
"
]
;
then
[
${
FZF_TMUX
:-
1
}
-ne
0
-a
${
LINES
:-
40
}
-gt
15
]
&&
__use_tmux
=
1
[
$BASH_VERSINFO
-gt
3
]
&&
__use_tmux_auto
=
1
fi
if
[
-z
"
$(
set
-o
|
\g
rep
'^vi.*on'
)
"
]
;
then
# Required to refresh the prompt after fzf
...
...
@@ -58,7 +70,9 @@ if [ -z "$(set -o | \grep '^vi.*on')" ]; then
bind
'"\e^": history-expand-line'
# CTRL-T - Paste the selected file path into the command line
if
[
$__use_tmux
-eq
1
]
;
then
if
[
$__use_tmux_auto
-eq
1
]
;
then
bind
-x
'"\C-t": "__fzf_select_tmux_auto__"'
elif
[
$__use_tmux
-eq
1
]
;
then
bind
'"\C-t": " \C-u \C-a\C-k$(__fzf_select_tmux__)\e\C-e\C-y\C-a\C-d\C-y\ey\C-h"'
else
bind
'"\C-t": " \C-u \C-a\C-k$(__fzf_select__)\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er \C-h"'
...
...
@@ -76,7 +90,9 @@ else
# CTRL-T - Paste the selected file path into the command line
# - FIXME: Selected items are attached to the end regardless of cursor position
if
[
$__use_tmux
-eq
1
]
;
then
if
[
$__use_tmux_auto
-eq
1
]
;
then
bind
-x
'"\C-t": "__fzf_select_tmux_auto__"'
elif
[
$__use_tmux
-eq
1
]
;
then
bind
'"\C-t": "\e$a \eddi$(__fzf_select_tmux__)\C-x\C-e\e0P$xa"'
else
bind
'"\C-t": "\e$a \eddi$(__fzf_select__)\C-x\C-e\e0Px$a \C-x\C-r\exa "'
...
...
@@ -92,6 +108,6 @@ else
bind
-m
vi-command
'"\ec": "i\ec"'
fi
unset
__use_tmux
unset
-v
__use_tmux
__use_tmux_auto
fi
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