ronantakizawa/codereview-bench huggingface dataset:
Repository: junegunn/fzf
File: src/tui/tui.go (Go)

Code before:
package tui

import (
	"fmt"
	"os"
	"strconv"
	"time"

	"github.com/gdamore/tcell"
)

// Types of user action
type EventType int

const (
	Rune EventType = iota

	CtrlA
	CtrlB
	CtrlC
	CtrlD
	CtrlE
	CtrlF
	CtrlG
	CtrlH
	Tab
	CtrlJ
	CtrlK
	CtrlL
	CtrlM
	CtrlN
	CtrlO
	CtrlP
	CtrlQ

Review comment (suggestion):
This makes non-Windows binaries, which don't need tcell, unnecessarily larger.

```
-rwxr-xr-x  1 jg  staff  2785696 Sep 29 17:29 fzf-darwin_amd64
-rwxr-xr-x  1 jg  staff  3198592 Sep 29 17:28 fzf-darwin_amd64-tcell-linked
```

An easy, albeit non-elegant, solution would be to define `prevMouseButton` as a non-member variable in `tcell.go` (similarly to `_screen` https://github.com/junegunn/fzf/blob/f4f47f5fe32db500765b47d937f5eb8fa27be130/src/tui/tcell.go#L123-L125),  because FullscreenRenderer is effectively a singleton.

Code after:
package tui

import (
	"fmt"
	"os"
	"strconv"
	"time"
)

// Types of user action
type EventType int

const (
	Rune EventType = iota

	CtrlA
	CtrlB
	CtrlC
	CtrlD
	CtrlE
	CtrlF
	CtrlG
	CtrlH
	Tab
	CtrlJ
	CtrlK
	CtrlL
	CtrlM
	CtrlN
	CtrlO
	CtrlP
	CtrlQ
	CtrlR
	CtrlS
Repository: junegunn/fzf
File: src/terminal_windows.go (Go)

Code before:
	"strings"
)

func notifyOnResize(resizeChan chan<- os.Signal) {
	// TODO
}

func notifyStop(p *os.Process) {
	// NOOP
}

func notifyOnCont(resizeChan chan<- os.Signal) {
	// NOOP
}

func quoteEntry(entry string) string {
	shell := os.Getenv("SHELL")
	if len(shell) == 0 {
		shell = "cmd"
	}

	if strings.Contains(shell, "cmd") {
		escaped := strings.Replace(entry, `\`, `\\`, -1)
		escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
		r, _ := regexp.Compile(`[&|<>()@^%!"]`)
		return r.ReplaceAllStringFunc(escaped, func(match string) string {
			return "^" + match
		})
	} else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {
		escaped := strings.Replace(entry, `"`, `""`, -1)
		return "'" + strings.Replace(escaped, "'", "''", -1) + "'"
	} else {
		return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
	}
}


Review comment (suggestion):
Please add comment `// backslash escaping is done here for applications (see ripgrep test case in terminal_test.go#TestWindowsCommands)`

Code after:
	"strings"
)

func notifyOnResize(resizeChan chan<- os.Signal) {
	// TODO
}

func notifyStop(p *os.Process) {
	// NOOP
}

func notifyOnCont(resizeChan chan<- os.Signal) {
	// NOOP
}

func quoteEntry(entry string) string {
	shell := os.Getenv("SHELL")
	if len(shell) == 0 {
		shell = "cmd"
	}

	if strings.Contains(shell, "cmd") {
		// backslash escaping is done here for applications
		// (see ripgrep test case in terminal_test.go#TestWindowsCommands)
		escaped := strings.Replace(entry, `\`, `\\`, -1)
		escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
		// caret is the escape character for cmd shell
		r, _ := regexp.Compile(`[&|<>()@^%!"]`)
		return r.ReplaceAllStringFunc(escaped, func(match string) string {
			return "^" + match
		})
	} else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {
		escaped := strings.Replace(entry, `"`, `""`, -1)
		return "'" + strings.Replace(escaped, "'", "''", -1) + "'"
	} else {
		return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
	}
}
Repository: junegunn/fzf
File: src/terminal_windows.go (Go)

Code before:
}

func notifyStop(p *os.Process) {
	// NOOP
}

func notifyOnCont(resizeChan chan<- os.Signal) {
	// NOOP
}

func quoteEntry(entry string) string {
	shell := os.Getenv("SHELL")
	if len(shell) == 0 {
		shell = "cmd"
	}

	if strings.Contains(shell, "cmd") {
		escaped := strings.Replace(entry, `\`, `\\`, -1)
		escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
		r, _ := regexp.Compile(`[&|<>()@^%!"]`)
		return r.ReplaceAllStringFunc(escaped, func(match string) string {
			return "^" + match
		})
	} else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {
		escaped := strings.Replace(entry, `"`, `""`, -1)
		return "'" + strings.Replace(escaped, "'", "''", -1) + "'"
	} else {
		return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
	}
}


Review comment (suggestion):
Please add comment `// caret escaping required by cmd console`

This is just to clarify why escaping for cmd is so different from the escaping for powershell (that you added).

Code after:
}

func notifyStop(p *os.Process) {
	// NOOP
}

func notifyOnCont(resizeChan chan<- os.Signal) {
	// NOOP
}

func quoteEntry(entry string) string {
	shell := os.Getenv("SHELL")
	if len(shell) == 0 {
		shell = "cmd"
	}

	if strings.Contains(shell, "cmd") {
		// backslash escaping is done here for applications
		// (see ripgrep test case in terminal_test.go#TestWindowsCommands)
		escaped := strings.Replace(entry, `\`, `\\`, -1)
		escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
		// caret is the escape character for cmd shell
		r, _ := regexp.Compile(`[&|<>()@^%!"]`)
		return r.ReplaceAllStringFunc(escaped, func(match string) string {
			return "^" + match
		})
	} else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {
		escaped := strings.Replace(entry, `"`, `""`, -1)
		return "'" + strings.Replace(escaped, "'", "''", -1) + "'"
	} else {
		return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
	}
}
Repository: junegunn/fzf
File: src/util/util_windows.go (Go)

Code before:
// +build windows

package util

import (
	"fmt"
	"os"
	"os/exec"
	"strings"
	"syscall"
)

// ExecCommand executes the given command with $SHELL
func ExecCommand(command string, setpgid bool) *exec.Cmd {
	shell := os.Getenv("SHELL")
	if len(shell) == 0 {
		shell = "cmd"
	} else if strings.ContainsAny(shell, `/\`) {
		out, err := exec.Command("cygpath", "-w", shell).Output()
		if err == nil {
			shell = strings.Trim(string(out), "\n")
		}
	}
	return ExecCommandWith(shell, command, setpgid)
}

// ExecCommandWith executes the given command with the specified shell
// FIXME: setpgid is unused. We set it in the Unix implementation so that we
// can kill preview process with its child processes at once.
// NOTE: For "powershell", we should ideally set output encoding to UTF8,
// but it is left as is now because no adverse effect has been observed.
func ExecCommandWith(shell string, command string, setpgid bool) *exec.Cmd {
	var commandline string
	if strings.Contains(shell, "cmd") {
		commandline = fmt.Sprintf(` /v:on/s/c "%s"`, command)
	} else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {
		commandline = fmt.Sprintf(` -NoProfile -Command "& { %s }"`, command)
	}
	if len(commandline) == 0 {
		cmd := exec.Command(shell, "-c", command)
		cmd.SysProcAttr = &syscall.SysProcAttr{
			HideWindow:    false,
			CreationFlags: 0,

Review comment (suggestion):
I understand the forward slash, but why are you also testing for backslash here?
Note this `if` will match `C:\Windows\system32\WindowsPowerShell\v1.0\powershell.EXE`, but no need to run cygpath on it.

Code after:
// +build windows

package util

import (
	"fmt"
	"os"
	"os/exec"
	"strings"
	"syscall"
)

// ExecCommand executes the given command with $SHELL
func ExecCommand(command string, setpgid bool) *exec.Cmd {
	shell := os.Getenv("SHELL")
	if len(shell) == 0 {
		shell = "cmd"
	} else if strings.Contains(shell, "/") {
		out, err := exec.Command("cygpath", "-w", shell).Output()
		if err == nil {
			shell = strings.Trim(string(out), "\n")
		}
	}
	return ExecCommandWith(shell, command, setpgid)
}

// ExecCommandWith executes the given command with the specified shell
// FIXME: setpgid is unused. We set it in the Unix implementation so that we
// can kill preview process with its child processes at once.
// NOTE: For "powershell", we should ideally set output encoding to UTF8,
// but it is left as is now because no adverse effect has been observed.
func ExecCommandWith(shell string, command string, setpgid bool) *exec.Cmd {
	var commandline string
	if strings.Contains(shell, "cmd") {
		commandline = fmt.Sprintf(` /v:on/s/c "%s"`, command)
	} else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {
		commandline = fmt.Sprintf(` -NoProfile -Command "& { %s }"`, command)
	}
	if len(commandline) == 0 {
		cmd := exec.Command(shell, "-c", command)
		cmd.SysProcAttr = &syscall.SysProcAttr{
			HideWindow:    false,
			CreationFlags: 0,
Repository: junegunn/fzf
File: src/terminal_windows.go (Go)

Code before:
// +build windows

package fzf

import (
	"os"
	"regexp"
	"strings"
)

func notifyOnResize(resizeChan chan<- os.Signal) {
	// TODO
}

func notifyStop(p *os.Process) {
	// NOOP
}

func notifyOnCont(resizeChan chan<- os.Signal) {
	// NOOP
}

func quoteEntry(entry string) string {
	escaped := strings.Replace(entry, `\`, `\\`, -1)
	escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
	r, _ := regexp.Compile(`[&|<>()@^%!"]`)
	return r.ReplaceAllStringFunc(escaped, func(match string) string {
		return "^" + match
	})
}


Review comment (security):
Was this tested without cmd.exe? Non-cmd executables escape double quotes with `\`, not `"`.
https://github.com/junegunn/vim-plug/blob/master/plug.vim#L2203-L2205

This might be fine if there was an intermediary shell but fzf executes its commands as a syscall.

Code after:
func notifyStop(p *os.Process) {
	// NOOP
}

func notifyOnCont(resizeChan chan<- os.Signal) {
	// NOOP
}

func quoteEntry(entry string) string {
	shell := os.Getenv("SHELL")
	if len(shell) == 0 {
		shell = "cmd"
	}

	if strings.Contains(shell, "cmd") {
		// backslash escaping is done here for applications
		// (see ripgrep test case in terminal_test.go#TestWindowsCommands)
		escaped := strings.Replace(entry, `\`, `\\`, -1)
		escaped = `"` + strings.Replace(escaped, `"`, `\"`, -1) + `"`
		// caret is the escape character for cmd shell
		r, _ := regexp.Compile(`[&|<>()@^%!"]`)
		return r.ReplaceAllStringFunc(escaped, func(match string) string {
			return "^" + match
		})
	} else if strings.Contains(shell, "pwsh") || strings.Contains(shell, "powershell") {
		escaped := strings.Replace(entry, `"`, `""`, -1)
		return "'" + strings.Replace(escaped, "'", "''", -1) + "'"
	} else {
		return "'" + strings.Replace(entry, "'", "'\\''", -1) + "'"
	}
}
Repository: junegunn/fzf
File: shell/completion.bash (Shell)

Code before:
    ;;
  --color)
    COMPREPLY=( $(compgen -W "dark light 16 bw" -- "$cur") )
    return 0
    ;;
  --history)
    COMPREPLY=()
    return 0
    ;;
  esac

  if [[ "$cur" =~ ^-|\+ ]]; then
    COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
    return 0
  fi

  return 0
}

_fzf_handle_dynamic_completion() {
  local cmd orig_var orig ret orig_cmd orig_complete
  cmd="$1"
  shift
  orig_cmd="$1"
  orig_var="_fzf_orig_completion_$cmd"
  orig="${!orig_var-##*#}"
  if [[ -n "$orig" ]] && type "$orig" > /dev/null 2>&1; then
    $orig "$@"
  elif [[ -n "${_fzf_completion_loader-}" ]]; then
    orig_complete=$(complete -p "$orig_cmd" 2> /dev/null)
    _completion_loader "$@"
    ret=$?
    # _completion_loader may not have updated completion for the command
    if [[ "$(complete -p "$orig_cmd" 2> /dev/null)" != "$orig_complete" ]]; then
      __fzf_orig_completion < <(complete -p "$orig_cmd" 2> /dev/null)
      if [[ "${__fzf_nospace_commands-}" = *" $orig_cmd "* ]]; then
        eval "${orig_complete/ -F / -o nospace -F }"
      else
        eval "$orig_complete"
      fi
    fi
    return $ret
  fi
}

__fzf_generic_path_completion() {
  local cur base dir leftover matches trigger cmd
  cmd="${COMP_WORDS[0]}"
  if [[ $cmd == \\* ]]; then
    cmd="${cmd:1}"
  fi

Review comment (bug):
Turns out this has a bug and I'm getting `bash: warning: programmable_completion: ls: possible retry loop`.

```sh
foo='complete -F %s ls #_longopt'
orig_var=foo

echo "${!orig_var##*#}"
  # GOOD: _longopt

echo "${!orig_var-##*#}"
  # BAD: complete -F %s ls #_longopt

# Workaround: split the expression into two
orig="${!orig_var-}"
orig="${orig##*#}"
echo "$orig"
  # GOOD: _longopt
```

Code after:
    ;;
  --color)
    COMPREPLY=( $(compgen -W "dark light 16 bw" -- "$cur") )
    return 0
    ;;
  --history)
    COMPREPLY=()
    return 0
    ;;
  esac

  if [[ "$cur" =~ ^-|\+ ]]; then
    COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )
    return 0
  fi

  return 0
}

_fzf_handle_dynamic_completion() {
  local cmd orig_var orig ret orig_cmd orig_complete
  cmd="$1"
  shift
  orig_cmd="$1"
  orig_var="_fzf_orig_completion_$cmd"
  orig="${!orig_var-}"
  orig="${orig##*#}"
  if [[ -n "$orig" ]] && type "$orig" > /dev/null 2>&1; then
    $orig "$@"
  elif [[ -n "${_fzf_completion_loader-}" ]]; then
    orig_complete=$(complete -p "$orig_cmd" 2> /dev/null)
    _completion_loader "$@"
    ret=$?
    # _completion_loader may not have updated completion for the command
    if [[ "$(complete -p "$orig_cmd" 2> /dev/null)" != "$orig_complete" ]]; then
      __fzf_orig_completion < <(complete -p "$orig_cmd" 2> /dev/null)
      if [[ "${__fzf_nospace_commands-}" = *" $orig_cmd "* ]]; then
        eval "${orig_complete/ -F / -o nospace -F }"
      else
        eval "$orig_complete"
      fi
    fi
    return $ret
  fi
}

__fzf_generic_path_completion() {
  local cur base dir leftover matches trigger cmd
  cmd="${COMP_WORDS[0]}"
  if [[ $cmd == \\* ]]; then
    cmd="${cmd:1}"
Repository: junegunn/fzf
File: shell/completion.bash (Shell)

Code before:
        eval "$orig_complete"
      fi
    fi
    return $ret
  fi
}

__fzf_generic_path_completion() {
  local cur base dir leftover matches trigger cmd
  cmd="${COMP_WORDS[0]}"
  if [[ $cmd == \\* ]]; then
    cmd="${cmd:1}"
  fi
  cmd="${cmd//[^A-Za-z0-9_=]/_}"
  COMPREPLY=()
  trigger=${FZF_COMPLETION_TRIGGER-'**'}
  cur="${COMP_WORDS[COMP_CWORD]}"
  if [[ "$cur" == *"$trigger" ]]; then
    base=${cur:0:${#cur}-${#trigger}}
    eval "base=$base"

    dir=
    [[ $base = *"/"* ]] && dir="$base"
    while true; do
      if [[ -z "$dir" ]] || [[ -d "$dir" ]]; then
        leftover=${base/#"${dir-}"}
        leftover=${leftover/#\/}
        [[ -z "$dir" ]] && dir='.'
        [[ "$dir" != "/" ]] && dir="${dir/%\//}"
        matches=$(eval "$1 $(printf %q "${dir-}")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $2" __fzf_comprun "$4" -q "$leftover" | while read -r item; do
          printf "%q " "${item%$3}$3"
        done)
        matches=${matches% }
        [[ -z "$3" ]] && [[ "${__fzf_nospace_commands-}" = *" ${COMP_WORDS[0]} "* ]] && matches="$matches "
        if [[ -n "$matches" ]]; then
          COMPREPLY=( "$matches" )
        else
          COMPREPLY=( "$cur" )
        fi
        printf '\e[5n'
        return 0
      fi
      dir=$(dirname "$dir")
      [[ "$dir" =~ /$ ]] || dir="$dir"/
    done
  else
    shift
    shift
    shift
    _fzf_handle_dynamic_completion "$cmd" "$@"
  fi

Review comment (suggestion):
```suggestion
        leftover=${base/#"$dir"}
```

Code after:
      else
        eval "$orig_complete"
      fi
    fi
    return $ret
  fi
}

__fzf_generic_path_completion() {
  local cur base dir leftover matches trigger cmd
  cmd="${COMP_WORDS[0]}"
  if [[ $cmd == \\* ]]; then
    cmd="${cmd:1}"
  fi
  cmd="${cmd//[^A-Za-z0-9_=]/_}"
  COMPREPLY=()
  trigger=${FZF_COMPLETION_TRIGGER-'**'}
  cur="${COMP_WORDS[COMP_CWORD]}"
  if [[ "$cur" == *"$trigger" ]]; then
    base=${cur:0:${#cur}-${#trigger}}
    eval "base=$base"

    dir=
    [[ $base = *"/"* ]] && dir="$base"
    while true; do
      if [[ -z "$dir" ]] || [[ -d "$dir" ]]; then
        leftover=${base/#"$dir"}
        leftover=${leftover/#\/}
        [[ -z "$dir" ]] && dir='.'
        [[ "$dir" != "/" ]] && dir="${dir/%\//}"
        matches=$(eval "$1 $(printf %q "$dir")" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} ${FZF_COMPLETION_OPTS-} $2" __fzf_comprun "$4" -q "$leftover" | while read -r item; do
          printf "%q " "${item%$3}$3"
        done)
        matches=${matches% }
        [[ -z "$3" ]] && [[ "${__fzf_nospace_commands-}" = *" ${COMP_WORDS[0]} "* ]] && matches="$matches "
        if [[ -n "$matches" ]]; then
          COMPREPLY=( "$matches" )
        else
          COMPREPLY=( "$cur" )
        fi
        printf '\e[5n'
        return 0
      fi
      dir=$(dirname "$dir")
      [[ "$dir" =~ /$ ]] || dir="$dir"/
    done
  else
    shift
    shift
    shift
    _fzf_handle_dynamic_completion "$cmd" "$@"
Repository: junegunn/fzf
File: src/util/util_test.go (Go)

Code before:
		width, overflowIdx := RunesWidth([]rune("hello"), 0, 0, args[0])
		if width != args[1] {
			t.Errorf("Expected width: %d, actual: %d", args[1], width)
		}
		if overflowIdx != args[2] {
			t.Errorf("Expected overflow index: %d, actual: %d", args[2], overflowIdx)
		}
	}
}

func TestTruncate(t *testing.T) {
	truncated, width := Truncate("가나다라마", 7)
	if string(truncated) != "가나다" {
		t.Errorf("Expected: 가나다, actual: %s", string(truncated))
	}
	if width != 6 {
		t.Errorf("Expected: 6, actual: %d", width)
	}
}

func TestRepeatToFill(t *testing.T) {
	if RepeatToFill("abcde", 10, 50) != strings.Repeat("abcde", 5) {
		t.Error("Expected:", strings.Repeat("abcde", 5))
	}
	if RepeatToFill("abcde", 10, 42) != strings.Repeat("abcde", 4) + "abcde"[:2] {
		t.Error("Expected:", strings.Repeat("abcde", 4) + "abcde"[:2])
	}
}


Review comment (suggestion):
```suggestion
	if RepeatToFill("abcde", 10, 42) != strings.Repeat("abcde", 4)+"abcde"[:2] {
		t.Error("Expected:", strings.Repeat("abcde", 4)+"abcde"[:2])
```

Code after:
		width, overflowIdx := RunesWidth([]rune("hello"), 0, 0, args[0])
		if width != args[1] {
			t.Errorf("Expected width: %d, actual: %d", args[1], width)
		}
		if overflowIdx != args[2] {
			t.Errorf("Expected overflow index: %d, actual: %d", args[2], overflowIdx)
		}
	}
}

func TestTruncate(t *testing.T) {
	truncated, width := Truncate("가나다라마", 7)
	if string(truncated) != "가나다" {
		t.Errorf("Expected: 가나다, actual: %s", string(truncated))
	}
	if width != 6 {
		t.Errorf("Expected: 6, actual: %d", width)
	}
}

func TestRepeatToFill(t *testing.T) {
	if RepeatToFill("abcde", 10, 50) != strings.Repeat("abcde", 5) {
		t.Error("Expected:", strings.Repeat("abcde", 5))
	}
	if RepeatToFill("abcde", 10, 42) != strings.Repeat("abcde", 4)+"abcde"[:2] {
		t.Error("Expected:", strings.Repeat("abcde", 4)+"abcde"[:2])
	}
}
Repository: junegunn/fzf
File: shell/key-bindings.bash (Shell)

Code before:
bind -m emacs-standard '"\C-z": vi-editing-mode'

if (( BASH_VERSINFO[0] < 4 )); then
  # CTRL-T - Paste the selected file path into the command line
  bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
  bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
  bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'

  if [[ $(type -t __fzf_history__) == function ]]; then
    # CTRL-R - Paste the selected command from history into the command line
    bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er"'
    bind -m vi-command '"\C-r": "\C-z\C-r\C-z"'
    bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
  fi
else
  # CTRL-T - Paste the selected file path into the command line
  bind -m emacs-standard -x '"\C-t": fzf-file-widget'
  bind -m vi-command -x '"\C-t": fzf-file-widget'
  bind -m vi-insert -x '"\C-t": fzf-file-widget'

  if [[ $(type -t __fzf_history__) == function ]]; then
    # CTRL-R - Paste the selected command from history into the command line
    bind -m emacs-standard -x '"\C-r": __fzf_history__'
    bind -m vi-command -x '"\C-r": __fzf_history__'
    bind -m vi-insert -x '"\C-r": __fzf_history__'
  fi
fi

# ALT-C - cd into the selected directory
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'

fi


Review comment (suggestion):
```suggestion
  # CTRL-R - Paste the selected command from history into the command line
  bind -m emacs-standard -x '"\C-r": __fzf_history__'
  bind -m vi-command -x '"\C-r": __fzf_history__'
  bind -m vi-insert -x '"\C-r": __fzf_history__'
```

Code after:
bind -m emacs-standard '"\C-z": vi-editing-mode'

if (( BASH_VERSINFO[0] < 4 )); then
  # CTRL-T - Paste the selected file path into the command line
  bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
  bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
  bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'

  # CTRL-R - Paste the selected command from history into the command line
  bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er"'
  bind -m vi-command '"\C-r": "\C-z\C-r\C-z"'
  bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
else
  # CTRL-T - Paste the selected file path into the command line
  bind -m emacs-standard -x '"\C-t": fzf-file-widget'
  bind -m vi-command -x '"\C-t": fzf-file-widget'
  bind -m vi-insert -x '"\C-t": fzf-file-widget'

  # CTRL-R - Paste the selected command from history into the command line
  bind -m emacs-standard -x '"\C-r": __fzf_history__'
  bind -m vi-command -x '"\C-r": __fzf_history__'
  bind -m vi-insert -x '"\C-r": __fzf_history__'
fi

# ALT-C - cd into the selected directory
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'

fi