Explorar o código

User can now specify how plug window opens

Using 'let g:plug_window = "topleft new"' or something similar, the
user can specify how they would like the plug window to open.
Miles Whittaker %!s(int64=11) %!d(string=hai) anos
pai
achega
2f3225fc60
Modificáronse 1 ficheiros con 7 adicións e 2 borrados
  1. 7 2
      plug.vim

+ 7 - 2
plug.vim

@@ -458,11 +458,16 @@ function! s:lastline(msg)
   return get(lines, -1, '')
 endfunction
 
+function! s:new_window()
+    let window_cmd = get(g:, 'plug_window', 'vertical topleft new')
+    execute window_cmd
+endfunction
+
 function! s:prepare()
   if bufexists(s:plug_buf)
     let winnr = bufwinnr(s:plug_buf)
     if winnr < 0
-      vertical topleft new
+      call s:new_window()
       execute 'buffer ' . s:plug_buf
     else
       execute winnr . 'wincmd w'
@@ -470,7 +475,7 @@ function! s:prepare()
     setlocal modifiable
     silent %d _
   else
-    vertical topleft new
+    call s:new_window()
     nnoremap <silent> <buffer> q  :if b:plug_preview==1<bar>pc<bar>endif<bar>q<cr>
     nnoremap <silent> <buffer> R  :silent! call <SID>retry()<cr>
     nnoremap <silent> <buffer> D  :PlugDiff<cr>