Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
delete results
Browse files Browse the repository at this point in the history
resolves #9
  • Loading branch information
albfan committed Dec 17, 2015
1 parent f6e2164 commit 88fe6c5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
27 changes: 21 additions & 6 deletions autoload/ag.vim
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,27 @@ function! ag#AgGroup(ncontext, visualmode, fileregexp, args)
setlocal foldcolumn=2
1
setlocal nomodifiable
map <buffer> o zaj
map <buffer> <space> :call NextFold()<CR>
map <buffer> O :call ToggleEntireFold()<CR>
map <buffer> <Enter> :call OpenFile(0)<CR>
map <buffer> s :call OpenFile(1)<CR>
map <buffer> S :call OpenFile(2)<CR>
noremap <silent> <buffer> o zaj
noremap <silent> <buffer> <space> :call NextFold()<CR>
noremap <silent> <buffer> O :call ToggleEntireFold()<CR>
noremap <silent> <buffer> <Enter> :call OpenFile(0)<CR>
noremap <silent> <buffer> s :call OpenFile(1)<CR>
noremap <silent> <buffer> S :call OpenFile(2)<CR>
noremap <silent> <buffer> d :call DeleteFold()<CR>
endfunction

function DeleteFold()
if foldlevel(".") == 0
return
endif
setlocal modifiable
if foldclosed(".") != -1
normal zo
endif
"normal stops if command fails. On cursor at beginning of fold motion fails
normal! [z
normal! kVj]zD
setlocal nomodifiable
endfunction

" Find next fold or go back to first one
Expand Down
1 change: 1 addition & 0 deletions doc/ag.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ the results in a split window.
<space> Open next fold search (cyclic)
s Goto selected file:line:col splitting horizontal above
S Goto selected file:line:col splitting vertical above
d Delete result

:AgBuffer[!] [options] {pattern} *:AgBuffer*

Expand Down

0 comments on commit 88fe6c5

Please sign in to comment.