ctrlp-py-matcher
ctrlp-py-matcher copied to clipboard
last entry skipped if not called from empty buffer for non-file lists
The plugin found at https://github.com/gikmx/vim-ctrlposession lists all sessions. The content of the entries are names of directories.
If you've read a file (current buffer is a file) the last entry is removed by the list and you can not choose that session to load.
The function pymatcher#ShouldHideCurrentFile will return true, cause ctrlp is giving you the actual file (from the current buffer). This leads to the "remove" call in PyMatch. But the file isn't in the list (because the list is not a file list, its a session list), so your index() call returns -1, and so the remove deletes the last entry in the list.
This can be a fix:
if pymatcher#ShouldHideCurrentFile(a:ispath, a:crfile)
let i = index(arr, a:crfile)
if i >= 0
call remove(arr, i)
endif
endif