mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-21 12:34:58 +00:00
Installation using cargo install
This commit is contained in:
parent
7eb549875d
commit
79ee5abc7c
@ -209,12 +209,19 @@ impl<'a> Swapper<'a> {
|
|||||||
"".to_string()
|
"".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let cargo_home = option_env!("CARGO_HOME");
|
||||||
|
let binary = if let Some(home) = cargo_home {
|
||||||
|
format!("{}/bin/thumbs", home)
|
||||||
|
} else {
|
||||||
|
format!("{}/target/release/thumbs", self.dir)
|
||||||
|
};
|
||||||
|
|
||||||
let pane_command = format!(
|
let pane_command = format!(
|
||||||
"tmux capture-pane -et {active_pane_id} -p{scroll_params} | tail -n {height} | {dir}/target/release/thumbs -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}",
|
"tmux capture-pane -et {active_pane_id} -p{scroll_params} | tail -n {height} | {binary} -f '%U:%H' -t {tmp} {args}; tmux swap-pane -t {active_pane_id}; {zoom_command} tmux wait-for -S {signal}",
|
||||||
active_pane_id = active_pane_id,
|
active_pane_id = active_pane_id,
|
||||||
scroll_params = scroll_params,
|
scroll_params = scroll_params,
|
||||||
height = self.active_pane_height.unwrap_or(i32::MAX),
|
height = self.active_pane_height.unwrap_or(i32::MAX),
|
||||||
dir = self.dir,
|
binary = binary,
|
||||||
tmp = TMP_FILE,
|
tmp = TMP_FILE,
|
||||||
args = args.join(" "),
|
args = args.join(" "),
|
||||||
zoom_command = zoom_command,
|
zoom_command = zoom_command,
|
||||||
|
@ -35,4 +35,4 @@ add-param command string
|
|||||||
add-param upcase-command string
|
add-param upcase-command string
|
||||||
add-param osc52 boolean
|
add-param osc52 boolean
|
||||||
|
|
||||||
"${CURRENT_DIR}/target/release/tmux-thumbs" "${PARAMS[@]}" || true
|
"$TMUX_THUMBS_BINARY" "${PARAMS[@]}"
|
||||||
|
@ -7,10 +7,4 @@ DEFAULT_THUMBS_KEY=space
|
|||||||
THUMBS_KEY="$(tmux show-option -gqv @thumbs-key)"
|
THUMBS_KEY="$(tmux show-option -gqv @thumbs-key)"
|
||||||
THUMBS_KEY=${THUMBS_KEY:-$DEFAULT_THUMBS_KEY}
|
THUMBS_KEY=${THUMBS_KEY:-$DEFAULT_THUMBS_KEY}
|
||||||
|
|
||||||
tmux bind-key "${THUMBS_KEY}" run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
|
tmux bind-key "${THUMBS_KEY}" run-shell -b "TMUX_THUMBS_BINARY=$HOME/.cache/cargo/bin/tmux-thumbs ${CURRENT_DIR}/tmux-thumbs.sh"
|
||||||
|
|
||||||
BINARY="${CURRENT_DIR}/target/release/thumbs"
|
|
||||||
|
|
||||||
if [ ! -f "$BINARY" ]; then
|
|
||||||
tmux split-window "cd ${CURRENT_DIR} && cargo build --release --target-dir=target && echo 'Press any key to continue...' && read -k1"
|
|
||||||
fi
|
|
||||||
|
Loading…
Reference in New Issue
Block a user