Vim从光标开始,最后一次熄灭 [英] Vim start with cursor where last went off

查看:197
本文介绍了Vim从光标开始,最后一次熄灭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让Vim总是从我上次退出该文件时的行开始?

How do i make Vim always start at the line I was at when i exited that given file last time?

推荐答案

将这个放在你的.vimrc中:

Put this in your .vimrc:

" When editing a file, always jump to the last cursor position
 au BufReadPost *
       \ if ! exists("g:leave_my_cursor_position_alone") |
       \     if line("'\"") > 0 && line ("'\"") <= line("$") |
       \         exe "normal g'\"" |
       \     endif |
       \ endif

那么你可以使用:let g: leave_my_cursor_position_alone = 1 在运行时停用该功能。

then you can use :let g:leave_my_cursor_position_alone=1 at runtime to deactivate the feature.

这篇关于Vim从光标开始,最后一次熄灭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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