Quellcode durchsuchen

Add support for FZF integration

Yegappan Lakshmanan vor 5 Jahren
Ursprung
Commit
e318b2e515
2 geänderte Dateien mit 31 neuen und 2 gelöschten Zeilen
  1. 14 1
      doc/mru.txt
  2. 17 1
      plugin/mru.vim

+ 14 - 1
doc/mru.txt

@@ -2,7 +2,7 @@
 
 Author: Yegappan Lakshmanan  (yegappan AT yahoo DOT com)
 For Vim version 7.0 and above
-Last change: August 29, 2018
+Last change: May 15, 2020
 
 ==============================================================================
 						*mru-license*
@@ -33,6 +33,7 @@ CONTENTS~
 2. Installation					|mru-installation|
 3. Usage					|mru-usage|
 4. Configuration				|mru-configuration|
+5. FZF Integration				|mru-fzf|
 
 ==============================================================================
 1. Overview					*mru-overview*
@@ -261,6 +262,18 @@ as shown below:
       let MRU_Filename_Format =
       \   {'formatter':'v:val', 'parser':'.*', 'syntax': '[^/\\]\+$'}
 <
+==============================================================================
+5. FZF Integration				*mru-fzf*
+
+You can use the MRU plugin with FZF (command-line fuzzy finder). You can
+download and install FZF from https://github.com/junegunn/fzf.
+
+To select a file from the MRU file list using FZF, run the following command:
+>
+	:FZFMru
+<
+This will invoke FZF to select a file from the MRU list.
+
 ==============================================================================
 
 vim:tw=78:ts=8:noet:ft=help:

+ 17 - 1
plugin/mru.vim

@@ -1,7 +1,7 @@
 " File: mru.vim
 " Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
 " Version: 3.9.2
-" Last Modified: March 15, 2020
+" Last Modified: May 15, 2020
 " Copyright: Copyright (C) 2003-2020 Yegappan Lakshmanan
 " License:   Permission is hereby granted to use and distribute this code,
 "            with or without modifications, provided that this copyright
@@ -856,6 +856,22 @@ command! -nargs=? -complete=customlist,s:MRU_Complete MRU
 command! -nargs=? -complete=customlist,s:MRU_Complete Mru
             \ call s:MRU_Cmd(<q-args>)
 
+" FZF (fuzzy finder) integration
+func s:MRU_FZF_EditFile(fname)
+    call s:MRU_Window_Edit_File(a:fname, 0, 'edit', 'useopen')
+endfunc
+
+func s:MRU_FZF_Run()
+    if !exists('*fzf#run')
+	call s:MRU_Warn_Msg('FZF plugin is not present')
+	return
+    endif
+    call fzf#run(fzf#wrap({'source' : s:MRU_files,
+		\ 'sink' : function('s:MRU_FZF_EditFile'),
+		\'down' : '25%'}, 0))
+endfunc
+command! -nargs=0 FZFMru call s:MRU_FZF_Run()
+
 " }}}
 
 " restore 'cpo'