Vim 返回到文件中的最后一个点

Vim 返回到文件中的最后一个点

有人可以解释一下这是做什么的或者给我指出 vimdocs 吗?line("'\"")

function! ResCur()$
  if line("'\"") <= line("$")
    normal! g`" 
    return 1
  endif$
endfunction

该功能用于在打开文件时将插入符号返回到同一行。

答案1

由于被双引号括起来,因此"用反斜杠进行转义。'"

:help '"说:

To the cursor position when last exiting the current
buffer.  Defaults to the first character of the first
line.  See last-position-jump for how to use this
for each opened file.
Only one position is remembered per buffer, not one
for each window.  As long as the buffer is visible in
a window the position won't be changed.

相关内容