aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload/filter.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/autoload/filter.vim')
-rw-r--r--vim/autoload/filter.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/vim/autoload/filter.vim b/vim/autoload/filter.vim
new file mode 100644
index 00000000..f499f432
--- /dev/null
+++ b/vim/autoload/filter.vim
@@ -0,0 +1,7 @@
+" Run a filter over the entire buffer, but save the window position and
+" restore it after doing so
+function! filter#Stable(command) abort
+ let l:view = winsaveview()
+ execute '%' . a:command
+ call winrestview(l:view)
+endfunction