Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattn/gof
go gof golang windows
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mattn/gof
- Owner: mattn
- Created: 2013-12-09T11:58:51.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-02-23T12:53:43.000Z (almost 2 years ago)
- Last Synced: 2024-11-07T14:44:45.928Z (about 1 month ago)
- Topics: go, gof, golang, windows
- Language: Go
- Size: 118 KB
- Stars: 179
- Watchers: 7
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-tools - gof
README
# gof
Go Fuzzy
![](http://i.imgur.com/TGZJyGV.gif)
[Open files in Vim directly (inside Vim terminal)](#vim-terminal-api)
![](https://i.imgur.com/pRhl9o3.gif)
## 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.
```sh
$ vim `gof`
```* Read from stdin
```sh
$ find /tmp | gof
```## Keyboard shortcuts
|Key |Description |
|---------------------------------------------------------|------------------------------------|
|CTRL-K,CTRL-P,ARROW-UP |Move-up line |
|CTRL-J,CTRL-N,ARROW-DOWN|Move-down line |
|CTRL-A,HOME |Go to head of prompt |
|CTRL-E,END |Go to trail of prompt |
|ARROW-LEFT |Move-left cursor |
|ARROW-RIGHT |Move-right cursor |
|CTRL-I |Toggle view header/trailing of lines|
|CTRL-L |Redraw |
|CTRL-U |Clear prompt |
|CTRL-W |Remove backward word |
|BS |Remove backward character |
|DEL |Delete character on the cursor |
|CTRL-Z |Toggle selection |
|CTRL-R |Toggle fuzzy option |
|Enter |Decide |
|CTRL-D,CTRL-C,ESC |Cancel |## Options
|Option |Description |
|--------------|---------------------------------|
|-f |Fuzzy match |
|-x |Exit code for cancel (default: 1)|
|-d [path] |Specify root directory |
|-a |Register action keys |
|-t |Open via Vim's Terminal API |
|-tf [funcname]|Terminal API's function name |## Vim Terminal API
* `gof -t` or `gof -tf [prefix]` opens selected files in Vim using [Terminal API](https://vim-jp.org/vimdoc-en/terminal.html#terminal-api).
* If you want to add `-t` option automatically whether you are inside Vim
terminal or not, you can define alias like this```sh
gof() {
if [ "$VIM_TERMINAL" ]; then
command gof -t "$@"
else
command gof "$@"
fi
}
```* If you are familiar with Vim script, you may want to send `["call", "[funcname]", "[file information]"]` instead of `["drop", "[filename]"]`. You can use `gof -tf [funcname]` to send `call` 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 calls `gof -t` command and
opens selected files in Vim buffer```vim
if executable('gof')
command! -nargs=* Gof term ++close gof -t
endif
```![](https://i.imgur.com/jvfuOxh.gif)
* Please try [vargs](https://github.com/tyru/vargs) if you want to communicate easily with Vim terminal API from shell
## License
MIT
## Author
Yasuhiro Matsumoto (a.k.a mattn)