在 VIM 中保留上次编辑位置 [英] Preserve last editing position in VIM

查看:83
本文介绍了在 VIM 中保留上次编辑位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我退出 VIM 并再次打开同一个文件时,我被定位在文件的开头.如何保留最后一个光标位置?

When I quit VIM and open the same file again, I am positioned at the start of the file. How can I preserve the last cursor position?

推荐答案

开箱即用".vimrc 通过以下语句实现:

The "out of the box" .vimrc enables this with the statement:

source $VIMRUNTIME/vimrc_example.vim

你可能只需要在你的 .vimrc 中恢复这个语句.在任何情况下,请参阅 vimrc_example.vim 以及 line() 函数 在 Vim 手册中 讨论它是如何工作的.

You may just need to restore this statement in your .vimrc. In any case, see vimrc_example.vim and also see the line() function in the Vim manual for a discussion of how it works.

这篇关于在 VIM 中保留上次编辑位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