Code Monkey home page Code Monkey logo

mark's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1238

This script is written to highlight several words in different colors simultaneously. For example, when you are browsing a big program file, you could highlight some key variables. This will make it easier to trace the source code.

I think this script is functional similar with MultipleSearch vimscript #479.

Usage:

Highlighting:
  Normal mode:
    \m mark or unmark the word under (or before) the cursor
          Place the cursor under the word to be highlighted, press \m, then the word will be colored.
    \r manually input a regular expression
          To highlight an arbitrary regular expression, press \r and input the regexp.
    \n clear this mark (i.e. the mark under the cursor), or clear all highlighted marks
  Visual mode:
    \m mark or unmark a visual selection
          Select some text in Visual mode, press \m, then the selection will be colored.
    \r manually input a regular expression (base on the selection text)
  Command line:
    :Mark regexp   to mark a regular expression
    :Mark regexp   with exactly the same regexp to unmark it
    :Mark          to clear all marks
Searching:
  Normal mode:
    * # \* \# \/ \? use these six keys to jump to the other marks
    and you could also use VIM's / and ? to search, since the mark patterns have
    been added to the search history.

Here is a sumerization of * # \* \# \/ \?:

" First of all, \#, \? and # behave just like \*, \/ and *, respectively,
" except that \#, \? and # search backward.
"
" \*, \/ and *'s behaviors differ base on whether the cursor is currently
" placed over an active mark:
"
"       Cursor over mark                  Cursor not over mark
" ---------------------------------------------------------------------------
"  \*   jump to the next occurrence of      jump to the next occurrence of
"       current mark, and remember it       "last mark".
"       as "last mark".
"
"  \/   jump to the next occurrence of        same as left
"       ANY mark.
"
"   *   if \* is the most recently used,        do VIM's original *
"       do a \*; otherwise (\/ is the
"       most recently used), do a \/.

Screenshot:
http://elephant.net.cn/files/vim_screenshot.png (It is also the screenshot of my colorscheme vimscript #1253.)

Bugs and Notes:
Some words which have been already colored by syntax scripts could not be highlighted.

mark.vim should be re-sourced after any changing to colors. For example, if you
:set background=dark  OR
:colorscheme default
you should
:source PATH_OF_PLUGINS/mark.vim
after that. Otherwise, you won't see the colors.
Unfortunately, it seems that .gvimrc runs after plugin scripts. So if you set any color settings in .gvimrc, you have to add one line to the end of .gvimrc to source mark.vim.

mark's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.