Skip to content

Commit 8bee5d0

Browse files
committed
Merge branch 'release-1.1.1'
2 parents cd7d868 + e0685e8 commit 8bee5d0

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

autoload/stay.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ set cpo&vim
66
" Check if buffer {bufnr} is persistent:
77
" @signature: stay#ispersistent({bufnr:Number}, {volatile_ftypes:List<String>})
88
" @returns: Boolean
9+
" @notes: the persistence heuristics are
10+
" - buffer must be listed
11+
" - buffer must be of ordinary or "acwrite" 'buftype'
12+
" - not a preview window
13+
" - not a diff window
14+
" - buffer's 'bufhidden' must be empty or "hide"
15+
" - buffer must not be of a volatile file type
16+
" - buffer must map to a readable file
917
function! stay#ispersistent(bufnr, volatile_ftypes) abort
1018
return bufexists(a:bufnr)
1119
\ && getbufvar(a:bufnr, 'stay_ignore', 0) isnot 1
20+
\ && getbufvar(a:bufnr, '&buflisted') is 1
1221
\ && index(['', 'acwrite'], getbufvar(a:bufnr, '&buftype')) isnot -1
1322
\ && getbufvar(a:bufnr, '&previewwindow') isnot 1
1423
\ && getbufvar(a:bufnr, '&diff') isnot 1
15-
\ && getbufvar(a:bufnr, '&bufhidden') isnot# 'wipe'
24+
\ && index(['', 'hide'], getbufvar(a:bufnr, '&bufhidden')) isnot -1
1625
\ && index(a:volatile_ftypes, getbufvar(a:bufnr, '&filetype')) is -1
1726
\ && filereadable(fnamemodify(bufname(a:bufnr), ':p'))
1827
endfunction

autoload/stay/shim.vim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
" STAY EVAL SHIM MODULE
2+
" Are these Vim patch levels, my dear?
3+
4+
" globpath:
5+
" - no {nosuf} argument before 7.2.051 - :h version7.txt
6+
" - no {list} argument before 7.4.279 - http://ftp.vim.org/pub/vim/patches/7.4/README
7+
function! stay#shim#globpath(path, glob, nosuf, list) abort
8+
if v:version < 702 || (v:version is 702 && !has('patch-051'))
9+
return split(globpath(a:path, a:glob), '\n')
10+
elseif v:version < 704 || (v:version is 704 && !has('patch-279'))
11+
return split(globpath(a:path, a:glob, a:nosuf), '\n')
12+
else
13+
return globpath(a:path, a:glob, a:nosuf, a:list)
14+
endif
15+
endfunction
16+
17+
" vim:set sw=2 sts=2 ts=2 et fdm=marker fmr={{{,}}}:

doc/vim-stay.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vim-stay.txt* For Vim version 7.0 or better version 1.1.0
1+
*vim-stay.txt* For Vim version 7.0 or better version 1.1.1
22

33

44
VIM REFERENCE for the Stay plug-in

plugin/stay.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" A LESS SIMPLISTIC TAKE ON RESTORE_VIEW.VIM
22
" Maintainer: Martin Kopischke <[email protected]>
33
" License: MIT (see LICENSE.md)
4-
" Version: 1.1.0
4+
" Version: 1.1.1
55
if &compatible || !has('autocmd') || !has('mksession') || v:version < 700
66
finish
77
endif
@@ -11,7 +11,7 @@ set cpo&vim
1111

1212
" Set defaults:
1313
let s:defaults = {}
14-
let s:defaults.volatile_ftypes = ['gitcommit', 'gitrebase', 'netrw']
14+
let s:defaults.volatile_ftypes = ['gitcommit', 'gitrebase', 'gitsendmail']
1515
for [s:key, s:val] in items(s:defaults)
1616
execute 'let g:'.s:key. '= get(g:, "'.s:key.'", '.string(s:val).')'
1717
unlet! s:key s:val
@@ -20,7 +20,7 @@ endfor
2020
" Set up 3rd party integrations:
2121
function! s:integrate() abort
2222
let s:integrations = []
23-
for l:file in globpath(&rtp, 'autoload/stay/integrate/*.vim', 1, 1)
23+
for l:file in stay#shim#globpath(&rtp, 'autoload/stay/integrate/*.vim', 1, 1)
2424
try
2525
let l:name = fnamemodify(l:file, ':t:r')
2626
if index(s:integrations, l:name) is -1

0 commit comments

Comments
 (0)