Anonymous avatar Anonymous committed 6b26f2d

removed on_buf_leave_post()

Comments (0)

Files changed (1)

plugin/fuzzyfinder.vim

   endfor
   call cursor(ln, 0)
   normal zvzz
-  redraw " to clear echo messages
 endfunction
 
 " }}}1
   " before create window
   call self.on_mode_enter()
 
-  call s:WindowManager.activate(self.make_complete_func('CompleteFunc'))
   call s:OptionManager.set('completeopt', 'menuone')
   call s:OptionManager.set('ignorecase', self.ignore_case)
+  call s:WindowManager.activate(self.make_complete_func('CompleteFunc'))
 
   " local autocommands
   augroup FuzzyfinderLocal
     autocmd!
     execute 'autocmd CursorMovedI <buffer>        call ' . self.to_str('on_cursor_moved_i()')
     execute 'autocmd InsertLeave  <buffer> nested call ' . self.to_str('on_insert_leave()'  )
-    execute 'autocmd BufEnter     *               call ' . self.to_str('on_buf_leave_post()')
   augroup END
 
   " local mapping
   endif
 endfunction
 
-" TODO: リファクタリング
 function! g:FuzzyFinderMode.Base.on_insert_leave()
+  call s:WindowManager.deactivate()
   call s:OptionManager.restore_all()
-  call s:WindowManager.deactivate()
-endfunction
-
-" TODO: リファクタリング
-function! g:FuzzyFinderMode.Base.on_buf_leave_post()
-  autocmd! FuzzyfinderLocal
   if exists('s:reserved_command')
     call self.on_open(s:reserved_command[0], s:reserved_command[1])
     unlet s:reserved_command
-    redraw!
   endif
   call self.on_mode_leave()
   call self.empty_cache_if_existed(0)
     call feedkeys(printf("\<C-y>\<C-r>=%s(%d, 1) ? '' : ''\<CR>", self.to_str('on_cr'), a:index), 'n')
   elseif !a:check_dir || getline('.') !~ '[/\\]$'
     let s:reserved_command = [self.remove_prompt(getline('.')), a:index]
-    call feedkeys("\<Esc>", 'n')
+    stopinsert
   endif
 endfunction
 
 
 function! g:FuzzyFinderMode.Base.on_switch_mode(next_prev)
   let s:reserved_switch_mode = a:next_prev
-  call feedkeys("\<Esc>", 'n')
+  stopinsert
 endfunction
 
 function! g:FuzzyFinderMode.Base.on_switch_ignore_case()
 let s:WindowManager = { 'buf_nr' : -1 }
 
 function! s:WindowManager.activate(complete_func)
-  let self.prev_winnr = winnr()
   let cwd = getcwd()
 
   if !bufexists(self.buf_nr)
 
   redraw " for 'lazyredraw'
 
-  " suspend autocomplpop.vim
   if exists(':AutoComplPopLock')
+    " suspend autocomplpop.vim
     :AutoComplPopLock
   endif
 endfunction
 
 function! s:WindowManager.deactivate()
-  " resume autocomplpop.vim
   if exists(':AutoComplPopUnlock')
+    " resume autocomplpop.vim
     :AutoComplPopUnlock
   endif
-
-  close
-  execute self.prev_winnr . 'wincmd w'
+  wincmd p
+  execute self.buf_nr . 'bdelete'
 endfunction
 
 " OBJECT: s:InfoFileManager --------------------------------------------- {{{1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.