1. Takeshi NISHIDA
  2. vim-fuzzyfinder

Commits

Takeshi NISHIDA  committed 6b26f2d

removed on_buf_leave_post()

  • Participants
  • Parent commits 2440147
  • Branches default

Comments (0)

Files changed (1)

File plugin/fuzzyfinder.vim

View file
  • Ignore whitespace
   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