diff --git a/.vimrc b/.vimrc index a45e63d..6ed1277 100644 --- a/.vimrc +++ b/.vimrc @@ -113,7 +113,7 @@ endif "}}} "PLUGINS: {{{ " eclim buffers {{{2 -map b :Buffers +map B :Buffers " }}} "VimWIKI {{{2 let g:vimwiki_list = [{'path': '~/vimwiki/', @@ -152,8 +152,8 @@ let Tlist_Exit_OnlyWindow = 1 let Tlist_WinWidth = 40 "}}} "Tagbar {{{2 -let g:tagbar_autoclose = 1 -nmap T :TagbarToggle +"let g:tagbar_autoclose = 1 +"nmap T :TagbarToggle "}}} "Pydoc {{{2 let g:pydoc_cmd = "/usr/bin/pydoc" @@ -181,7 +181,7 @@ nmap \dj let g:buffergator_split_size=10 let g:buffergator_viewport_split_policy='B' let g:buffergator_suppress_keymaps=1 -map B :BuffergatorToggle +map b :BuffergatorToggle " }}} "Gundo {{{2 map u :GundoToggle diff --git a/GetLatest/GetLatestVimScripts.dat b/GetLatest/GetLatestVimScripts.dat index 50d1a21..e78506b 100644 --- a/GetLatest/GetLatestVimScripts.dat +++ b/GetLatest/GetLatestVimScripts.dat @@ -1,7 +1,8 @@ ScriptID SourceID Filename -------------------------- ### plugins -3619 16686 buffergator +2572 10433 ack.vim +3619 16816 buffergator 102 16171 DirDiff.vim 1984 13961 :AutoInstall: FuzzyFinder 311 7645 grep.vim @@ -9,7 +10,7 @@ ScriptID SourceID Filename 2727 11120 jsbeautify.vim 3252 13948 :AutoInstall: L9 2289 8922 loremipsum -2666 15663 Mark +2666 16840 Mark 1218 14455 nerdcommenter 2262 8944 occur.vim 2136 8206 repeat.vim diff --git a/autoload/mark.vim b/autoload/mark.vim index 2f95841..2774465 100644 --- a/autoload/mark.vim +++ b/autoload/mark.vim @@ -10,9 +10,21 @@ " Dependencies: " - SearchSpecial.vim autoload script (optional, for improved search messages). " -" Version: 2.5.1 +" Version: 2.5.2 " Changes: " +" 09-Nov-2011, Ingo Karkat +" - BUG: With a single match and 'wrapscan' set, a search error was issued +" instead of the wrap message. Add check for l:isStuckAtCurrentMark && +" l:isWrapped in the no-match part of s:Search(). +" - FIX: In backwards search with single match, the :break short-circuits the +" l:isWrapped logic, resets l:line and therefore also confuses the logic and +" leads to wrong error message instead of wrap message. Don't reset l:line, +" set l:isWrapped instead. +" - FIX: Wrong logic for determining l:isWrapped lets wrap-around go undetected +" when v:count >= number of total matches. [l:startLine, l:startCol] must +" be updated on every iteration. +" " 17-May-2011, Ingo Karkat " - Make s:GetVisualSelection() public to allow use in suggested " MarkSpaceIndifferent vmap. @@ -515,11 +527,12 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) set nosmartcase let l:count = v:count1 - let [l:startLine, l:startCol] = [line('.'), col('.')] let l:isWrapped = 0 let l:isMatch = 0 let l:line = 0 while l:count > 0 + let [l:startLine, l:startCol] = [line('.'), col('.')] + " Search for next match, 'wrapscan' applies. let [l:line, l:col] = searchpos( a:pattern, (a:isBackward ? 'b' : '') ) @@ -541,9 +554,10 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) " a regular match. The search also must not be retried when this is the " first match, but we've been here before (i.e. l:isMatch is set): This " means that there is only the current mark in the buffer, and we must - " break out of the loop and indicate that no other mark was found. + " break out of the loop and indicate that search wrapped around and no + " other mark was found. if l:isMatch - let l:line = 0 + let l:isWrapped = 1 break endif @@ -571,6 +585,7 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) " We're not stuck when the search wrapped around and landed on the current " mark; that's why we exclude a possible wrap-around via v:count1 == 1. let l:isStuckAtCurrentMark = ([l:line, l:col] == a:currentMarkPosition && v:count1 == 1) +"****D echomsg '****' l:line l:isStuckAtCurrentMark l:isWrapped l:isMatch string([l:line, l:col]) string(a:currentMarkPosition) if l:line > 0 && ! l:isStuckAtCurrentMark let l:matchPosition = getpos('.') @@ -612,8 +627,13 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) " it getting lost due to the screen updates). call s:MarkEnable(1) - call s:ErrorMessage(a:searchType, a:pattern, a:isBackward) - return 0 + if l:line > 0 && l:isStuckAtCurrentMark && l:isWrapped + call s:WrapMessage(a:searchType, a:pattern, a:isBackward) + return 1 + else + call s:ErrorMessage(a:searchType, a:pattern, a:isBackward) + return 0 + endif endif endfunction diff --git a/doc/ack.txt b/doc/ack.txt new file mode 100644 index 0000000..4d57841 --- /dev/null +++ b/doc/ack.txt @@ -0,0 +1,38 @@ +*ack.txt* Plugin that integrates ack with Vim + +============================================================================== +Author: Antoine Imbert *ack-author* +License: Same terms as Vim itself (see |license|) + +============================================================================== +INTRODUCTION *ack* + +This plugin is a front for the Perl module App::Ack. Ack can be used as a +replacement for grep. This plugin will allow you to run ack from vim, and +shows the results in a split window. + +:Ack [options] {pattern} [{directory}] *:Ack* + + Search recursively in {directory} (which defaults to the current + directory) for the {pattern}. Behaves just like the |:grep| command, but + will open the |Quickfix| window for you. + +:AckAdd [options] {pattern} [{directory}] *:AckAdd* + + Just like |:Ack| + |:grepadd|. Appends the |quickfix| with the results + +:LAck [options] {pattern} [{directory}] *:LAck* + + Just like |:Ack| + |:lgrep|. Searches, but opens in |location-list| + +:LAckAdd [options] {pattern} [{directory}] *:LAckAdd* + + Just like |:Ack| + |:lgrepadd|. Searches, but appends results to + |location-list| + +Files containing the search term will be listed in the split window, along +with the line number of the occurrence, once for each occurrence. on +a line in this window will open the file, and place the cursor on the matching +line. + +See http://search.cpan.org/~petdance/ack/ack for more information. diff --git a/doc/mark.txt b/doc/mark.txt index 75df9c0..5528d09 100644 --- a/doc/mark.txt +++ b/doc/mark.txt @@ -42,6 +42,9 @@ RELATED WORKS * 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. +- 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). ============================================================================== USAGE *mark-usage* @@ -219,6 +222,7 @@ Using this, you can assign a new visual mode mapping * > vmap * MarkWhitespaceIndifferent or override the default |v_m| mapping, in case you always want this behavior: > + vmap IgnoreMarkSet MarkSet vmap m MarkWhitespaceIndifferent < ============================================================================== @@ -245,6 +249,13 @@ http://vim.wikia.com/wiki/Highlight_multiple_words: ============================================================================== HISTORY *mark-history* +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. +- FIX: Backwards search with single match leads to wrong error message + 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. diff --git a/doc/tags b/doc/tags index aba0456..b0fc2a7 100644 --- a/doc/tags +++ b/doc/tags @@ -24,6 +24,8 @@ 'snippets' snipMate.txt /*'snippets'* .snippet snipMate.txt /*.snippet* .snippets snipMate.txt /*.snippets* +:Ack ack.txt /*:Ack* +:AckAdd ack.txt /*:AckAdd* :CVSEdit vcscommand.txt /*:CVSEdit* :CVSEditors vcscommand.txt /*:CVSEditors* :CVSUnedit vcscommand.txt /*:CVSUnedit* @@ -70,6 +72,8 @@ :FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord* :FufTaggedFile fuf.txt /*:FufTaggedFile* :Id: vimblogger_ft.txt /*:Id:* +:LAck ack.txt /*:LAck* +:LAckAdd ack.txt /*:LAckAdd* :Loremipsum loremipsum.txt /*:Loremipsum* :Loreplace loremipsum.txt /*:Loreplace* :Mark mark.txt /*:Mark* @@ -213,6 +217,9 @@ VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride* VCSCommandVCSTypePreference vcscommand.txt /*VCSCommandVCSTypePreference* VimwikiWeblinkHandler vimwiki.txt /*VimwikiWeblinkHandler* abc fuf.txt /*abc* +ack ack.txt /*ack* +ack-author ack.txt /*ack-author* +ack.txt ack.txt /*ack.txt* b:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand* b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer* b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile* diff --git a/plugin/ack.vim b/plugin/ack.vim new file mode 100644 index 0000000..1aecd51 --- /dev/null +++ b/plugin/ack.vim @@ -0,0 +1,50 @@ +" NOTE: You must, of course, install the ack script +" in your path. +" On Ubuntu: +" sudo apt-get install ack-grep +" ln -s /usr/bin/ack-grep /usr/bin/ack +" With MacPorts: +" sudo port install p5-app-ack + +let g:ackprg="ack\\ -H\\ --nocolor\\ --nogroup" + +function! Ack(args) + let grepprg_bak=&grepprg + exec "set grepprg=" . g:ackprg + execute "silent! grep " . a:args + botright copen + let &grepprg=grepprg_bak + exec "redraw!" +endfunction + +function! AckAdd(args) + let grepprg_bak=&grepprg + exec "set grepprg=" . g:ackprg + execute "silent! grepadd " . a:args + botright copen + let &grepprg=grepprg_bak + exec "redraw!" +endfunction + +function! LAck(args) + let grepprg_bak=&grepprg + exec "set grepprg=" . g:ackprg + execute "silent! lgrep " . a:args + botright lopen + let &grepprg=grepprg_bak + exec "redraw!" +endfunction + +function! LAckAdd(args) + let grepprg_bak=&grepprg + exec "set grepprg=" . g:ackprg + execute "silent! lgrepadd " . a:args + botright lopen + let &grepprg=grepprg_bak + exec "redraw!" +endfunction + +command! -nargs=* -complete=file Ack call Ack() +command! -nargs=* -complete=file AckAdd call AckAdd() +command! -nargs=* -complete=file LAck call LAck() +command! -nargs=* -complete=file LAckAdd call LAckAdd() diff --git a/plugin/buffergator.vim b/plugin/buffergator.vim index 02c0f05..a40193e 100644 --- a/plugin/buffergator.vim +++ b/plugin/buffergator.vim @@ -422,7 +422,7 @@ function! s:NewCatalogViewer(name, title) redir END let l:buffers_output_rows = split(l:buffers_output, "\n") for l:buffers_output_row in l:buffers_output_rows - let l:parts = matchlist(l:buffers_output_row, '^\s*\(\d\+\)\(.....\) "\(.*\)"\s\+\w\+ \d\+$') + let l:parts = matchlist(l:buffers_output_row, '^\s*\(\d\+\)\(.....\) "\(.*\)"') let l:info = {} let l:info["bufnum"] = l:parts[1] + 0 if l:parts[2][0] == "u" @@ -1015,7 +1015,6 @@ function! s:NewBufferCatalogViewer() noremap :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "") noremap o :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "") " gryf: let's keep it stright: s should split, v should vsplit - " split noremap s :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb") noremap v :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb") noremap t :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "tab sb") diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim_disabled similarity index 100% rename from plugin/tagbar.vim rename to plugin/tagbar.vim_disabled