summaryrefslogtreecommitdiffstats
path: root/autoload/rustfmt.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-04-23 11:32:40 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2019-04-23 11:32:40 +0200
commit4d18a5e5dd427a2962fe34c6a12007cac67ce89c (patch)
tree1a7cb73806c54fbbdc1e3645e0ee1d7e5559c1a0 /autoload/rustfmt.vim
parenta55b6aa3aa797c989a4979a13a5bd2ae11cfd4a5 (diff)
downloadvim-polyglot-4d18a5e5dd427a2962fe34c6a12007cac67ce89c.tar.gz
vim-polyglot-4d18a5e5dd427a2962fe34c6a12007cac67ce89c.zip
Update
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