summaryrefslogtreecommitdiffstats
path: root/autoload/rustfmt.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/rustfmt.vim')
-rw-r--r--autoload/rustfmt.vim10
1 files changed, 8 insertions, 2 deletions
diff --git a/autoload/rustfmt.vim b/autoload/rustfmt.vim
index 96fffb26..908eb325 100644
--- a/autoload/rustfmt.vim
+++ b/autoload/rustfmt.vim
@@ -149,6 +149,7 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
call delete(l:stderr_tmpname)
+ let l:open_lwindow = 0
if v:shell_error == 0
" remove undo point caused via BufWritePre
try | silent undojoin | catch | endtry
@@ -169,7 +170,7 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
if s:got_fmt_error
let s:got_fmt_error = 0
call setloclist(0, [])
- lwindow
+ let l:open_lwindow = 1
endif
elseif g:rustfmt_fail_silently == 0 && a:fail_silently == 0
" otherwise get the errors and put them in the location list
@@ -201,7 +202,7 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
endif
let s:got_fmt_error = 1
- lwindow
+ let l:open_lwindow = 1
endif
" Restore the current directory if needed
@@ -213,6 +214,11 @@ function! s:RunRustfmt(command, tmpname, fail_silently)
endif
endif
+ " Open lwindow after we have changed back to the previous directory
+ if l:open_lwindow == 1
+ lwindow
+ endif
+
silent! loadview
endfunction