Favourite places in vim

前端 未结 5 1299
逝去的感伤
逝去的感伤 2021-02-08 13:44

Is there a command in vim that can bookmark a place (path to the file, line number in that file), so that I can go to that place easily later?

It would be s

5条回答
  •  暖寄归人
    2021-02-08 14:24

    " When editing a file, always jump to the last known cursor position.
    " And open enough folds to make the cursor is not folded
    " Don't do it when the position is invalid or when inside an event handler
    " (happens when dropping a file on gvim).
    autocmd BufWinEnter *
                \ if line("'\"") <= line("$") |
                \   exe "normal! g`\"" | exe "normal! zv" |
                \ endif
    

提交回复
热议问题