Подключение к SFTP с помощью PcManFM

Рыбная скорлупа

fzf-complete-from-tmux.sh

#!/bin/bash
tmux capture-pane -pS -100000 |      # Dump the tmux buffer.
  tac |                              # Reverse so duplicates use the first match.
  pcregrep -o "[\w\d_\-\.\/]+" |     # Extract the words.
  awk '{ if (!seen[$0]++) print }' | # De-duplicate them with awk, then pass to fzf.
  fzf --no-sort --exact +i           # Pass to fzf for completion.

Пример связывания с рыбьей оболочкой.

# Ctrl-N: Complete based on the tmux buffer content.
bind \cn "commandline -i (fzf-complete-from-tmux.sh) 2>/dev/null"

Баш-оболочка

Добавлена ​​версия bash благодаря @juanitocalero.

#!/bin/bash

__screen-autocomplete__() {
    tmux capture-pane -pS -100000 |      # Dump the tmux buffer.
      tac |                              # Reverse so duplicates use the first match.
      grep -P -o "[\w\d_\-\.\/]+" |      # Extract the words.
      awk '{ if (!seen[$0]++) print }' | # De-duplicate them with awk, then pass to fzf.
      fzf --no-sort --exact +i           # Pass to fzf for completion.
}

__screen_autocomplete-inline__() {
    local selected="$(__screen-autocomplete__)"
    READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}$selected${READLINE_LINE:$READLINE_POINT}"
    READLINE_POINT=$(( READLINE_POINT + ${#selected} ))
}

# Example binding with bash shell.
bind -x '"\C-n": "__screen_autocomplete-inline__"'
0
06.09.2021, 22:17
0 ответов

Теги

Похожие вопросы