作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何保存寄存器的当前状态并在以后恢复它?
我想确保我的函数没有意外的副作用。
最佳答案
为了安全地执行此操作,您不仅需要恢复寄存器的内容,还需要恢复其类型:
let old_reg = getreg("a") " Save the current content of register 'a'
let old_reg_type = getregtype("a") " Save the type of the register as well
" <Use the register 'a' as a temporary scratch pad here>
call setreg("a", old_reg, old_reg_type) " Restore register 'a'
关于脚本 : How do I save and restore a register?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38720452/
我是一名优秀的程序员,十分优秀!