Vim如何使您回到上次编辑文件时的状态? [英] How do you make Vim take you back where you were when you last edited a file?

查看:341
本文介绍了Vim如何使您回到上次编辑文件时的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

在vim中,我如何在同一行中打开一个文件我上次关闭它的数量?

您如何制作 Vim 带您回到上次编辑文件时的位置吗?

How do you make Vim take you back where you were when you last edited a file?

我的工作计算机具有此功能,但我的家用计算机没有此功能!您如何设置Vim来记住您上次编辑文件时位于文件的哪个部分?

My work computer has this feature, but not my home computer! How do you set Vim to remember in which part of a file you were when you last edited it?

编辑:准确地说,我希望这种行为打开新文件时或启动时

just to be more precise, I want this behavior when opening a new file, or on startup.

推荐答案

我在.vimrc中包含了这个文件,并且可以正常工作:

I have this in my .vimrc and it works:

" go to the position I was when last editing the file
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif

这篇关于Vim如何使您回到上次编辑文件时的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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