Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

Commit

Permalink
Add separate options to customize min and max height of error list
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayFrantsev committed Apr 24, 2015
1 parent 96f3081 commit 26dca23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -82,10 +82,11 @@ Hide error codes in error list (if you don't use error ignoring or error codes c
let jshint2_error = 0
```

Set default height of error list:
Set min and max height of error list:

```vim
let jshint2_height = 20
let jshint2_height = 3
let jshint2_height = 12
```

## Tips
Expand Down
18 changes: 14 additions & 4 deletions plugin/jshint2.vim
Expand Up @@ -49,9 +49,14 @@ if !exists('g:jshint2_error')
let g:jshint2_error = 1
endif

" define error list height variable
if !exists('g:jshint2_height')
let g:jshint2_height = 10
" define error list min height variable
if !exists('g:jshint2_min_height')
let g:jshint2_min_height = 3
endif

" define error list max height variable
if !exists('g:jshint2_max_height')
let g:jshint2_max_height = 12
endif

" define local binary path
Expand Down Expand Up @@ -206,7 +211,12 @@ function s:Lint(start, stop, show, flags)

" open location list if there is no bang
if a:show
execute 'belowright lopen '.g:jshint2_height
let l:length = l:length + 1

let l:height = (l:length < g:jshint2_min_height ? g:jshint2_min_height :
\ (l:length + 1 > g:jshint2_max_height ? g:jshint2_max_height : l:length))

execute 'belowright lopen '.l:height
endif
else
call s:Echo('More', 'JSHint did not find any errors.'.l:ignored)
Expand Down

0 comments on commit 26dca23

Please sign in to comment.