Loading ...
Sorry, an error occurred while loading the content.

54556Re: bookmarks: helpful for source code writing

Expand Messages
  • Antoine J. Mechelynck
    Oct 25, 2004
    • 0 Attachment
      Neil Zanella <nzanella@...> wrote:
      > Hello,
      >
      > I need the following feature in vim:
      >
      > - I want to be able to bookmark source code (or other) files.

      These are known as "marks" in Vim parlance. Their use is explained starting
      at ":help mark-motions". Since you want to be able to use them to jump from
      one file to another, what you want are the "file marks". You can have at
      most 26 of them ('A to 'Z), which remember not only file names but also
      cursor positions. There are also 26 "local" marks for each file ('a to 'z)
      and 10 read-only marks ('0 to '9) showing where the cursor was the 10 latest
      times you quit Vim. All those marks (and the jump history) can remembered
      from one run of Vim to the next by means of the viminfo file (see ":help
      viminfo" and ":help 'viminfo'").

      > - I want to be able to split the screen so that one screen displays
      > bookmarks, consisting of absolute path names to files.

      The following quick'n-dirty scriptlet does it. (It clobbers the unnamed
      register.)

      :redir @"
      :marks
      :redir END
      :new
      :put!

      > - Highlighting a path name brings me to the source code for that file
      > in the other
      > window in the split.

      You would need to write a function for that, possibly wrap it in a
      user-command, and map it buffer-locally to the Enter key. It is possible,
      probably rather easily, but it's not ready-made AFAIK (I don't know
      everything though). See
      :help :function
      :help :command
      :help :map
      :help :map-overview
      :help getline()

      You might also try to search the scripts database at
      http://vim.sourceforge.net/ -- I'm not sure what to use as a search key.
      Maybe "marks".

      >
      > Is this possible. I would even be surprised if it hadn't been done.
      >
      > Thanks,
      >
      > Neil

      HTH,
      Tony.
    • Show all 6 messages in this topic