怎样设置vi才能在打开文件时自动跳转到上一次退出的地方?

Vim、Emacs配置和使用
回复
IamLarry
帖子: 29
注册时间: 2007-04-19 16:44

怎样设置vi才能在打开文件时自动跳转到上一次退出的地方?

#1

帖子 IamLarry » 2007-06-07 20:25

??
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#2

帖子 BigSnake.NET » 2007-06-07 20:30

代码: 全选

"Restore cursor to file position in previous editing session
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#3

帖子 iblicf » 2007-06-07 20:34

记住行号不就行了么,,:1000 ,假如是1000行处,我自己写程序的时候习惯 做个记号,,比如 hello,,下次打开文件直接 /hello 就跳到那了
IamLarry
帖子: 29
注册时间: 2007-04-19 16:44

#4

帖子 IamLarry » 2007-06-07 21:05

我记得有个选项直接打开就行的
但忘了哪个
ltkun
帖子: 1340
注册时间: 2006-01-10 19:09

#5

帖子 ltkun » 2007-06-07 21:29

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
IamLarry
帖子: 29
注册时间: 2007-04-19 16:44

#6

帖子 IamLarry » 2007-06-08 15:53

找到上边这段设置了
在/etc/vim/vimrc里边,uncomment就行了
回复