Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/gofPublic
NotificationsYou must be signed in to change notification settings

mattn/gof

Repository files navigation

Go Fuzzy

Open files in Vim directly (inside Vim terminal)

Installation

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

Feature

  • Faster and startup
  • Working on windows

Usage

  • Glob files and edit the selected file with vim.
$ vim`gof`
  • Read from stdin
$ find /tmp| gof

Keyboard shortcuts

KeyDescription
CTRL-K,CTRL-P,ARROW-UPMove-up line
CTRL-J,CTRL-N,ARROW-DOWNMove-down line
CTRL-A,HOMEGo to head of prompt
CTRL-E,ENDGo to trail of prompt
ARROW-LEFTMove-left cursor
ARROW-RIGHTMove-right cursor
CTRL-IToggle view header/trailing of lines
CTRL-LRedraw
CTRL-UClear prompt
CTRL-WRemove backward word
BSRemove backward character
DELDelete character on the cursor
CTRL-ZToggle selection
CTRL-RToggle fuzzy option
EnterDecide
CTRL-D,CTRL-C,ESCCancel

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 -t orgof -tf [prefix] opens selected files in Vim usingTerminal API.

  • If you want to add-t option automatically whether you are inside Vimterminal or not, you can define alias like this

gof() {if ["$VIM_TERMINAL" ];thencommand gof -t"$@"elsecommand gof"$@"fi}
  • If you are familiar with Vim script, you may want to send["call", "[funcname]", "[file information]"] instead of["drop", "[filename]"]. You can usegof -tf [funcname] to sendcall command
[file information] = {  "filename": [relative filename path (string)],  "fullpath": [absolute filename path (string)],  "root_dir": [root directory (string)],  "action_key": [action key of -a (string)]}
  • You can define utility Vim command:Gof. Quickly callsgof -t command andopens selected files in Vim buffer
ifexecutable('gof')command! -nargs=* Gofterm++close gof-tendif

  • Please tryvargs if you want to communicate easily with Vim terminal API from shell

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)


[8]ページ先頭

©2009-2025 Movatter.jp