Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

MRUToggle #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions plugin/mru.vim
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,21 @@ function! s:MRU_Cmd(pat)
call s:MRU_Open_Window(a:pat)
endfunction

" MRU_Toggle {{{1
" Toggle MRU
" pat - File name pattern passed to the MRU command
function! s:MRU_Toggle(pat)
" If the MRU window is open, close it
let bname = '__MRU_Files__'
let winnum = bufwinnr(bname)
if winnum != -1
exe winnum . 'wincmd w'
silent! close
else
call s:MRU_Cmd(a:pat)
endif
endfunction

" MRU_add_files_to_menu {{{1
" Adds a list of files to the "Recent Files" sub menu under the "File" menu.
" prefix - Prefix to use for each of the menu entries
Expand Down Expand Up @@ -967,6 +982,8 @@ command! -nargs=? -complete=customlist,s:MRU_Complete MRU
\ call s:MRU_Cmd(<q-args>)
command! -nargs=? -complete=customlist,s:MRU_Complete Mru
\ call s:MRU_Cmd(<q-args>)
command! -nargs=? -complete=customlist,s:MRU_Complete MRUToggle
\ call s:MRU_Toggle(<q-args>)

" }}}

Expand Down