sponsor Vim development Vim logo Vim Book Ad

AdvancedMarks : Work with marks with more power.

 script karma  Rating 1/1, Downloaded by 343  Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
script type
This plugin extends Vim's built-in mark handling. The :mark command can only
set lines; with :SetMarks, you can also pass a column. :Delmarks is an
extension of|:delmarks| that defaults to all marks and can wipe lowercase
marks in all buffers and uppercase marks also from the viminfo file (to keep
them from reappearing after a Vim restart).
If you use marks as bookmarks for interesting areas in a buffer, new commands
let you yank the marked lines (:YankMarks) or ranges (:YankMarkRanges,
using 'a to 'A, 'b to 'B, and so on). There are variants for ordering the
yanks by marks or lines. A separate :ReorderMarks command lets you reorder
messed up marks (e.g. if you forget setting a mark in the middle of a buffer).

- :YankMarks is inspired by http://stackoverflow.com/a/16314609/813602

:SetMarks {lnum[:col]} [...]
                        Set available lowercase marks to the passed lines [and
                        virtual column]. The numbers can be separated by any
:SetMARKS {lnum[:col]} [...]
                        Like :SetMarks, but use global uppercase marks.

:Delmarks[!]            Delete all named marks a-z (current buffer, with [!]
                        in all buffers) and global file marks A-Z (with [!]
                        also in the viminfo file).
:Delmarks[!] {marks}    Delete {marks}, with [!] lowercase ones in all
                        buffers, and uppercase ones also in the viminfo

:[range]ReorderMarks [{marks}] [{order-expression}]
                        Reorder [a-z] / {marks} marks alphabetically / in the
                        order of given {marks} / ascending based on the value
                        returned by {order-expression} (which is evaluated
                        once on each marked line) from begin to end of the

:[range]YankMarksByMark [{marks}] [{register}]
                        Yank all marked (with [a-z] / {marks} marks) lines
                        into the default register / {register} (in the order
                        of the marks, default alphabetically or as given).
:[range]YankMarksByLines [{marks}] [{register}]
                        Same as :YankMarksByMark, but yank marks from begin to
                        end of the buffer.

:[range]YankMarkRangesByMark [{marks}] [{register}]
                        Yank all ranges of lines that start with a lowercase
                        [a-z] / {marks} mark and end with the corresponding
                        uppercase [A-Z] mark in the current buffer into the
                        default register / {register} (in the order of the
:[range]YankMarkRangesByLines [{marks}] [{register}]
                        Same as :YankMarkRangesByMark, but yank marks from
                        begin to end of the buffer.
install details
The code is hosted in a Git repo at https://github.com/inkarkat/vim-AdvancedMarks
You can use your favorite plugin manager, or "git clone" into a directory used
for Vim packages. Releases are on the "stable" branch, the latest unstable
development snapshot on "master".

This script is also packaged as a vimball. If you have the "gunzip"
decompressor in your PATH, simply edit the *.vmb.gz package in Vim; otherwise,
decompress the archive first, e.g. using WinZip. Inside Vim, install by
sourcing the vimball or via the :UseVimball command.
    vim AdvancedMarks*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.038 or
- Requires the ArgsAndMore.vim plugin (vimscript #4152), version 2.11 or
  higher (only for :Delmarks! deletion in all buffers).

- :ReorderMarks issues a MarksUpdated User event. A plugin that displays
  marks (e.g. via signs, like ShowMarks.vim) can be triggered by this to
  update the marks.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
AdvancedMarks-1.00.vmb.gz 1.00 2019-06-10 7.0 Ingo Karkat Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.