Skip to content

Commit

Permalink
Restore current window settings after use
Browse files Browse the repository at this point in the history
  • Loading branch information
mperry2 committed Apr 16, 2022
1 parent fd3af75 commit dc9537c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugin/vim-pipe.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ call s:SetGlobalOptDefault('vimpipe_invoke_map', '<LocalLeader>r')
call s:SetGlobalOptDefault('vimpipe_close_map', '<LocalLeader>p')
call s:SetGlobalOptDefault('vimpipe_silent', 0)

function! VimPipe() range "{{{1
function! VimPipe() "{{{1
let l:winview = winsaveview()
%call s:DoVimPipe()
call winrestview(l:winview)
endfunction

function! s:DoVimPipe() range "{{{1
" Save local settings.
let saved_unnamed_register = @@
let switchbuf_before = &switchbuf
Expand Down Expand Up @@ -108,6 +114,6 @@ function! VimPipe() range "{{{1
endfunction

" Define Mappings {{{1
execute "nnoremap <silent> " . g:vimpipe_invoke_map . " :%call VimPipe()<CR>"
execute "nnoremap <silent> " . g:vimpipe_invoke_map . " :call VimPipe()<CR>"
" Modeline {{{1
" vim: set foldlevel=1 foldmethod=marker:

0 comments on commit dc9537c

Please sign in to comment.