Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit c8a8341

Browse files
authored
Merge pull request #9 from ckipp01/readme
Update readme and fix some typos
2 parents 3a72e33 + 37ecd71 commit c8a8341

1 file changed

Lines changed: 65 additions & 43 deletions

File tree

README.md

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# diagnostic-nvim
22

3-
Nvim built in language server is amazing, but the diagnosis setting that it shipped with default
4-
may not be as great as other LSP plugins. Fortunately, it's very customizable with changing
5-
the default callback function with lua. This plugin tries to focus on wrapping the
6-
diagnosis setting up to make it a more user friendly without adding too much to it.
3+
The built- in Nvim language server support is amazing, but the diagnostics setting
4+
that it shipped with it by default may not be as great as other LSP plugins.
5+
Fortunately, it's very customizable with changing the default callback function
6+
with lua. This plugin tries to focus on wrapping the diagnostics setting up to
7+
make it a more user friendly without adding too much to it.
78

89
## Features
910

@@ -17,85 +18,104 @@ diagnosis setting up to make it a more user friendly without adding too much to
1718
## Demo
1819
![Demo](https://user-images.githubusercontent.com/35623968/75627012-6824f380-5c07-11ea-8f25-59ce1751e902.gif)
1920

20-
## Prerequisite
21+
## Prerequisites
22+
2123
- Neovim nightly
22-
- You should be setting up language server with the help of [nvim-lsp](https://github.com/neovim/nvim-lsp)
24+
- You should set up your language server of choice with the help of [nvim-lsp](https://github.com/neovim/nvim-lsp)
2325

2426
## Install
2527

2628
- Install with any plugin manager by using the path on GitHub.
27-
```
29+
30+
```vim
2831
Plug 'haorenW1025/diagnostic-nvim'
2932
```
3033

3134
## Setup
32-
- Diagnostic-nvim require several autocommand set up to work properly, you should
35+
36+
- Diagnostic-nvim requires several autocommands set up to work properly. You should
3337
set it up using the `on_attach` function like this.
34-
```
35-
lua require'nvim_lsp'.pyls.setup{on_attach=require'diagnostic'.on_attach}
36-
```
37-
- Change `pyls` to whatever language server you are using.
3838

39-
## Command
40-
- Use `PrevDiagnostic` and `NextDiagnostic` to jump to previous and next diagnostic
39+
```vim
40+
lua require'nvim_lsp'.pyls.setup{on_attach=require'diagnostic'.on_attach}
41+
```
42+
43+
- Change `pyls` to whichever language server you're using.
44+
45+
## Commands
46+
47+
- Use `PrevDiagnostic` and `NextDiagnostic` to jump to the previous and next diagnostic
4148
under your cursor.
42-
- `OpenDiagnostic` will open location list and jump back to previous window.
49+
- `OpenDiagnostic` will open a location list and jump back to previous window.
4350

4451
## Options
4552

4653
### Enable/Disable virtual text
47-
- Diagnostic-nvim have an option that let you toggle up virtual text. Virtual text
48-
is disable by default, you can open enable it by
49-
```
54+
55+
- Diagnostic-nvim has an option that lets you toggle the virtual text. Virtual text
56+
is disabled by default. You can enable it by
57+
58+
```vim
5059
let g:diagnostic_enable_virtual_text = 1
5160
```
5261

5362
### Change virtual text prefix
54-
- Diagnostic-nvim provide an option to change the virtual text prefix, the default
55-
prefix is '■', but if you have nerd font or other power line font support, you can
56-
make it a little more fancy by
57-
```
63+
64+
- Diagnostic-nvim provides an option to change the virtual text prefix, the
65+
default prefix is '■', but if you have nerd font or other power line font
66+
support, you can make it a little more fancy by adding something like:
67+
68+
```vim
5869
let g:diagnostic_virtual_text_prefix = ' '
5970
```
6071

6172
### Trimming virtual text
62-
- Sometimes you can be working with language which have long virtual text, Diagnostic-nvim
63-
provide a an option to trimmed the virtual text to fit your usage by
64-
```
73+
74+
- Sometimes you can be working with language which has long virtual text,
75+
Diagnostic-nvim provides an option to trim the virtual text to fit your usage by
76+
77+
```vim
6578
let g:diagnostic_trimmed_virtual_text = '20'
6679
```
67-
- If virtual text exceed the value that you set, `...` will be displayed in the end.
68-
- Note that setting this option to `0` means that only shows prefix.
69-
- By default, this value is set to `v:null`, which means no trimmed at all.
80+
81+
- If the virtual text exceeds the value that you set, `...` will be displayed in the end.
82+
- Note that setting this option to `0` means that it will only show the prefix.
83+
- By default, this value is set to `v:null`, which means it's not trimmed at all.
7084

7185
### Spaces before virtual text
72-
- By default, there will be only a space before virtual text. You can add more spaces
73-
by
74-
```
86+
- By default, there will be only a space before virtual text. You can add more spaces by
87+
88+
```vim
7589
let g:space_before_virtual_text = 5
7690
```
7791

7892
### Enable/Disable Sign
79-
- By default, built-in LSP will show sign on every line that you have diagnostic
80-
message on it. You can turn it off by
81-
```
93+
94+
- By default, the build-in Nvim LSP will show a sign on every line that you have
95+
a diagnostic message on. You can turn this off by
96+
97+
```vim
8298
let g:diagnostic_show_sign = 0
8399
```
84-
- Make sure to use the latest branch of neovim which have sign support.
100+
- Make sure to use the latest branch of Neovim which has sign support.
85101

86102
### Enable/Disable auto popup window
103+
87104
- When you jump to next or previous diagnostic, line diagnostic message will popup
88-
in a popup window, you can disable it by
89-
```
105+
in a popup window, you can disable it by
106+
107+
```vim
90108
let g:diagnostic_auto_popup_while_jump = 0
91109
```
92110

93111
### Enable/Disable insert delay
94-
- Neovim built in language server will keep sending diagnostic message when you're
95-
in insert mode, sometimes it could be kind of distraction especially when you have
96-
virtual text enable. If you don't want to show diagnostic while insert mode, turn
97-
on this option by
98-
```
112+
113+
- Neovim's built-in LSP support will keep sending diagnostic messages when you're
114+
in insert mode. Sometimes this can be kind of distraction especially when you have
115+
virtual text enabled. If you don't want to show diagnostics while in insert mode,
116+
set the following
117+
118+
```vim
99119
let g:diagnostic_insert_delay = 1
100120
```
101121

@@ -104,4 +124,6 @@ let g:diagnostic_insert_delay = 1
104124
<!-- - [ ] Option to change virtual text format. -->
105125

106126
## WARNING
107-
This plugin is in early stage, might have unexpected issues.
127+
128+
- This plugin is in the early stages and might have unexpected issues.
129+
- Feel free to post issues on any unexpected behavior or open a feature request!

0 commit comments

Comments
 (0)