Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neovim integration details in vim-go.txt and README.md #689

Merged
merged 1 commit into from
Jan 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ disabled/enabled easily.
* Custom vim text objects such as `a function` or `inner function`
* All commands support collecting and displaying errors in Vim's location
list.
* A async launcher for the go command is implemented for neovim, fully async
building and testing.
* Check the status of any async jobs in the statusline with `go#jobcontrol#Statusline()`
* Integrated with the neovim terminal, launch `:GoRun` and other go commands
in their own new terminal.

## Install

Expand Down Expand Up @@ -207,17 +212,38 @@ let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path

### Location list navigation

All commands support collecting and displaying errors in Vim's location
list.
All commands support collecting and displaying errors in Vim's location list.

Quickly navigate through these location lists with `:lne` for next error and `:lp`
Quickly navigate through these location lists with `:lne` for next error and `:lp`
for previous. You can also bind these to keys, for example:

```vim
map <C-n> :lne<CR>
map <C-m> :lp<CR>
```

### Using with Neovim

Run `:GoRun` in a new tab, horizontal split or vertical split terminal

```vim
au FileType go nmap <leader>rt <Plug>(go-run-tab)
au FileType go nmap <Leader>rs <Plug>(go-run-split)
au FileType go nmap <Leader>rv <Plug>(go-run-vertical)
```

By default new terminals are opened in a vertical split. To change it

```vim
let g:go_term_mode = "split" "or set to tab
```

By default the testing commands run asynchronously in the background and display results
with `go#jobcontrol#Statusline()`. To make them run in a new terminal

```vim
let g:go_term_enabled = 1
```

### Using with Syntastic
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while saving and opening
Expand Down
113 changes: 100 additions & 13 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
===============================================================================
CONTENTS *go-contents*

1. Intro........................................|go-intro|
2. Install......................................|go-install|
3. Commands.....................................|go-commands|
4. Mappings.....................................|go-mappings|
5. Text Objects.................................|go-text-objects|
6. Settings.....................................|go-settings|
7. Troubleshooting..............................|go-troubleshooting|
8. Credits......................................|go-credits|
1. Intro........................................|go-intro|
2. Install......................................|go-install|
3. Commands.....................................|go-commands|
4. Mappings.....................................|go-mappings|
5. Text Objects.................................|go-text-objects|
6. Functions....................................|go-functions|
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the indentation is screwed here?

7. Settings.....................................|go-settings|
8. Troubleshooting..............................|go-troubleshooting|
9. Credits......................................|go-credits|

===============================================================================
INTRO *go-intro*
Expand Down Expand Up @@ -65,7 +66,12 @@ easily.
* Tagbar support to show tags of the source code in a sidebar with `gotags`
* Custom vim text objects such as `a function` or `inner function`
* All commands support collecting and displaying errors in Vim's location
list.
list
* A async launcher for the go command is implemented for neovim, fully async
building and testing.
* Check the status of any async jobs in the statusline with |go#jobcontrol#Statusline()|
* Integrated with the neovim terminal, launch `:GoRun` and other go commands
in their own new terminal.

===============================================================================
INSTALL *go-install*
Expand Down Expand Up @@ -223,18 +229,25 @@ COMMANDS *go-commands*

If [!] is not given the first error is jumped to.

If using neovim then `:GoRun` will run in a new terminal according to
|g:go_term_mode|.

*:GoBuild*
:GoBuild[!] [expand]

Build your package with `go build`. It automatically builds only the files
that depends on the current file. GoBuild doesn't produce a result file.
Build your package with `go build`. Errors are populated inside the
location list. It automatically builds only the files that depends on the
current file. `:GoBuild` doesn't produce a result file.
Use 'make' to create a result file.

You may optionally pass any valid go build flags/options. For a full list
please see `go help build`. Options are expanded with 'expand'.

If [!] is not given the first error is jumped to.

If using neovim then this command is fully async, it does not block the
UI.

*:GoGenerate*
:GoGenerate[!] [expand]

Expand Down Expand Up @@ -279,6 +292,10 @@ COMMANDS *go-commands*

