Home

Awesome

gof

Go Fuzzy

Open files in Vim directly (inside Vim terminal)

Installation

$ go install github.com/mattn/gof@latest

Feature

Usage

$ vim `gof`
$ find /tmp | gof

Keyboard shortcuts

KeyDescription
<kbd>CTRL-K</kbd>,<kbd>CTRL-P</kbd>,<kbd>ARROW-UP</kbd>Move-up line
<kbd>CTRL-J</kbd>,<kbd>CTRL-N</kbd>,<kbd>ARROW-DOWN</kbd>Move-down line
<kbd>CTRL-A</kbd>,<kbd>HOME</kbd>Go to head of prompt
<kbd>CTRL-E</kbd>,<kbd>END</kbd>Go to trail of prompt
<kbd>ARROW-LEFT</kbd>Move-left cursor
<kbd>ARROW-RIGHT</kbd>Move-right cursor
<kbd>CTRL-I</kbd>Toggle view header/trailing of lines
<kbd>CTRL-L</kbd>Redraw
<kbd>CTRL-U</kbd>Clear prompt
<kbd>CTRL-W</kbd>Remove backward word
<kbd>BS</kbd>Remove backward character
<kbd>DEL</kbd>Delete character on the cursor
<kbd>CTRL-Z</kbd>Toggle selection
<kbd>CTRL-R</kbd>Toggle fuzzy option
<kbd>Enter</kbd>Decide
<kbd>CTRL-D</kbd>,<kbd>CTRL-C</kbd>,<kbd>ESC</kbd>Cancel

Options

OptionDescription
-fFuzzy match
-xExit code for cancel (default: 1)
-d [path]Specify root directory
-aRegister action keys
-tOpen via Vim's Terminal API
-tf [funcname]Terminal API's function name

Vim Terminal API

gof() {
  if [ "$VIM_TERMINAL" ]; then
    command gof -t "$@"
  else
    command gof "$@"
  fi
}
[file information] = {
  "filename": [relative filename path (string)],
  "fullpath": [absolute filename path (string)],
  "root_dir": [root directory (string)],
  "action_key": [action key of -a (string)]
}
if executable('gof')
  command! -nargs=* Gof term ++close gof -t
endif

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)