Permalink
Browse files

Improve neomru sources performance

  • Loading branch information...
1 parent 8b33c30 commit 9e64b5f36b74740fbf1c6811d1f9a6a825d93db7 @Shougo committed Oct 6, 2016
Showing with 18 additions and 10 deletions.
  1. +1 −6 autoload/neomru.vim
  2. +14 −2 autoload/unite/sources/neomru.vim
  3. +3 −2 rplugin/python3/denite/source/file_mru.py
View
@@ -122,12 +122,7 @@ function! s:mru.gather_candidates(args, context) abort "{{{
call self.reload()
endif
- return exists('*unite#helper#paths2candidates') ?
- \ unite#helper#paths2candidates(self.candidates) :
- \ map(copy(self.candidates), "{
- \ 'word' : v:val,
- \ 'action__path' : v:val,
- \}")
+ return self.candidates
endfunction"}}}
function! s:mru.delete(candidates) abort "{{{
for candidate in a:candidates
@@ -65,11 +65,23 @@ function! s:dir_mru_source.hooks.on_post_filter(args, context) abort "{{{
endfunction"}}}
function! s:file_mru_source.gather_candidates(args, context) abort "{{{
let mru = neomru#_get_mrus().file
- return mru.gather_candidates(a:args, a:context)
+ let candidates = mru.gather_candidates(a:args, a:context)
+ return exists('*unite#helper#paths2candidates') ?
+ \ unite#helper#paths2candidates(candidates) :
+ \ map(copy(candidates), "{
+ \ 'word' : v:val,
+ \ 'action__path' : v:val,
+ \}")
endfunction"}}}
function! s:dir_mru_source.gather_candidates(args, context) abort "{{{
let mru = neomru#_get_mrus().directory
- return mru.gather_candidates(a:args, a:context)
+ let candidates = mru.gather_candidates(a:args, a:context)
+ return exists('*unite#helper#paths2candidates') ?
+ \ unite#helper#paths2candidates(candidates) :
+ \ map(copy(candidates), "{
+ \ 'word' : v:val,
+ \ 'action__path' : v:val,
+ \}")
endfunction"}}}
"}}}
" Actions "{{{
@@ -16,5 +16,6 @@ def __init__(self, vim):
self.kind = 'file'
def gather_candidates(self, context):
- return self.vim.eval('neomru#_get_mrus().file.'
- +'gather_candidates([], {"is_redraw": 0})')
+ return [{'word': x, 'action__path': x} for x
+ in self.vim.eval('neomru#_get_mrus().file.'
+ +'gather_candidates([], {"is_redraw": 0})')]

0 comments on commit 9e64b5f

Please sign in to comment.