1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 19:40:29 +01:00

Updated Mark plugin

This commit is contained in:
2011-05-23 20:43:28 +02:00
parent 8daa792c58
commit c12ebf43d0
4 changed files with 51 additions and 10 deletions

View File

@@ -165,6 +165,9 @@ DEPENDENCIES *mark-dependencies*
==============================================================================
CONFIGURATION *mark-configuration*
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..): >
@@ -199,6 +202,24 @@ command, but you can define some yourself: >
To remove the default overriding of * and #, use: >
nmap <Plug>IgnoreMarkSearchNext <Plug>MarkSearchNext
nmap <Plug>IgnoreMarkSearchPrev <Plug>MarkSearchPrev
<
*mark-whitespace-indifferent*
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
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()
return substitute(escape(mark#GetVisualSelection(), '\' . '^$.*[~'), '\_s\+', '\\_s\\+', 'g')
endfunction
vnoremap <silent> <Plug>MarkWhitespaceIndifferent <C-\><C-n>:call mark#DoMark(<SID>GetVisualSelectionAsLiteralWhitespaceIndifferentPattern())<CR>
Using this, you can assign a new visual mode mapping <Leader>* >
vmap <Leader>* <Plug>MarkWhitespaceIndifferent
or override the default |v_<Leader>m| mapping, in case you always want this
behavior: >
vmap <Leader>m <Plug>MarkWhitespaceIndifferent
<
==============================================================================
LIMITATIONS *mark-limitations*
@@ -224,6 +245,13 @@ http://vim.wikia.com/wiki/Highlight_multiple_words:
==============================================================================
HISTORY *mark-history*
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
- Add whitespace-indifferent visual mark configuration example. Thanks to Greg
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

View File

@@ -442,6 +442,7 @@ loremipsum.txt loremipsum.txt /*loremipsum.txt*
mark-configuration mark.txt /*mark-configuration*
mark-dependencies mark.txt /*mark-dependencies*
mark-description mark.txt /*mark-description*
mark-highlight-colors mark.txt /*mark-highlight-colors*
mark-highlighting mark.txt /*mark-highlighting*
mark-history mark.txt /*mark-history*
mark-ideas mark.txt /*mark-ideas*
@@ -453,6 +454,7 @@ mark-persistence mark.txt /*mark-persistence*
mark-searching mark.txt /*mark-searching*
mark-todo mark.txt /*mark-todo*
mark-usage mark.txt /*mark-usage*
mark-whitespace-indifferent mark.txt /*mark-whitespace-indifferent*
mark.txt mark.txt /*mark.txt*
mark.vim mark.txt /*mark.vim*
multi_snip snipMate.txt /*multi_snip*