mirror of
https://github.com/gryf/.vim.git
synced 2025-12-18 12:00:30 +01:00
Update of Mark, syntastic, taglisttoo and ctrlp plugins
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
*mark.txt* Highlight several words in different colors simultaneously.
|
||||
*mark.txt* Highlight several words in different colors simultaneously.
|
||||
|
||||
MARK by Ingo Karkat
|
||||
(original version by Yuheng Xie)
|
||||
@@ -26,25 +26,27 @@ doesn't maintain his original version anymore and cannot be reached via the
|
||||
email address in his profile. This plugin offers the following advantages over
|
||||
the original:
|
||||
- Much faster, all colored words can now be highlighted, no more clashes with
|
||||
syntax highlighting (due to use of matchadd()).
|
||||
- Many bug fixes.
|
||||
- Jumps behave like the built-in search, including wrap and error messages.
|
||||
syntax highlighting (due to use of matchadd()).
|
||||
- Many bug fixes.
|
||||
- Jumps behave like the built-in search, including wrap and error messages.
|
||||
- Like the built-in commands, jumps take an optional [count] to quickly skip
|
||||
over some marks.
|
||||
over some marks.
|
||||
- Marks can be persisted, and patterns can be added / subtracted from
|
||||
mark highlight groups.
|
||||
|
||||
RELATED WORKS *
|
||||
|
||||
- MultipleSearch (vimscript #479) can highlight in a single window and in all
|
||||
buffers, but still relies on the :syntax highlighting method, which is
|
||||
slower and less reliable.
|
||||
slower and less reliable.
|
||||
- http://vim.wikia.com/wiki/Highlight_multiple_words offers control over the
|
||||
color used by mapping the 1-9 keys on the numeric keypad, persistence, and
|
||||
highlights only a single window.
|
||||
highlights only a single window.
|
||||
- highlight.vim (vimscript #1599) highlights lines or patterns of interest in
|
||||
different colors, using mappings that start with CTRL-H and work on cword.
|
||||
different colors, using mappings that start with CTRL-H and work on cword.
|
||||
- quickhl.vim (vimscript #3692) can also list the matches with colors and in
|
||||
addition offers on-the-fly highlighting of the current word (like many IDEs
|
||||
do).
|
||||
do).
|
||||
|
||||
==============================================================================
|
||||
USAGE *mark-usage*
|
||||
@@ -52,38 +54,68 @@ USAGE *mark-usage*
|
||||
HIGHLIGHTING *mark-highlighting*
|
||||
*<Leader>m* *v_<Leader>m*
|
||||
<Leader>m Mark the word under the cursor, similar to the |star|
|
||||
command. The next free highlight group is used.
|
||||
command. The next free highlight group is used.
|
||||
If already on a mark: Clear the mark, like
|
||||
|<Leader>n|.
|
||||
{Visual}<Leader>m Mark or unmark the visual selection.
|
||||
|<Leader>n|.
|
||||
{Visual}<Leader>m Mark or unmark the visual selection.
|
||||
[N]<Leader>m With [N], mark the word under the cursor with the
|
||||
named highlight group [N]. When that group is not
|
||||
empty, the word is added as an alternative match, so
|
||||
you can highlight multiple words with the same color.
|
||||
When the word is already contained in the list of
|
||||
alternatives, it is removed.
|
||||
|
||||
When [N] is greater than the number of defined mark
|
||||
groups, a summary of marks is printed. Active mark
|
||||
groups are prefixed with "*" (or "M*" when there are
|
||||
M pattern alternatives), the default next group with
|
||||
">", the last used search with "/" (like |:Marks|
|
||||
does). Input the mark group, accept the default with
|
||||
<CR>, or abort with <Esc> or any other key.
|
||||
This way, when unsure about which number represents
|
||||
which color, just use 99<Leader>n and pick the color
|
||||
interactively!
|
||||
|
||||
{Visual}[N]<Leader>m Ditto, based on the visual selection.
|
||||
|
||||
*<Leader>r* *v_<Leader>r*
|
||||
<Leader>r Manually input a regular expression to mark.
|
||||
{Visual}<Leader>r Ditto, based on the visual selection.
|
||||
<Leader>r Manually input a regular expression to mark.
|
||||
{Visual}<Leader>r Ditto, based on the visual selection.
|
||||
|
||||
In accordance with the built-in |star| command,
|
||||
all these mappings use 'ignorecase', but not
|
||||
'smartcase'.
|
||||
'smartcase'.
|
||||
*<Leader>n*
|
||||
<Leader>n Clear the mark under the cursor.
|
||||
If not on a mark: Disable all marks, similar to
|
||||
|:nohlsearch|.
|
||||
|
||||
|:nohlsearch|.
|
||||
Note: Marks that span multiple lines are not detected,
|
||||
so the use of <Leader>n on such a mark will
|
||||
unintentionally remove all marks! Use
|
||||
{Visual}<Leader>r or :Mark {pattern} to clear
|
||||
multi-line marks.
|
||||
multi-line marks (or pass [N] if you happen to know
|
||||
the group number).
|
||||
[N]<Leader>n Clear the marks represented by highlight group [N].
|
||||
|
||||
*:Mark*
|
||||
:Mark {pattern} Mark or unmark {pattern}.
|
||||
:[N]Mark Clear the marks represented by highlight group [N].
|
||||
:[N]Mark {pattern} Mark or unmark {pattern}. Unless [N] is given, the
|
||||
next free highlight group is used.
|
||||
With [N], mark the word under the cursor with the
|
||||
named highlight group [N]. When that group is not
|
||||
empty, the word is added as an alternative match, so
|
||||
you can highlight multiple words with the same color.
|
||||
When the word is already contained in the list of
|
||||
alternatives, it is removed.
|
||||
For implementation reasons, {pattern} cannot use the
|
||||
'smartcase' setting, only 'ignorecase'.
|
||||
'smartcase' setting, only 'ignorecase'.
|
||||
:Mark Disable all marks, similar to |:nohlsearch|. Marks
|
||||
will automatically re-enable when a mark is added or
|
||||
removed, or a search for marks is performed.
|
||||
removed, or a search for marks is performed.
|
||||
*:MarkClear*
|
||||
:MarkClear Clear all marks. In contrast to disabling marks, the
|
||||
actual mark information is cleared, the next mark will
|
||||
use the first highlight group. This cannot be undone.
|
||||
use the first highlight group. This cannot be undone.
|
||||
|
||||
|
||||
SEARCHING *mark-searching*
|
||||
@@ -92,63 +124,79 @@ SEARCHING *mark-searching*
|
||||
[count]<Leader>* [count]<Leader>#
|
||||
[count]<Leader>/ [count]<Leader>?
|
||||
Use these six keys to jump to the [count]'th next /
|
||||
previous occurrence of a mark.
|
||||
previous occurrence of a mark.
|
||||
You could also use Vim's / and ? to search, since the
|
||||
mark patterns are (optionally, see configuration)
|
||||
added to the search history, too.
|
||||
added to the search history, too.
|
||||
|
||||
Cursor over mark Cursor not over mark
|
||||
---------------------------------------------------------------------------
|
||||
<Leader>* Jump to the next occurrence of Jump to the next occurrence of
|
||||
current mark, and remember it "last mark".
|
||||
as "last mark".
|
||||
current mark, and remember it "last mark".
|
||||
as "last mark".
|
||||
|
||||
<Leader>/ Jump to the next occurrence of Same as left.
|
||||
ANY mark.
|
||||
<Leader>/ Jump to the next occurrence of Same as left.
|
||||
ANY mark.
|
||||
|
||||
* If <Leader>* is the most recently Do Vim's original * command.
|
||||
* If <Leader>* is the most recently Do Vim's original * command.
|
||||
used, do a <Leader>*; otherwise
|
||||
(<Leader>/ is the most recently
|
||||
used), do a <Leader>/.
|
||||
used), do a <Leader>/.
|
||||
|
||||
Note: When the cursor is on a mark, the backwards
|
||||
search does not jump to the beginning of the current
|
||||
mark (like the built-in search), but to the previous
|
||||
mark. The entire mark text is treated as one entity.
|
||||
mark. The entire mark text is treated as one entity.
|
||||
|
||||
You can use Vim's |jumplist| to go back to previous
|
||||
mark matches and the position before a mark search.
|
||||
mark matches and the position before a mark search.
|
||||
|
||||
MARK PERSISTENCE *mark-persistence*
|
||||
|
||||
The marks can be kept and restored across Vim sessions, using the |viminfo|
|
||||
file. For this to work, the "!" flag must be part of the 'viminfo' setting: >
|
||||
set viminfo+=! " Save and restore global variables.
|
||||
set viminfo+=! " Save and restore global variables.
|
||||
< *:MarkLoad*
|
||||
:MarkLoad Restore the marks from the previous Vim session. All
|
||||
current marks are discarded.
|
||||
current marks are discarded.
|
||||
*:MarkSave*
|
||||
:MarkSave Save the currently defined marks (or clear the
|
||||
persisted marks if no marks are currently defined) for
|
||||
use in a future Vim session.
|
||||
use in a future Vim session.
|
||||
|
||||
By default, automatic persistence is enabled (so you don't need to explicitly
|
||||
|:MarkSave|), but you have to explicitly load the persisted marks in a new Vim
|
||||
session via |:MarkLoad|, to avoid that you accidentally drag along outdated
|
||||
highlightings from Vim session to session, and be surprised by the arbitrary
|
||||
highlight groups and occasional appearance of forgotten marks. If you want
|
||||
just that though and automatically restore any marks, set |g:mwAutoLoadMarks|.
|
||||
just that though and automatically restore any marks, set |g:mwAutoLoadMarks|.
|
||||
|
||||
You can also initialize the marks to static values, e.g. by including this in
|
||||
|vimrc|: >
|
||||
You can also initialize some marks (even using particular highlight groups) to
|
||||
static values, e.g. by including this in |vimrc|: >
|
||||
runtime plugin/mark.vim
|
||||
silent MarkClear
|
||||
Mark foo
|
||||
Mark bar
|
||||
5Mark foo
|
||||
6Mark bar
|
||||
Or you can define custom commands that preset certain marks: >
|
||||
command -bar MyMarks silent MarkClear | execute 'Mark foo' | execute 'Mark bar'
|
||||
command -bar MyMarks silent MarkClear | execute '5Mark foo' | execute '6Mark bar'
|
||||
Or a command that adds to the existing marks and then toggles them: >
|
||||
command -bar ToggleFooBarMarks execute 'Mark foo' | execute 'Mark bar'
|
||||
<
|
||||
MARK INFORMATION *mark-information*
|
||||
|
||||
Both |mark-highlighting| and |mark-searching| commands print information about
|
||||
the mark and search pattern, e.g.
|
||||
mark-1/\<pattern\> ~
|
||||
This is especially useful when you want to add or subtract patterns to a mark
|
||||
highlight group via [N].
|
||||
|
||||
*:Marks*
|
||||
:Marks List all mark highlight groups and the search patterns
|
||||
defined for them.
|
||||
The group that will be used for the next |:Mark| or
|
||||
|<Leader>m| command (with [N]) is shown with a ">".
|
||||
The last mark used for a search (via |<Leader>*|) is
|
||||
shown with a "/".
|
||||
|
||||
==============================================================================
|
||||
INSTALLATION *mark-installation*
|
||||
@@ -159,26 +207,26 @@ the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
|
||||
vimball or via the |:UseVimball| command. >
|
||||
vim mark.vba.gz
|
||||
:so %
|
||||
To uninstall, use the |:RmVimball| command.
|
||||
To uninstall, use the |:RmVimball| command.
|
||||
|
||||
DEPENDENCIES *mark-dependencies*
|
||||
|
||||
- Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
|
||||
- Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *mark-configuration*
|
||||
|
||||
For a permanent configuration, put the following commands into your |vimrc|.
|
||||
For a permanent configuration, put the following commands into your |vimrc|.
|
||||
|
||||
*mark-highlight-colors*
|
||||
You may define your own colors or more than the default 6 highlightings in
|
||||
your vimrc file (or anywhere before this plugin is sourced), in the following
|
||||
form (where N = 1..): >
|
||||
highlight MarkWordN ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black
|
||||
Higher numbers always take precedence and are displayed above lower ones.
|
||||
Higher numbers always take precedence and are displayed above lower ones.
|
||||
If you want to avoid losing the highlightings on |:colorscheme| commands, you
|
||||
need to re-apply your highlights on the |ColorScheme| event, similar to how
|
||||
this plugin does.
|
||||
this plugin does.
|
||||
|
||||
The search type highlighting (in the search message) can be changed via: >
|
||||
highlight link SearchSpecialSearchType MoreMsg
|
||||
@@ -194,11 +242,11 @@ To enable the automatic restore of marks from a previous Vim session: >
|
||||
< *g:mwAutoSaveMarks*
|
||||
To turn off the automatic persistence of marks across Vim sessions: >
|
||||
let g:mwAutoSaveMarks = 0
|
||||
You can still explicitly save marks via |:MarkSave|.
|
||||
You can still explicitly save marks via |:MarkSave|.
|
||||
|
||||
*mark-mappings*
|
||||
You can use different mappings by mapping to the <Plug>Mark... mappings (use
|
||||
":map <Plug>Mark" to list them all) before this plugin is sourced.
|
||||
":map <Plug>Mark" to list them all) before this plugin is sourced.
|
||||
|
||||
There are no default mappings for toggling all marks and for the |:MarkClear|
|
||||
command, but you can define some yourself: >
|
||||
@@ -214,7 +262,7 @@ Some people like to create a mark based on the visual selection, like
|
||||
|v_<Leader>m|, but have whitespace in the selection match any whitespace when
|
||||
searching (searching for "hello world" will also find "hello<Tab>world" as
|
||||
well as "hello" at the end of a line, with "world" at the start of the next
|
||||
line). The Vim Tips Wiki describes such a setup for the built-in search at
|
||||
line). The Vim Tips Wiki describes such a setup for the built-in search at
|
||||
http://vim.wikia.com/wiki/Search_for_visually_selected_text
|
||||
You can achieve the same with the Mark plugin through the following scriptlet: >
|
||||
function! s:GetVisualSelectionAsLiteralWhitespaceIndifferentPattern()
|
||||
@@ -232,11 +280,11 @@ behavior: >
|
||||
LIMITATIONS *mark-limitations*
|
||||
|
||||
- If the 'ignorecase' setting is changed, there will be discrepancies between
|
||||
the highlighted marks and subsequent jumps to marks.
|
||||
the highlighted marks and subsequent jumps to marks.
|
||||
- If {pattern} in a :Mark command contains atoms that change the semantics of
|
||||
the entire (|/\c|, |/\C|) or following (|/\v|,|/\V|, |/\M|) regular
|
||||
expression, there may be discrepancies between the highlighted marks and
|
||||
subsequent jumps to marks.
|
||||
subsequent jumps to marks.
|
||||
|
||||
KNOWN PROBLEMS *mark-known-problems*
|
||||
|
||||
@@ -245,103 +293,130 @@ TODO *mark-todo*
|
||||
IDEAS *mark-ideas*
|
||||
|
||||
Taken from an alternative implementation at
|
||||
http://vim.wikia.com/wiki/Highlight_multiple_words:
|
||||
- Allow to specify the highlight group number via :[N]Mark {regexp}
|
||||
- Use keys 1-9 on the numeric keypad to toggle a highlight group number.
|
||||
http://vim.wikia.com/wiki/Highlight_multiple_words:
|
||||
- Use keys 1-9 on the numeric keypad to toggle a highlight group number.
|
||||
|
||||
==============================================================================
|
||||
HISTORY *mark-history*
|
||||
|
||||
2.6.2 26-Mar-2012
|
||||
- ENH: When a [count] exceeding the number of available mark groups is given,
|
||||
a summary of marks is given and the user is asked to select a mark group.
|
||||
This allows to interactively choose a color via 99<Leader>m.
|
||||
- ENH: Include count of alternative patterns in :Marks list.
|
||||
- CHG: Use ">" for next mark and "/" for last search in :Marks.
|
||||
|
||||
2.6.1 23-Mar-2012
|
||||
- ENH: Add :Marks command that prints all mark highlight groups and their
|
||||
search patterns, plus information about the current search mark, next mark
|
||||
group, and whether marks are disabled.
|
||||
- ENH: Show which mark group a pattern was set / added / removed / cleared.
|
||||
- FIX: When the cursor is positioned on the current mark, [N]<Leader>n /
|
||||
<Plug>MarkClear with [N] appended the pattern for the current mark (again
|
||||
and again) instead of clearing it. Must not pass current mark pattern when
|
||||
[N] is given.
|
||||
- CHG: Show mark group number in same-mark search and rename search types from
|
||||
"any-mark", "same-mark", and "new-mark" to the shorter "mark-*", "mark-N",
|
||||
and "mark-N!", respectively.
|
||||
|
||||
2.6.0 22-Mar-2012
|
||||
- ENH: Allow [count] for <Leader>m and :Mark to add / subtract match to / from
|
||||
highlight group [count], and use [count]<Leader>n to clear only highlight
|
||||
group [count]. This was also requested by Philipp Marek.
|
||||
- FIX: :Mark and <Leader>n actually toggled marks back on when they were
|
||||
already off. Now, they stay off on multiple invocations. Use :call
|
||||
mark#Toggle() / <Plug>MarkToggle if you want toggling.
|
||||
|
||||
2.5.3 02-Mar-2012
|
||||
- BUG: Version check mistakenly excluded Vim 7.1 versions that do have the
|
||||
matchadd() function. Thanks to Philipp Marek for sending a patch.
|
||||
matchadd() function. Thanks to Philipp Marek for sending a patch.
|
||||
|
||||
2.5.2 09-Nov-2011
|
||||
Fixed various problems with wrap-around warnings:
|
||||
- BUG: With a single match and 'wrapscan' set, a search error was issued.
|
||||
Fixed various problems with wrap-around warnings:
|
||||
- BUG: With a single match and 'wrapscan' set, a search error was issued.
|
||||
- FIX: Backwards search with single match leads to wrong error message
|
||||
instead.
|
||||
- FIX: Wrong logic for determining l:isWrapped lets wrap-around go undetected.
|
||||
instead.
|
||||
- FIX: Wrong logic for determining l:isWrapped lets wrap-around go undetected.
|
||||
|
||||
2.5.1 17-May-2011
|
||||
- FIX: == comparison in s:DoMark() leads to wrong regexp (\A vs. \a) being
|
||||
cleared when 'ignorecase' is set. Use case-sensitive comparison ==# instead.
|
||||
- Refine :MarkLoad messages
|
||||
cleared when 'ignorecase' is set. Use case-sensitive comparison ==# instead.
|
||||
- Refine :MarkLoad messages
|
||||
- Add whitespace-indifferent visual mark configuration example. Thanks to Greg
|
||||
Klein for the suggestion.
|
||||
Klein for the suggestion.
|
||||
|
||||
2.5.0 07-May-2011
|
||||
- ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and
|
||||
automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks
|
||||
configuration flags. (Request from Mun Johl, 16-Apr-2010)
|
||||
configuration flags. (Request from Mun Johl, 16-Apr-2010)
|
||||
- Expose toggling of mark display (keeping the mark patterns) via new
|
||||
<Plug>MarkToggle mapping. Offer :MarkClear command as a replacement for the
|
||||
old argumentless :Mark command, which now just disables, but not clears all
|
||||
marks.
|
||||
marks.
|
||||
|
||||
2.4.4 18-Apr-2011
|
||||
- BUG: Include trailing newline character in check for current mark, so that a
|
||||
mark that matches the entire line (e.g. created by V<Leader>m) can be
|
||||
cleared via <Leader>n. Thanks to ping for reporting this.
|
||||
cleared via <Leader>n. Thanks to ping for reporting this.
|
||||
- FIX: On overlapping marks, mark#CurrentMark() returned the lowest, not the
|
||||
highest visible mark. So on overlapping marks, the one that was not visible
|
||||
at the cursor position was removed; very confusing! Use reverse iteration
|
||||
order.
|
||||
order.
|
||||
- FIX: To avoid an arbitrary ordering of highlightings when the highlighting
|
||||
group names roll over, and to avoid order inconsistencies across different
|
||||
windows and tabs, we assign a different priority based on the highlighting
|
||||
group.
|
||||
group.
|
||||
|
||||
2.4.3 16-Apr-2011
|
||||
- Avoid losing the mark highlightings on :syn on or :colorscheme commands.
|
||||
Thanks to Zhou YiChao for alerting me to this issue and suggesting a fix.
|
||||
Thanks to Zhou YiChao for alerting me to this issue and suggesting a fix.
|
||||
- Made the script more robust when somehow no highlightings have been defined
|
||||
or when the window-local reckoning of match IDs got lost. I had very
|
||||
occasionally encountered such script errors in the past.
|
||||
occasionally encountered such script errors in the past.
|
||||
- Made global housekeeping variables script-local, only g:mwHistAdd is used
|
||||
for configuration.
|
||||
for configuration.
|
||||
|
||||
2.4.2 14-Jan-2011 (unreleased)
|
||||
- FIX: Capturing the visual selection could still clobber the blockwise yank
|
||||
mode of the unnamed register.
|
||||
mode of the unnamed register.
|
||||
|
||||
2.4.1 13-Jan-2011
|
||||
- FIX: Using a named register for capturing the visual selection on
|
||||
{Visual}<Leader>m and {Visual}<Leader>r clobbered the unnamed register. Now
|
||||
using the unnamed register.
|
||||
using the unnamed register.
|
||||
|
||||
2.4.0 13-Jul-2010
|
||||
- ENH: The MarkSearch mappings (<Leader>[*#/?]) add the original cursor
|
||||
position to the jump list, like the built-in [/?*#nN] commands. This allows
|
||||
to use the regular jump commands for mark matches, like with regular search
|
||||
matches.
|
||||
matches.
|
||||
|
||||
2.3.3 19-Feb-2010
|
||||
- BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
|
||||
in endless loop. Thanks to Andy Wokula for the patch.
|
||||
in endless loop. Thanks to Andy Wokula for the patch.
|
||||
|
||||
2.3.2 17-Nov-2009
|
||||
- BUG: Creation of literal pattern via '\V' in {Visual}<Leader>m mapping
|
||||
collided with individual escaping done in <Leader>m mapping so that an
|
||||
escaped '\*' would be interpreted as a multi item when both modes are used
|
||||
for marking. Thanks to Andy Wokula for the patch.
|
||||
for marking. Thanks to Andy Wokula for the patch.
|
||||
|
||||
2.3.1 06-Jul-2009
|
||||
- Now working correctly when 'smartcase' is set. All mappings and the :Mark
|
||||
command use 'ignorecase', but not 'smartcase'.
|
||||
command use 'ignorecase', but not 'smartcase'.
|
||||
|
||||
2.3.0 04-Jul-2009
|
||||
- All jump commands now take an optional [count], so you can quickly skip over
|
||||
some marks, as with the built-in */# and n/N commands. For this, the entire
|
||||
core search algorithm has been rewritten. The script's logic has been
|
||||
simplified through the use of Vim 7 features like Lists.
|
||||
- Now also printing a Vim-alike search error message when 'nowrapscan' is set.
|
||||
simplified through the use of Vim 7 features like Lists.
|
||||
- Now also printing a Vim-alike search error message when 'nowrapscan' is set.
|
||||
|
||||
2.2.0 02-Jul-2009
|
||||
- Split off functions into autoload script.
|
||||
- Split off functions into autoload script.
|
||||
- Initialization of global variables and autocommands is now done lazily on
|
||||
the first use, not during loading of the plugin. This reduces Vim startup
|
||||
time and footprint as long as the functionality isn't yet used.
|
||||
time and footprint as long as the functionality isn't yet used.
|
||||
- Split off documentation into separate help file. Now packaging as VimBall.
|
||||
|
||||
|
||||
@@ -349,37 +424,37 @@ Fixed various problems with wrap-around warnings:
|
||||
- Replaced highlighting via :syntax with matchadd() / matchdelete(). This
|
||||
requires Vim 7.2 / 7.1 with patches. This method is faster, there are no
|
||||
more clashes with syntax highlighting (:match always has preference), and
|
||||
the background highlighting does not disappear under 'cursorline'.
|
||||
the background highlighting does not disappear under 'cursorline'.
|
||||
- Using winrestcmd() to fix effects of :windo: By entering a window, its
|
||||
height is potentially increased from 0 to 1.
|
||||
- Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
||||
height is potentially increased from 0 to 1.
|
||||
- Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
||||
|
||||
2.0.0 01-Jun-2009
|
||||
- Now using Vim List for g:mwWord and thus requiring Vim 7. g:mwCycle is now
|
||||
zero-based, but the syntax groups "MarkWordx" are still one-based.
|
||||
zero-based, but the syntax groups "MarkWordx" are still one-based.
|
||||
- Factored :syntax operations out of s:DoMark() and s:UpdateMark() so that
|
||||
they can all be done in a single :windo.
|
||||
they can all be done in a single :windo.
|
||||
- Normal mode <Plug>MarkSet now has the same semantics as its visual mode
|
||||
cousin: If the cursor is on an existing mark, the mark is removed.
|
||||
Beforehand, one could only remove a visually selected mark via again
|
||||
selecting it. Now, one simply can invoke the mapping when on such a mark.
|
||||
selecting it. Now, one simply can invoke the mapping when on such a mark.
|
||||
|
||||
1.6.1 31-May-2009
|
||||
Publication of improved version by Ingo Karkat.
|
||||
Publication of improved version by Ingo Karkat.
|
||||
- Now prepending search type ("any-mark", "same-mark", "new-mark") for better
|
||||
identification.
|
||||
identification.
|
||||
- Retired the algorithm in s:PrevWord in favor of simply using <cword>, which
|
||||
makes mark.vim work like the * command. At the end of a line, non-keyword
|
||||
characters may now be marked; the previous algorithm preferred any preceding
|
||||
word.
|
||||
word.
|
||||
- BF: If 'iskeyword' contains characters that have a special meaning in a
|
||||
regexp (e.g. [.*]), these are now escaped properly.
|
||||
regexp (e.g. [.*]), these are now escaped properly.
|
||||
- Highlighting can now actually be overridden in the vimrc (anywhere _before_
|
||||
sourcing this script) by using ':hi def'.
|
||||
- Added missing setter for re-inclusion guard.
|
||||
sourcing this script) by using ':hi def'.
|
||||
- Added missing setter for re-inclusion guard.
|
||||
|
||||
1.5.0 01-Sep-2008
|
||||
Bug fixes and enhancements by Ingo Karkat.
|
||||
Bug fixes and enhancements by Ingo Karkat.
|
||||
- Added <Plug>MarkAllClear (without a default mapping), which clears all
|
||||
marks, even when the cursor is on a mark.
|
||||
- Added <Plug>... mappings for hard-coded \*, \#, \/, \?, * and #, to allow
|
||||
@@ -395,18 +470,18 @@ Bug fixes and enhancements by Ingo Karkat.
|
||||
continuing at TOP" and "Pattern not found:..." messages, like the * and n/N
|
||||
Vim search commands.
|
||||
- ENH: Jumps now open folds if the occurrence is inside a closed fold, just
|
||||
like n/N do.
|
||||
like n/N do.
|
||||
|
||||
1.1.8-g 25-Apr-2008
|
||||
Last version published by Yuheng Xie on vim.org.
|
||||
Last version published by Yuheng Xie on vim.org.
|
||||
|
||||
1.1.2 22-Mar-2005
|
||||
Initial version published by Yuheng Xie on vim.org.
|
||||
Initial version published by Yuheng Xie on vim.org.
|
||||
|
||||
==============================================================================
|
||||
Copyright: (C) 2005-2008 Yuheng Xie
|
||||
(C) 2008-2012 Ingo Karkat
|
||||
The VIM LICENSE applies to this script; see|copyright|.
|
||||
The VIM LICENSE applies to this script; see|copyright|.
|
||||
|
||||
Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||
==============================================================================
|
||||
|
||||
@@ -1,111 +1,125 @@
|
||||
" Script Name: mark.vim
|
||||
" Description: Highlight several words in different colors simultaneously.
|
||||
" Description: Highlight several words in different colors simultaneously.
|
||||
"
|
||||
" Copyright: (C) 2005-2008 Yuheng Xie
|
||||
" (C) 2008-2012 Ingo Karkat
|
||||
" The VIM LICENSE applies to this script; see ':help copyright'.
|
||||
" The VIM LICENSE applies to this script; see ':help copyright'.
|
||||
"
|
||||
" Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||
" Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||
" Orig Author: Yuheng Xie <elephant@linux.net.cn>
|
||||
" Contributors:Luc Hermitte, Ingo Karkat
|
||||
"
|
||||
" Dependencies:
|
||||
" - Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
|
||||
" - mark.vim autoload script.
|
||||
"
|
||||
" Version: 2.5.3
|
||||
" - Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
|
||||
" - mark.vim autoload script.
|
||||
"
|
||||
" Version: 2.6.1
|
||||
" Changes:
|
||||
" 23-Mar-2012, Ingo Karkat
|
||||
" - ENH: Add :Marks command that prints all mark highlight groups and their
|
||||
" search patterns, plus information about the current search mark, next mark
|
||||
" group, and whether marks are disabled.
|
||||
" - FIX: When the cursor is positioned on the current mark, [N]<Leader>n /
|
||||
" <Plug>MarkClear with [N] appended the pattern for the current mark (again
|
||||
" and again) instead of clearing it. Must not pass current mark pattern when
|
||||
" [N] is given.
|
||||
"
|
||||
" 22-Mar-2012, Ingo Karkat
|
||||
" - ENH: Allow [count] for <Leader>m and :Mark to add / subtract match to / from
|
||||
" highlight group [count], and use [count]<Leader>n to clear only highlight
|
||||
" group [count]. This was also requested by Philipp Marek.
|
||||
"
|
||||
" 02-Mar-2012, Philipp Marek
|
||||
" - BUG: Version check mistakenly excluded Vim 7.1 versions that do have the
|
||||
" matchadd() function.
|
||||
" matchadd() function.
|
||||
"
|
||||
" 06-May-2011, Ingo Karkat
|
||||
" - By default, enable g:mwAutoSaveMarks, so that marks are always persisted,
|
||||
" but disable g:mwAutoLoadMarks, so that persisted marks have to be explicitly
|
||||
" loaded, if that is desired. I often wondered why I got unexpected mark
|
||||
" highlightings in a new Vim session until I realized that I had used marks in
|
||||
" a previous session and forgot to clear them.
|
||||
" a previous session and forgot to clear them.
|
||||
"
|
||||
" 21-Apr-2011, Ingo Karkat
|
||||
" - Expose toggling of mark display (keeping the mark patterns) via new
|
||||
" <Plug>MarkToggle mapping. Offer :MarkClear command as a replacement for the
|
||||
" old argumentless :Mark command, which now just disables, but not clears all
|
||||
" marks.
|
||||
" marks.
|
||||
" - Implement lazy-loading of disabled persistent marks via g:mwDoDeferredLoad
|
||||
" flag passing to autoload/mark.vim.
|
||||
" flag passing to autoload/mark.vim.
|
||||
"
|
||||
" 19-Apr-2011, Ingo Karkat
|
||||
" - ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and
|
||||
" automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks
|
||||
" configuration flags.
|
||||
" configuration flags.
|
||||
"
|
||||
" 15-Apr-2011, Ingo Karkat
|
||||
" - Avoid losing the mark highlightings on :syn on or :colorscheme commands.
|
||||
" Thanks to Zhou YiChao for alerting me to this issue and suggesting a fix.
|
||||
" Thanks to Zhou YiChao for alerting me to this issue and suggesting a fix.
|
||||
"
|
||||
" 17-Nov-2009, Ingo Karkat
|
||||
" - Replaced the (overly) generic mark#GetVisualSelectionEscaped() with
|
||||
" mark#GetVisualSelectionAsRegexp() and
|
||||
" mark#GetVisualSelectionAsLiteralPattern().
|
||||
" mark#GetVisualSelectionAsLiteralPattern().
|
||||
"
|
||||
" 04-Jul-2009, Ingo Karkat
|
||||
" - A [count] before any mapping either caused "No range allowed" error or just
|
||||
" repeated the :call [count] times, resulting in the current search pattern
|
||||
" echoed [count] times and a hit-enter prompt. Now suppressing [count] via
|
||||
" <C-u> and handling it inside the implementation.
|
||||
" - Now passing isBackward (0/1) instead of optional 'b' flag into functions.
|
||||
" <C-u> and handling it inside the implementation.
|
||||
" - Now passing isBackward (0/1) instead of optional 'b' flag into functions.
|
||||
" Also passing empty regexp to mark#MarkRegex() to avoid any optional
|
||||
" arguments.
|
||||
" arguments.
|
||||
"
|
||||
" 02-Jul-2009, Ingo Karkat
|
||||
" - Split off functions into autoload script.
|
||||
" - Removed g:force_reload_mark.
|
||||
" - Split off functions into autoload script.
|
||||
" - Removed g:force_reload_mark.
|
||||
" - Initialization of global variables and autocommands is now done lazily on
|
||||
" the first use, not during loading of the plugin. This reduces Vim startup
|
||||
" time and footprint as long as the functionality isn't yet used.
|
||||
" time and footprint as long as the functionality isn't yet used.
|
||||
"
|
||||
" 6-Jun-2009, Ingo Karkat
|
||||
" 1. Somehow s:WrapMessage() needs a redraw before the :echo to avoid that a
|
||||
" later Vim redraw clears the wrap message. This happened when there's no
|
||||
" statusline and thus :echo'ing into the ruler.
|
||||
" 2. Removed line-continuations and ':set cpo=...'. Upper-cased <SID> and <CR>.
|
||||
" 3. Added default highlighting for the special search type.
|
||||
" statusline and thus :echo'ing into the ruler.
|
||||
" 2. Removed line-continuations and ':set cpo=...'. Upper-cased <SID> and <CR>.
|
||||
" 3. Added default highlighting for the special search type.
|
||||
"
|
||||
" 2-Jun-2009, Ingo Karkat
|
||||
" 1. Replaced highlighting via :syntax with matchadd() / matchdelete(). This
|
||||
" requires Vim 7.2 / 7.1 with patches. This method is faster, there are no
|
||||
" more clashes with syntax highlighting (:match always has preference), and
|
||||
" the background highlighting does not disappear under 'cursorline'.
|
||||
" 2. Factored :windo application out into s:MarkScope().
|
||||
" the background highlighting does not disappear under 'cursorline'.
|
||||
" 2. Factored :windo application out into s:MarkScope().
|
||||
" 3. Using winrestcmd() to fix effects of :windo: By entering a window, its
|
||||
" height is potentially increased from 0 to 1.
|
||||
" 4. Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
||||
"
|
||||
" height is potentially increased from 0 to 1.
|
||||
" 4. Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
||||
"
|
||||
" 1-Jun-2009, Ingo Karkat
|
||||
" 1. Now using Vim List for g:mwWord and thus requiring Vim 7. g:mwCycle is now
|
||||
" zero-based, but the syntax groups "MarkWordx" are still one-based.
|
||||
" 2. Added missing setter for re-inclusion guard.
|
||||
" zero-based, but the syntax groups "MarkWordx" are still one-based.
|
||||
" 2. Added missing setter for re-inclusion guard.
|
||||
" 3. Factored :syntax operations out of s:DoMark() and s:UpdateMark() so that
|
||||
" they can all be done in a single :windo.
|
||||
" they can all be done in a single :windo.
|
||||
" 4. Normal mode <Plug>MarkSet now has the same semantics as its visual mode
|
||||
" cousin: If the cursor is on an existing mark, the mark is removed.
|
||||
" Beforehand, one could only remove a visually selected mark via again
|
||||
" selecting it. Now, one simply can invoke the mapping when on such a mark.
|
||||
" selecting it. Now, one simply can invoke the mapping when on such a mark.
|
||||
" 5. Highlighting can now actually be overridden in the vimrc (anywhere
|
||||
" _before_ sourcing this script) by using ':hi def'.
|
||||
" _before_ sourcing this script) by using ':hi def'.
|
||||
"
|
||||
" 31-May-2009, Ingo Karkat
|
||||
" 1. Refactored s:Search() to optionally take advantage of SearchSpecial.vim
|
||||
" autoload functionality for echoing of search pattern, wrap and error
|
||||
" messages.
|
||||
" messages.
|
||||
" 2. Now prepending search type ("any-mark", "same-mark", "new-mark") for
|
||||
" better identification.
|
||||
" better identification.
|
||||
" 3. Retired the algorithm in s:PrevWord in favor of simply using <cword>,
|
||||
" which makes mark.vim work like the * command. At the end of a line,
|
||||
" non-keyword characters may now be marked; the previous algorithm prefered
|
||||
" any preceding word.
|
||||
" any preceding word.
|
||||
" 4. BF: If 'iskeyword' contains characters that have a special meaning in a
|
||||
" regex (e.g. [.*]), these are now escaped properly.
|
||||
" regex (e.g. [.*]), these are now escaped properly.
|
||||
"
|
||||
" 01-Sep-2008, Ingo Karkat: bugfixes and enhancements
|
||||
" 1. Added <Plug>MarkAllClear (without a default mapping), which clears all
|
||||
@@ -127,7 +141,7 @@
|
||||
" continuing at TOP" and "Pattern not found:..." messages, like the * and
|
||||
" n/N Vim search commands.
|
||||
" 9. Jumps now open folds if the occurrence is inside a closed fold, just like n/N
|
||||
" do.
|
||||
" do.
|
||||
"
|
||||
" 10th Mar 2006, Yuheng Xie: jump to ANY mark
|
||||
" (*) added \* \# \/ \? for the ability of jumping to ANY mark, even when the
|
||||
@@ -155,7 +169,7 @@
|
||||
" (*) command :Mark
|
||||
" -> e.g. :Mark Mark.\{-}\ze(
|
||||
|
||||
" Avoid installing twice or when in unsupported Vim version.
|
||||
" Avoid installing twice or when in unsupported Vim version.
|
||||
if exists('g:loaded_mark') || (v:version == 701 && ! exists('*matchadd')) || (v:version < 701)
|
||||
finish
|
||||
endif
|
||||
@@ -188,20 +202,20 @@ endfunction
|
||||
call s:DefaultHighlightings()
|
||||
autocmd ColorScheme * call <SID>DefaultHighlightings()
|
||||
|
||||
" Default highlighting for the special search type.
|
||||
" Default highlighting for the special search type.
|
||||
" You can override this by defining / linking the 'SearchSpecialSearchType'
|
||||
" highlight group before this script is sourced.
|
||||
" highlight group before this script is sourced.
|
||||
highlight def link SearchSpecialSearchType MoreMsg
|
||||
|
||||
|
||||
"- mappings -------------------------------------------------------------------
|
||||
nnoremap <silent> <Plug>MarkSet :<C-u>call mark#MarkCurrentWord()<CR>
|
||||
vnoremap <silent> <Plug>MarkSet <C-\><C-n>:call mark#DoMark(mark#GetVisualSelectionAsLiteralPattern())<CR>
|
||||
nnoremap <silent> <Plug>MarkRegex :<C-u>call mark#MarkRegex('')<CR>
|
||||
vnoremap <silent> <Plug>MarkRegex <C-\><C-n>:call mark#MarkRegex(mark#GetVisualSelectionAsRegexp())<CR>
|
||||
nnoremap <silent> <Plug>MarkClear :<C-u>call mark#DoMark(mark#CurrentMark()[0])<CR>
|
||||
nnoremap <silent> <Plug>MarkSet :<C-u>if !mark#MarkCurrentWord(v:count)<Bar>execute "normal! \<lt>C-\>\<lt>C-n>\<lt>Esc>"<Bar>endif<CR>
|
||||
vnoremap <silent> <Plug>MarkSet :<C-u>if !mark#DoMark(v:count, mark#GetVisualSelectionAsLiteralPattern())<Bar>execute "normal! \<lt>C-\>\<lt>C-n>\<lt>Esc>"<Bar>endif<CR>
|
||||
nnoremap <silent> <Plug>MarkRegex :<C-u>call mark#MarkRegex('')<CR>
|
||||
vnoremap <silent> <Plug>MarkRegex :<C-u>call mark#MarkRegex(mark#GetVisualSelectionAsRegexp())<CR>
|
||||
nnoremap <silent> <Plug>MarkClear :<C-u>if !mark#DoMark(v:count, (v:count ? '' : mark#CurrentMark()[0]))<Bar>execute "normal! \<lt>C-\>\<lt>C-n>\<lt>Esc>"<Bar>endif<CR>
|
||||
nnoremap <silent> <Plug>MarkAllClear :<C-u>call mark#ClearAll()<CR>
|
||||
nnoremap <silent> <Plug>MarkToggle :<C-u>call mark#Toggle()<CR>
|
||||
nnoremap <silent> <Plug>MarkToggle :<C-u>call mark#Toggle()<CR>
|
||||
|
||||
nnoremap <silent> <Plug>MarkSearchCurrentNext :<C-u>call mark#SearchCurrentMark(0)<CR>
|
||||
nnoremap <silent> <Plug>MarkSearchCurrentPrev :<C-u>call mark#SearchCurrentMark(1)<CR>
|
||||
@@ -210,7 +224,7 @@ nnoremap <silent> <Plug>MarkSearchAnyPrev :<C-u>call mark#SearchAnyMark(1)<C
|
||||
nnoremap <silent> <Plug>MarkSearchNext :<C-u>if !mark#SearchNext(0)<Bar>execute 'normal! *zv'<Bar>endif<CR>
|
||||
nnoremap <silent> <Plug>MarkSearchPrev :<C-u>if !mark#SearchNext(1)<Bar>execute 'normal! #zv'<Bar>endif<CR>
|
||||
" When typed, [*#nN] open the fold at the search result, but inside a mapping or
|
||||
" :normal this must be done explicitly via 'zv'.
|
||||
" :normal this must be done explicitly via 'zv'.
|
||||
|
||||
|
||||
if !hasmapto('<Plug>MarkSet', 'n')
|
||||
@@ -228,8 +242,8 @@ endif
|
||||
if !hasmapto('<Plug>MarkClear', 'n')
|
||||
nmap <unique> <silent> <Leader>n <Plug>MarkClear
|
||||
endif
|
||||
" No default mapping for <Plug>MarkAllClear.
|
||||
" No default mapping for <Plug>MarkToggle.
|
||||
" No default mapping for <Plug>MarkAllClear.
|
||||
" No default mapping for <Plug>MarkToggle.
|
||||
|
||||
if !hasmapto('<Plug>MarkSearchCurrentNext', 'n')
|
||||
nmap <unique> <silent> <Leader>* <Plug>MarkSearchCurrentNext
|
||||
@@ -252,8 +266,9 @@ endif
|
||||
|
||||
|
||||
"- commands -------------------------------------------------------------------
|
||||
command! -nargs=? Mark call mark#DoMark(<f-args>)
|
||||
command! -count -nargs=? Mark if !mark#DoMark(<count>, <f-args>) | echoerr printf('Only %d mark highlight groups', mark#GetGroupNum()) | endif
|
||||
command! -bar MarkClear call mark#ClearAll()
|
||||
command! -bar Marks call mark#List()
|
||||
|
||||
command! -bar MarkLoad call mark#LoadCommand(1)
|
||||
command! -bar MarkSave call mark#SaveCommand()
|
||||
@@ -263,19 +278,19 @@ command! -bar MarkSave call mark#SaveCommand()
|
||||
if g:mwAutoLoadMarks
|
||||
" As the viminfo is only processed after sourcing of the runtime files, the
|
||||
" persistent global variables are not yet available here. Defer this until Vim
|
||||
" startup has completed.
|
||||
" startup has completed.
|
||||
function! s:AutoLoadMarks()
|
||||
if g:mwAutoLoadMarks && exists('g:MARK_MARKS') && g:MARK_MARKS !=# '[]'
|
||||
if ! exists('g:MARK_ENABLED') || g:MARK_ENABLED
|
||||
" There are persistent marks and they haven't been disabled; we need to
|
||||
" show them right now.
|
||||
" show them right now.
|
||||
call mark#LoadCommand(0)
|
||||
else
|
||||
" Though there are persistent marks, they have been disabled. We avoid
|
||||
" sourcing the autoload script and its invasive autocmds right now;
|
||||
" maybe the marks are never turned on. We just inform the autoload
|
||||
" script that it should do this once it is sourced on-demand by a
|
||||
" mark mapping or command.
|
||||
" mark mapping or command.
|
||||
let g:mwDoDeferredLoad = 1
|
||||
endif
|
||||
endif
|
||||
@@ -285,9 +300,9 @@ if g:mwAutoLoadMarks
|
||||
autocmd!
|
||||
" Note: Avoid triggering the autoload unless there actually are persistent
|
||||
" marks. For that, we need to check that g:MARK_MARKS doesn't contain the
|
||||
" empty list representation, and also :execute the :call.
|
||||
" empty list representation, and also :execute the :call.
|
||||
autocmd VimEnter * call <SID>AutoLoadMarks()
|
||||
augroup END
|
||||
endif
|
||||
|
||||
" vim: ts=2 sw=2
|
||||
" vim: ts=4 sts=0 sw=4 noet
|
||||
|
||||
Reference in New Issue
Block a user