Reputation: 9447
Upvotes: 1
Views: 221
Reputation: 30418
Add this to your ~/.vimrc
:
nnoremap <c-m> :execute 'buffer' getpos("'" . nr2char(getchar()))[0]<cr>
Then just bookmark the file using mX
, and jump to the last position in it using <c-m>X
.
Upvotes: 0
Reputation: 172708
You can do that with (uppercase) file marks by just considering the buffer number; i.e. instead of recalling the (exact marked) position via A
, do
:execute 'buffer' getpos("'A")[0]
As Vim remembers the last position in the buffer, it'll take you there, not to the marked position.
Upvotes: 3
Reputation: 45157
Marks are used to go to a specific line, column, and file in which they are set. That is there purpose.
Options that might work for you:
mA
:b foo
(:b
can take partial filenames):b 12
(avoid this)<c-o>
to go back to the buffer<c-6>
to jump to the previous bufferPersonally I would just set another uppercase mark or use :b
.
Upvotes: 2