Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Automatically close bookmarks' quickfix split. #45

Merged
merged 1 commit into from
May 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/bookmarks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ You can customise:
- Line highlights
- Key mappings
- Whether or not line highlighting is on (defaults to off)
- Whether to close bookmarks split when jumping to a bookmark or not.

Please note that vim-bookmarks won't override any colours or highlights you've
set in your colorscheme.
Expand Down Expand Up @@ -194,6 +195,12 @@ Turn on vertical line centering when jumping to bookmark (default 0):
let g:bookmark_center = 1
<

Automatically close bookmarks split when jumping to a bookmark (default 0):

>
let g:bookmark_auto_close = 1
<

===============================================================================
6. FAQ *BookmarksFAQ*

Expand Down
20 changes: 20 additions & 0 deletions plugin/bookmark.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ call s:set('g:bookmark_show_warning', 1 )
call s:set('g:bookmark_auto_save', 1 )
call s:set('g:bookmark_center', 0 )
call s:set('g:bookmark_auto_save_file', $HOME .'/.vim-bookmarks')
call s:set('g:bookmark_auto_close', 0 )

if g:bookmark_auto_save ==# 1
augroup bm_auto_save
Expand Down Expand Up @@ -145,6 +146,10 @@ function! ShowAllBookmarks()
let &errorformat = "%f:%l:%m" " custom format for bookmarks
cgetexpr bm#location_list()
belowright copen
augroup BM_AutoCloseCommand
autocmd!
autocmd WinLeave * call s:auto_close()
augroup END
let &errorformat = oldformat " re-apply original format
endfunction
command! ShowAllBookmarks call ShowAllBookmarks()
Expand Down Expand Up @@ -268,6 +273,21 @@ function! s:add_missing_signs(file)
endfor
endfunction

function! s:auto_close()
if (getbufvar(winbufnr('.'), '&buftype') == 'quickfix')
if (g:bookmark_auto_close)
q
endif
call s:remove_auto_close()
endif
endfunction

function! s:remove_auto_close()
augroup BM_AutoCloseCommand
autocmd!
augroup END
endfunction

" }}}


Expand Down