aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitermayer <mitermayer.reis@gmail.com>2018-03-25 15:08:37 -0700
committermitermayer <mitermayer.reis@gmail.com>2018-03-25 15:08:37 -0700
commita0ab8e9b30022d00f5e6fa82a0204846c99b485b (patch)
treead0856d49eba64a4d7d908ccd6362424db29c712
parent31c10476272da60990d5e0639b8da15c76a5fa47 (diff)
downloadvim-prettier-a0ab8e9b30022d00f5e6fa82a0204846c99b485b.tar.xz
Updating the logic for controlling the quickfix flag
- Negation flags are usually more confusing to understand specially when the default is having it enabled.
-rw-r--r--README.md5
-rw-r--r--autoload/prettier.vim2
-rw-r--r--doc/prettier.txt5
-rw-r--r--plugin/prettier.vim2
4 files changed, 6 insertions, 8 deletions
diff --git a/README.md b/README.md
index b7f7741..226bdf8 100644
--- a/README.md
+++ b/README.md
@@ -129,11 +129,10 @@ By default parsing errors will open the quickfix but can also be disabled
let g:prettier#quickfix_enabled = 0
```
-Have the cursor returned to its original window after the quickfix window is
-shown.
+By default we auto focus on the quickfix when there are errors but can also be disabled
```vim
-let g:prettier#no_focus_quicklist = 0
+let g:prettier#quickfix_auto_focus = 0
```
To enable vim-prettier to run in files without requiring the "@format" doc tag.
diff --git a/autoload/prettier.vim b/autoload/prettier.vim
index 5f48033..4b5a4e9 100644
--- a/autoload/prettier.vim
+++ b/autoload/prettier.vim
@@ -251,7 +251,7 @@ function! s:Handle_Parsing_Errors(out) abort
let l:winnr = winnr()
call setqflist(l:errors, 'r')
botright copen
- if g:prettier#no_focus_quicklist
+ if !g:prettier#quickfix_auto_focus
" Return the cursor back to the main buffer.
exe l:winnr . 'wincmd w'
endif
diff --git a/doc/prettier.txt b/doc/prettier.txt
index 41f43e0..ed074cf 100644
--- a/doc/prettier.txt
+++ b/doc/prettier.txt
@@ -109,10 +109,9 @@ By default parsing errors will open the quickfix but can also be disabled
>
let g:prettier#quickfix_enabled = 1
<
-Have the cursor returned to its original window after the quickfix window is
-shown.
+By default we auto focus on the quickfix when there are errors but can also be disabled
>
- let g:prettier#no_focus_quicklist = 0
+ let g:prettier#quickfix_auto_focus = 0
<
To enable vim-prettier to run in files without requiring the "@format" doc tag.
First disable the default autoformat, then update to your own custom behaviour
diff --git a/plugin/prettier.vim b/plugin/prettier.vim
index b4ff4b0..da008fe 100644
--- a/plugin/prettier.vim
+++ b/plugin/prettier.vim
@@ -70,7 +70,7 @@ let g:prettier#config#config_precedence = get(g:, 'prettier#config#config_preced
let g:prettier#config#prose_wrap = get(g:, 'prettier#config#prose_wrap', 'preserve')
" Don't leave the quicklist focused on error.
-let g:prettier#no_focus_quicklist = get(g:, 'prettier#no_focus_quicklist', 0)
+let g:prettier#quickfix_auto_focus = get(g:, 'prettier#quickfix_auto_focus', 1)
" synchronous by default
command! -nargs=? -range=% Prettier call prettier#Prettier(g:prettier#exec_cmd_async, <line1>, <line2>)