在vim中,如何让文件在上次关闭的同一行号上打开? [英] In vim, how do I get a file to open at the same line number I closed it at last time?
本文介绍了在vim中,如何让文件在上次关闭的同一行号上打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想配置 vim 在我离开的地方打开一个文件.
I want to configure vim to open a file at the same place I left off at.
推荐答案
从 Ubuntu 的 /etc/vim/vimrc
文件中,注释掉这个例子:
From Ubuntu's /etc/vim/vimrc
file, this example is commented out:
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
如果这不起作用,一个常见的问题是没有您的 ~/.viminfo
文件的所有权.如果是这种情况,请运行:
If this doesn't work, a common problem is not having ownership of your ~/.viminfo
file. If this is the case, then run:
sudo chown user:group ~/.viminfo
user 是您的 username
,group
通常与您的用户名相同.
where user is your username
and group
is often the same as your username.
这篇关于在vim中,如何让文件在上次关闭的同一行号上打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文