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

Update of buffergator and mark, diabled tagbar, added ack

This commit is contained in:
2011-11-11 15:17:59 +01:00
parent 8c12d9bb0d
commit ff5f855282
9 changed files with 140 additions and 14 deletions

8
.vimrc
View File

@@ -113,7 +113,7 @@ endif
"}}} "}}}
"PLUGINS: {{{ "PLUGINS: {{{
" eclim buffers {{{2 " eclim buffers {{{2
map <Leader>b :Buffers<CR> map <Leader>B :Buffers<CR>
" }}} " }}}
"VimWIKI {{{2 "VimWIKI {{{2
let g:vimwiki_list = [{'path': '~/vimwiki/', let g:vimwiki_list = [{'path': '~/vimwiki/',
@@ -152,8 +152,8 @@ let Tlist_Exit_OnlyWindow = 1
let Tlist_WinWidth = 40 let Tlist_WinWidth = 40
"}}} "}}}
"Tagbar {{{2 "Tagbar {{{2
let g:tagbar_autoclose = 1 "let g:tagbar_autoclose = 1
nmap <Leader>T :TagbarToggle<CR> "nmap <Leader>T :TagbarToggle<CR>
"}}} "}}}
"Pydoc {{{2 "Pydoc {{{2
let g:pydoc_cmd = "/usr/bin/pydoc" let g:pydoc_cmd = "/usr/bin/pydoc"
@@ -181,7 +181,7 @@ nmap <C-Down> \dj
let g:buffergator_split_size=10 let g:buffergator_split_size=10
let g:buffergator_viewport_split_policy='B' let g:buffergator_viewport_split_policy='B'
let g:buffergator_suppress_keymaps=1 let g:buffergator_suppress_keymaps=1
map <Leader>B :BuffergatorToggle<CR> map <Leader>b :BuffergatorToggle<CR>
" }}} " }}}
"Gundo {{{2 "Gundo {{{2
map <Leader>u :GundoToggle<cr> map <Leader>u :GundoToggle<cr>

View File

@@ -1,7 +1,8 @@
ScriptID SourceID Filename ScriptID SourceID Filename
-------------------------- --------------------------
### plugins ### plugins
3619 16686 buffergator 2572 10433 ack.vim
3619 16816 buffergator
102 16171 DirDiff.vim 102 16171 DirDiff.vim
1984 13961 :AutoInstall: FuzzyFinder 1984 13961 :AutoInstall: FuzzyFinder
311 7645 grep.vim 311 7645 grep.vim
@@ -9,7 +10,7 @@ ScriptID SourceID Filename
2727 11120 jsbeautify.vim 2727 11120 jsbeautify.vim
3252 13948 :AutoInstall: L9 3252 13948 :AutoInstall: L9
2289 8922 loremipsum 2289 8922 loremipsum
2666 15663 Mark 2666 16840 Mark
1218 14455 nerdcommenter 1218 14455 nerdcommenter
2262 8944 occur.vim 2262 8944 occur.vim
2136 8206 repeat.vim 2136 8206 repeat.vim

View File

@@ -10,9 +10,21 @@
" Dependencies: " Dependencies:
" - SearchSpecial.vim autoload script (optional, for improved search messages). " - SearchSpecial.vim autoload script (optional, for improved search messages).
" "
" Version: 2.5.1 " Version: 2.5.2
" Changes: " 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 " 17-May-2011, Ingo Karkat
" - Make s:GetVisualSelection() public to allow use in suggested " - Make s:GetVisualSelection() public to allow use in suggested
" <Plug>MarkSpaceIndifferent vmap. " <Plug>MarkSpaceIndifferent vmap.
@@ -515,11 +527,12 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
set nosmartcase set nosmartcase
let l:count = v:count1 let l:count = v:count1
let [l:startLine, l:startCol] = [line('.'), col('.')]
let l:isWrapped = 0 let l:isWrapped = 0
let l:isMatch = 0 let l:isMatch = 0
let l:line = 0 let l:line = 0
while l:count > 0 while l:count > 0
let [l:startLine, l:startCol] = [line('.'), col('.')]
" Search for next match, 'wrapscan' applies. " Search for next match, 'wrapscan' applies.
let [l:line, l:col] = searchpos( a:pattern, (a:isBackward ? 'b' : '') ) 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 " 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 " 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 " 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 if l:isMatch
let l:line = 0 let l:isWrapped = 1
break break
endif 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 " 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. " 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) 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 if l:line > 0 && ! l:isStuckAtCurrentMark
let l:matchPosition = getpos('.') let l:matchPosition = getpos('.')
@@ -612,9 +627,14 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
" it getting lost due to the screen updates). " it getting lost due to the screen updates).
call s:MarkEnable(1) call s:MarkEnable(1)
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) call s:ErrorMessage(a:searchType, a:pattern, a:isBackward)
return 0 return 0
endif endif
endif
endfunction endfunction
" Combine all marks into one regexp. " Combine all marks into one regexp.

38
doc/ack.txt Normal file
View File

@@ -0,0 +1,38 @@
*ack.txt* Plugin that integrates ack with Vim
==============================================================================
Author: Antoine Imbert <antoine.imbert+ackvim@gmail.com> *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. <Enter> 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.

View File

@@ -42,6 +42,9 @@ RELATED WORKS *
highlights only a single window. highlights only a single window.
- highlight.vim (vimscript #1599) highlights lines or patterns of interest in - 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).
============================================================================== ==============================================================================
USAGE *mark-usage* USAGE *mark-usage*
@@ -219,6 +222,7 @@ Using this, you can assign a new visual mode mapping <Leader>* >
vmap <Leader>* <Plug>MarkWhitespaceIndifferent vmap <Leader>* <Plug>MarkWhitespaceIndifferent
or override the default |v_<Leader>m| mapping, in case you always want this or override the default |v_<Leader>m| mapping, in case you always want this
behavior: > behavior: >
vmap <Plug>IgnoreMarkSet <Plug>MarkSet
vmap <Leader>m <Plug>MarkWhitespaceIndifferent vmap <Leader>m <Plug>MarkWhitespaceIndifferent
< <
============================================================================== ==============================================================================
@@ -245,6 +249,13 @@ http://vim.wikia.com/wiki/Highlight_multiple_words:
============================================================================== ==============================================================================
HISTORY *mark-history* 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 2.5.1 17-May-2011
- FIX: == comparison in s:DoMark() leads to wrong regexp (\A vs. \a) being - FIX: == comparison in s:DoMark() leads to wrong regexp (\A vs. \a) being
cleared when 'ignorecase' is set. Use case-sensitive comparison ==# instead. cleared when 'ignorecase' is set. Use case-sensitive comparison ==# instead.

View File

@@ -24,6 +24,8 @@
'snippets' snipMate.txt /*'snippets'* 'snippets' snipMate.txt /*'snippets'*
.snippet snipMate.txt /*.snippet* .snippet snipMate.txt /*.snippet*
.snippets snipMate.txt /*.snippets* .snippets snipMate.txt /*.snippets*
:Ack ack.txt /*:Ack*
:AckAdd ack.txt /*:AckAdd*
:CVSEdit vcscommand.txt /*:CVSEdit* :CVSEdit vcscommand.txt /*:CVSEdit*
:CVSEditors vcscommand.txt /*:CVSEditors* :CVSEditors vcscommand.txt /*:CVSEditors*
:CVSUnedit vcscommand.txt /*:CVSUnedit* :CVSUnedit vcscommand.txt /*:CVSUnedit*
@@ -70,6 +72,8 @@
:FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord* :FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord*
:FufTaggedFile fuf.txt /*:FufTaggedFile* :FufTaggedFile fuf.txt /*:FufTaggedFile*
:Id: vimblogger_ft.txt /*:Id:* :Id: vimblogger_ft.txt /*:Id:*
:LAck ack.txt /*:LAck*
:LAckAdd ack.txt /*:LAckAdd*
:Loremipsum loremipsum.txt /*:Loremipsum* :Loremipsum loremipsum.txt /*:Loremipsum*
:Loreplace loremipsum.txt /*:Loreplace* :Loreplace loremipsum.txt /*:Loreplace*
:Mark mark.txt /*:Mark* :Mark mark.txt /*:Mark*
@@ -213,6 +217,9 @@ VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride*
VCSCommandVCSTypePreference vcscommand.txt /*VCSCommandVCSTypePreference* VCSCommandVCSTypePreference vcscommand.txt /*VCSCommandVCSTypePreference*
VimwikiWeblinkHandler vimwiki.txt /*VimwikiWeblinkHandler* VimwikiWeblinkHandler vimwiki.txt /*VimwikiWeblinkHandler*
abc fuf.txt /*abc* 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:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand*
b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer* b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer*
b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile* b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile*

50
plugin/ack.vim Normal file
View File

@@ -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(<q-args>)
command! -nargs=* -complete=file AckAdd call AckAdd(<q-args>)
command! -nargs=* -complete=file LAck call LAck(<q-args>)
command! -nargs=* -complete=file LAckAdd call LAckAdd(<q-args>)

View File

@@ -422,7 +422,7 @@ function! s:NewCatalogViewer(name, title)
redir END redir END
let l:buffers_output_rows = split(l:buffers_output, "\n") let l:buffers_output_rows = split(l:buffers_output, "\n")
for l:buffers_output_row in l:buffers_output_rows 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 = {}
let l:info["bufnum"] = l:parts[1] + 0 let l:info["bufnum"] = l:parts[1] + 0
if l:parts[2][0] == "u" if l:parts[2][0] == "u"
@@ -1015,7 +1015,6 @@ function! s:NewBufferCatalogViewer()
noremap <buffer> <silent> <CR> :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR> noremap <buffer> <silent> <CR> :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
noremap <buffer> <silent> o :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR> noremap <buffer> <silent> o :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
" gryf: let's keep it stright: s should split, v should vsplit " gryf: let's keep it stright: s should split, v should vsplit
" split
noremap <buffer> <silent> s :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb")<CR> noremap <buffer> <silent> s :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb")<CR>
noremap <buffer> <silent> v :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb")<CR> noremap <buffer> <silent> v :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb")<CR>
noremap <buffer> <silent> t :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "tab sb")<CR> noremap <buffer> <silent> t :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "tab sb")<CR>