Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions plugin/vim-lastplace.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,33 @@ if !exists('g:lastplace_ignore_buftype')
let g:lastplace_ignore_buftype = "help,nofile,quickfix"
endif

if !exists('g:lastplace_force_schemes')
let g:lastplace_force_schemes = "suda://"
endif

if !exists('g:lastplace_open_folds')
let g:lastplace_open_folds = 1
endif

fu! s:lastplace_can_run()
if index(split(g:lastplace_ignore_buftype, ","), &buftype) != -1
return 0
endif
endif

if index(split(g:lastplace_ignore, ","), &filetype) != -1
return 0
endif

try
"if the file does not exist on disk (a new, unsaved file) then do nothing
"check for schemes to force allow, since checking existence is hard
for s in split(g:lastplace_force_schemes, ',')
if stridx(@%, s) == 0
return 1
endif
endfor

"if the file does not exist on disk, then do nothing
"this could be a new, unsaved file, or a non-filesystem path
if empty(glob(@%))
return 0
endif
Expand Down