sponsor Vim development Vim logo Vim Book Ad

fortunes_movement : Movement over email fortunes with ]] etc.

 script karma  Rating 0/0, Downloaded by 1178  Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
script type
This filetype plugin provides movement commands and text objects for email
fortunes, i.e. blocks of text delimited by /^-- \?$/.

                        Move around fortunes:
]]                      Go to [count] next start of a fortune.
][                      Go to [count] next end of a fortune.
[[                      Go to [count] previous start of a fortune.
[]                      Go to [count] previous end of a fortune.

if                      "inner fortune" text object, select [count] fortunes,
                        excluding the fortune separator.
af                      "a fortune" text object, select [count] fortunes, including
                        the preceding fortune separator.
install details
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vba.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 fortune_movement.vba.gz
    :so %
To uninstall, use the :RmVimball command.

- Requires Vim 7.0 or higher.
- Requires the CountJump plugin (vimscript #3130), version 1.30.

The commands and text objects are only active when 'filetype' is set to
You need to make sure that the filetype is properly detected, for example via
the following fragment in .vim/filetype.vim:
    augroup filetypedetect
        " Fortunes files.
        autocmd BufNewFile,BufRead fortunes.txt,*/fortunes/*.txt setf fortunes
    augroup END
or manually set the filetype every time via
    :setf fortunes
If you want to use this plugin also for other filetypes, e.g. "txt", create a
file ftplugin/txt_movement.vim in your 'runtimepath' (usually ~/.vim) with the
following contents:
    runtime! ftplugin/fortunes_movement.vim
This is more maintainable than simply renaming fortunes_movement.vim.

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
fortunes_movement.vba.gz 1.10 2010-12-20 7.0 Ingo Karkat Switched definition of motion mappings from patterns to begin and end to a region of continguous lines defined by a non-matching pattern (representing the fortune separator line). This should make it more correct with corner cases. Requires CountJump version 1.30.
fortunes_movement.vba.gz 1.00 2010-08-03 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.