Vim Tips Wiki
Register
(Standard format.)
(→‎Comments: Answer comment about mapping conflicts.)
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{ScriptComments|mark: highlight several words in different colors}}
 
{{ScriptComments|mark: highlight several words in different colors}}
  +
  +
==Comments==
  +
  +
Is there anyway to install it with vundle.
  +
I use 'BundleSearch mark', and tried some, it turned out to be the other plugin.
  +
  +
--July 23, 2014
  +
  +
:You can use the [https://github.com/vim-scripts/Mark--Karkat vim-scripts/Mark--Karkat] repo, mirrored by vimscripts.org; unfortunately, their scraper apparently still doesn't work well with plugins (forks) having identical names, so that version is out-of-date, but usable.
  +
: -- [[User:Inkarkat|Inkarkat]] ([[User talk:Inkarkat|talk]]) 06:54, July 24, 2014 (UTC)
   
 
==Comments==
 
==Comments==
 
Its mappings may be in conflict with [[Script:1682|IndexedSearch]]. --July 19, 2012
 
Its mappings may be in conflict with [[Script:1682|IndexedSearch]]. --July 19, 2012
  +
:You can easily change them; the plugin uses the canonical <tt>&lt;Plug&gt;</tt>-mechanism. I personally don't like the default mappings and have redefined them all, but I kept the original ones for backward compatibility.
  +
: -- [[User:Inkarkat|Inkarkat]] ([[User talk:Inkarkat|talk]]) 07:17, July 24, 2014 (UTC)
  +
  +
==Comments==
  +
After playing with this script for a few hours, I still failed to figure out how to use it for two important scenario:
  +
  +
1, Suppose I am edit a big file, and I want to search for a pattern using <Leader>r, after I input the regular expression and press Return, I don't know if there is any match since the cursor does not jump to the first match. I have to return to the old Vim search way.
  +
:As the <tt>&lt;Leader&gt;r</tt> command sets the last search to the entered mark, you can just press <tt>&lt;Leader&gt;*</tt> to jump to the next occurrence of it.
  +
: -- [[User:Inkarkat|Inkarkat]] ([[User talk:Inkarkat|talk]]) 07:15, July 24, 2014 (UTC)
  +
  +
2, Suppose I have a few patterns highlighted, for example, 'foo', 'bar' and 'qaz'. Now I just searched for 'qaz' and it is in the screen, now if I want to jump to the occurrence of 'bar', I don't know what to do other than randomly srolling the screen up and down for that pattern. I don't know if this script has a search command which accepts a marker number [N].
  +
:You can use the <tt>&lt;k1&gt;</tt>, etc. keypad mappings to jump to the next occurrence of mark <tt>1</tt> etc.; it's also possible to define a separate mapping that interprets the <tt>[count]</tt> as the mark group (I personally use such). If you've forgotten the mark number, <tt>:Marks</tt> lists them all.
  +
: -- [[User:Inkarkat|Inkarkat]] ([[User talk:Inkarkat|talk]]) 07:15, July 24, 2014 (UTC)

Revision as of 07:17, 24 July 2014

Use this page to discuss script 2666 mark: highlight several words in different colors

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Comments

Is there anyway to install it with vundle. I use 'BundleSearch mark', and tried some, it turned out to be the other plugin.

--July 23, 2014

You can use the vim-scripts/Mark--Karkat repo, mirrored by vimscripts.org; unfortunately, their scraper apparently still doesn't work well with plugins (forks) having identical names, so that version is out-of-date, but usable.
-- Inkarkat (talk) 06:54, July 24, 2014 (UTC)

Comments

Its mappings may be in conflict with IndexedSearch. --July 19, 2012

You can easily change them; the plugin uses the canonical <Plug>-mechanism. I personally don't like the default mappings and have redefined them all, but I kept the original ones for backward compatibility.
-- Inkarkat (talk) 07:17, July 24, 2014 (UTC)

Comments

After playing with this script for a few hours, I still failed to figure out how to use it for two important scenario:

1, Suppose I am edit a big file, and I want to search for a pattern using <Leader>r, after I input the regular expression and press Return, I don't know if there is any match since the cursor does not jump to the first match. I have to return to the old Vim search way.

As the <Leader>r command sets the last search to the entered mark, you can just press <Leader>* to jump to the next occurrence of it.
-- Inkarkat (talk) 07:15, July 24, 2014 (UTC)

2, Suppose I have a few patterns highlighted, for example, 'foo', 'bar' and 'qaz'. Now I just searched for 'qaz' and it is in the screen, now if I want to jump to the occurrence of 'bar', I don't know what to do other than randomly srolling the screen up and down for that pattern. I don't know if this script has a search command which accepts a marker number [N].

You can use the <k1>, etc. keypad mappings to jump to the next occurrence of mark 1 etc.; it's also possible to define a separate mapping that interprets the [count] as the mark group (I personally use such). If you've forgotten the mark number, :Marks lists them all.
-- Inkarkat (talk) 07:15, July 24, 2014 (UTC)