Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Version 1.2.4: Fixed leaving of insert mode after leaving YATE buffer.

  • Loading branch information...
commit 59c3f97f8b6b93151603a1580675aba191b9169b 1 parent dff5bc7
@madevgeny madevgeny authored committed
Showing with 21 additions and 4 deletions.
  1. +21 −4 plugin/yate.vim
View
25 plugin/yate.vim
@@ -45,9 +45,10 @@
" search string. Autocompletion using history also works by
" <Ctrl-X><Ctrl-U>.
"
-" Version: 1.2.3
+" Version: 1.2.4
"
-" ChangeLog: 1.2.3: Insert mode is default in YATE buffer.
+" ChangeLog: 1.2.4: Fixed leaving of insert mode after leaving YATE buffer.
+" 1.2.3: Insert mode is default in YATE buffer.
" 1.2.2: Fixed cleaning of search string in some cases.
"
" 1.2.1: History menu (<Ctrl-H>) also works in normal mode.
@@ -356,6 +357,19 @@ fun <SID>GotoTagE()
fun <SID>GotoTagE()
cal <SID>GotoTag('e')
endfun
+
+fun <SID>OnBufLeave()
+ if s:prev_mode != 'i'
+ exe 'stopinsert'
+ endif
+endfun
+
+fun <SID>OnBufEnter()
+ let s:prev_mode = mode()
+ exe 'startinsert'
+
+ call <SID>PrintTagsList()
+endfun
fun! <SID>ToggleTagExplorerBuffer()
if !exists("s:yate_winnr") || s:yate_winnr==-1
@@ -396,17 +410,20 @@ fun! <SID>ToggleTagExplorerBuffer()
let s:yate_winnr=bufnr("YATE")
setlocal buftype=nofile
- setlocal noswapfile
+ setlocal noswapfile
+
+ let s:prev_mode = mode()
exe 'startinsert'
if !exists("s:first_time")
let s:user_line=''
let s:first_time=1
+ autocmd BufUnload <buffer> exe 'let s:yate_winnr=-1'
autocmd BufLeave <buffer> call <SID>OnBufLeave()
autocmd CursorMoved <buffer> call <SID>OnCursorMoved()
autocmd CursorMovedI <buffer> call <SID>OnCursorMovedI()
- autocmd VimResized <buffer> call <SID>PrintTagsList()
+ autocmd VimResized <buffer> call <SID>PrintTagsList()
autocmd BufEnter <buffer> call <SID>OnBufEnter()
endif
Please sign in to comment.
Something went wrong with that request. Please try again.