|
@@ -1,7 +1,7 @@
|
|
|
" File: mru.vim
|
|
" File: mru.vim
|
|
|
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
|
|
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
|
|
|
-" Version: 3.7
|
|
|
|
|
-" Last Modified: December 22, 2013
|
|
|
|
|
|
|
+" Version: 3.8
|
|
|
|
|
+" Last Modified: December 24, 2013
|
|
|
" Copyright: Copyright (C) 2003-2013 Yegappan Lakshmanan
|
|
" Copyright: Copyright (C) 2003-2013 Yegappan Lakshmanan
|
|
|
" License: Permission is hereby granted to use and distribute this code,
|
|
" License: Permission is hereby granted to use and distribute this code,
|
|
|
" with or without modifications, provided that this copyright
|
|
" with or without modifications, provided that this copyright
|
|
@@ -511,8 +511,7 @@ endfunction
|
|
|
" 'edit' - Edit the file as a regular file
|
|
" 'edit' - Edit the file as a regular file
|
|
|
" multi : Specifies whether a single file or multiple files need to be
|
|
" multi : Specifies whether a single file or multiple files need to be
|
|
|
" opened.
|
|
" opened.
|
|
|
-" open_type : Specifies where to open the file. Can be one of 'useopen' or
|
|
|
|
|
-" 'newwin' or 'newtab'.
|
|
|
|
|
|
|
+" open_type : Specifies where to open the file.
|
|
|
" useopen - If the file is already present in a window, then
|
|
" useopen - If the file is already present in a window, then
|
|
|
" jump to that window. Otherwise, open the file in
|
|
" jump to that window. Otherwise, open the file in
|
|
|
" the previous window.
|
|
" the previous window.
|
|
@@ -520,6 +519,7 @@ endfunction
|
|
|
" newwin_vert - Open the file in a new vertical window.
|
|
" newwin_vert - Open the file in a new vertical window.
|
|
|
" newtab - Open the file in a new tab. If the file is already
|
|
" newtab - Open the file in a new tab. If the file is already
|
|
|
" opened in a tab, then jump to that tab.
|
|
" opened in a tab, then jump to that tab.
|
|
|
|
|
+" preview - Open the file in the preview window
|
|
|
function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type)
|
|
function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type)
|
|
|
let esc_fname = s:MRU_escape_filename(a:fname)
|
|
let esc_fname = s:MRU_escape_filename(a:fname)
|
|
|
|
|
|
|
@@ -535,6 +535,9 @@ function! s:MRU_Window_Edit_File(fname, multi, edit_type, open_type)
|
|
|
exe 'belowright vnew ' . esc_fname
|
|
exe 'belowright vnew ' . esc_fname
|
|
|
elseif a:open_type ==# 'newtab' || g:MRU_Open_File_Use_Tabs
|
|
elseif a:open_type ==# 'newtab' || g:MRU_Open_File_Use_Tabs
|
|
|
call s:MRU_Open_File_In_Tab(a:fname, esc_fname)
|
|
call s:MRU_Open_File_In_Tab(a:fname, esc_fname)
|
|
|
|
|
+ elseif a:open_type ==# 'preview'
|
|
|
|
|
+ " Edit the file in the preview window
|
|
|
|
|
+ exe 'topleft pedit ' . esc_fname
|
|
|
else
|
|
else
|
|
|
" If the selected file is already open in one of the windows,
|
|
" If the selected file is already open in one of the windows,
|
|
|
" jump to it
|
|
" jump to it
|
|
@@ -750,6 +753,14 @@ function! s:MRU_Open_Window(...)
|
|
|
\ :call <SID>MRU_Select_File_Cmd('edit,newtab')<CR>
|
|
\ :call <SID>MRU_Select_File_Cmd('edit,newtab')<CR>
|
|
|
nnoremap <buffer> <silent> v
|
|
nnoremap <buffer> <silent> v
|
|
|
\ :call <SID>MRU_Select_File_Cmd('view,useopen')<CR>
|
|
\ :call <SID>MRU_Select_File_Cmd('view,useopen')<CR>
|
|
|
|
|
+ nnoremap <buffer> <silent> p
|
|
|
|
|
+ \ :call <SID>MRU_Select_File_Cmd('view,preview')<CR>
|
|
|
|
|
+ vnoremap <buffer> <silent> p
|
|
|
|
|
+ \ :<C-u>if line("'<") == line("'>")<Bar>
|
|
|
|
|
+ \ call <SID>MRU_Select_File_Cmd('open,preview')<Bar>
|
|
|
|
|
+ \ else<Bar>
|
|
|
|
|
+ \ echoerr "Only a single file can be previewed"<Bar>
|
|
|
|
|
+ \ endif<CR>
|
|
|
nnoremap <buffer> <silent> u :MRU<CR>
|
|
nnoremap <buffer> <silent> u :MRU<CR>
|
|
|
nnoremap <buffer> <silent> <2-LeftMouse>
|
|
nnoremap <buffer> <silent> <2-LeftMouse>
|
|
|
\ :call <SID>MRU_Select_File_Cmd('edit,useopen')<CR>
|
|
\ :call <SID>MRU_Select_File_Cmd('edit,useopen')<CR>
|