If [!] is not given the first error is jumped to.

If using neovim `:GoTest` will run in a new terminal or run asynchronously
in the background according to |g:go_term_enabled|. You can set the mode of
the new terminal with |g:go_term_mode|.

*:GoTestFunc*
:GoTestFunc[!] [expand]

Expand All @@ -291,6 +308,10 @@ COMMANDS *go-commands*

If [!] is not given the first error is jumped to.

If using neovim `:GoTestFunc` will run in a new terminal or run asynchronously
in the background according to |g:go_term_enabled|. You can set the mode of
the new terminal with |g:go_term_mode|.

*:GoTestCompile*
:GoTestCompile[!] [expand]

Expand All @@ -302,6 +323,10 @@ COMMANDS *go-commands*

If [!] is not given the first error is jumped to.

If using neovim `:GoTestCompile` will run in a new terminal or run asynchronously
in the background according to |g:go_term_enabled|. You can set the mode of
the new terminal with |g:go_term_mode|.

*:GoCoverage*
:GoCoverage[!] [options]

Expand Down Expand Up @@ -446,8 +471,8 @@ COMMANDS *go-commands*
:GoOracleTags [tags]

Changes the custom |g:go_oracle_tags| setting and overrides it with the
given build tags. This command cooperate with GoReferrers command when
there exist mulitiple build tags in your project,then you can set one
given build tags. This command cooperate with GoReferrers command when
there exist mulitiple build tags in your project, then you can set one
of the build tags for GoReferrers to find more accurate.
The custom build tags is cleared (unset) if `""` is given. If no arguments
is given it prints the current custom build tags.
Expand Down Expand Up @@ -477,6 +502,21 @@ documentation in the |go-commands| section. Available <Plug> keys are:

Calls `go run` for the current file

*(go-run-tab)*

Calls `go run` for the current file in a new terminal tab
This option is neovim only.

*(go-run-split)*

Calls `go run` for the current file in a new terminal horizontal split
This option is neovim only.

*(go-run-vertical)*

Calls `go run` for the current file in a new terminal vertical split
This option is neovim only.


*(go-build)*

Expand Down Expand Up @@ -628,6 +668,22 @@ if "inside a function", select contents of a function,



===============================================================================
FUNCTIONS *go-functions*

*go#jobcontrol#Statusline()*

Shows the status of a job running asynchronously. Can be used to plug into the
statusline. It works to show the status per package instead of per
file. Assume you have three files open, all belonging to the same package,
if the package build (`:GoBuild`) is successful, all statusline's will be empty
(means SUCCESS), if you it fails all file's statusline will show FAILED.

*go#complete#GetInfo()*

Returns the description of the identifer under the cursor. Can be used to plug
into the statusline. This function is also used for |g:go_auto_type_info|.

===============================================================================
SETTINGS *go-settings*

Expand Down Expand Up @@ -929,6 +985,37 @@ Use this option to auto |:AsmFmt| on save. By default it's enabled. >

let g:go_asmfmt_autosave = 1
<
*g:go_term_mode*

This option is neovim only. Use it to change the default terminal mode of
go commands that run in a new terminal. The default is vsplit.
Current options are vsplit, split or tab.
>
let g:go_term_mode = "vsplit"
<
*g:go_term_height*
*g:go_term_width*

These options are neovim only. Use them to control the height and width of
a terminal split. By default these are not set meaning that the height and
width are set automatically by neovim. The height only applies with a
horizontal split and width only applies to a vertical split.

For example here is how to set each to 30.
>
let g:go_term_height = 30
let g:go_term_width = 30
<
*g:go_term_enabled*

This option is neovim only. Use it to change the behavior of the test
commands. If set to 1 it opens the test commands inside a new terminal
according to |g:go_term_mode|, otherwise it will run them in the background
just like `:GoBuild` and then display the status with |go#jobcontrol#Statusline()|.
By default it is disabled.
>
let g:go_term_enabled = 0
<

===============================================================================
TROUBLESHOOTING *go-troubleshooting*
Expand Down