aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/tlib_vim/autoload/tlib/normal.vim
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
committerKarel Kočí <cynerd@email.cz>2016-06-30 16:03:25 +0200
commite573b3020c032400eed60b649a2cbf55266e6bb0 (patch)
tree8f572394ac8433529c7a8e70d160a2fbe8268b4e /vim/bundle/tlib_vim/autoload/tlib/normal.vim
parentb8c667bd64b3edd38d56c63c5bd1db53a23b4499 (diff)
downloadmyconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.gz
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.tar.bz2
myconfigs-e573b3020c032400eed60b649a2cbf55266e6bb0.zip
Add current configurations from old repository
Diffstat (limited to 'vim/bundle/tlib_vim/autoload/tlib/normal.vim')
-rwxr-xr-xvim/bundle/tlib_vim/autoload/tlib/normal.vim34
1 files changed, 34 insertions, 0 deletions
diff --git a/vim/bundle/tlib_vim/autoload/tlib/normal.vim b/vim/bundle/tlib_vim/autoload/tlib/normal.vim
new file mode 100755
index 0000000..faaa444
--- /dev/null
+++ b/vim/bundle/tlib_vim/autoload/tlib/normal.vim
@@ -0,0 +1,34 @@
+" normal.vim
+" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
+" @Website: http://www.vim.org/account/profile.php?user_id=4037
+" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
+" @Created: 2008-10-06.
+" @Last Change: 2010-09-22.
+" @Revision: 28
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+
+" :display: tlib#normal#WithRegister(cmd, ?register='t', ?norm_cmd='norm!')
+" Execute a normal command while maintaining all registers.
+function! tlib#normal#WithRegister(cmd, ...) "{{{3
+ TVarArg ['register', 't'], ['norm_cmd', 'norm!']
+ let registers = {}
+ for reg in split('123456789'. register, '\zs')
+ exec 'let registers[reg] = @'. reg
+ endfor
+ exec 'let reg = @'. register
+ try
+ exec norm_cmd .' '. a:cmd
+ exec 'return @'. register
+ finally
+ for [reg, value] in items(registers)
+ exec 'let @'. reg .' = value'
+ endfor
+ endtry
+endf
+
+
+let &cpo = s:save_cpo
+unlet s:save_cpo