vim-relatively-complete

Vim plugin to complete files relative to the current file, unless path explicitly specified.
git clone git://git.alex.balgavy.eu/vim-relatively-complete.git
Log | Files | Refs | README

commit 9415d95d819b5d07a175de000532069f50949682
parent fa1f8d9f731bbb9dcf129aae6fb7752dc004e9a3
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Tue, 14 Apr 2020 20:11:04 +0200

Plugin boilerplate

Diffstat:
Mautoload/relative_file_complete.vim | 5+++++
Mplugin/relative_file_complete.vim | 11+++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/autoload/relative_file_complete.vim b/autoload/relative_file_complete.vim @@ -1,3 +1,8 @@ +if exists('g:loaded_relatively_complete_autoload') + finish +endif +let g:loaded_relatively_complete_autoload = 1 + " Save cwd, cd to dir enclosing file, then go back to saved dir when complete done function! relative_file_complete#SaveAndRestoreOnComplete() " Save the old cwd diff --git a/plugin/relative_file_complete.vim b/plugin/relative_file_complete.vim @@ -1,2 +1,13 @@ +if exists('g:loaded_relatively_complete') || &cp + finish +endif +let g:loaded_relatively_complete = 1 + +let s:cpo_save = &cpo +set cpo&vim + command! CompleteRelative :call relative_file_complete#SaveAndRestoreOnComplete() inoremap <Plug>CompleteRelative <c-o>:CompleteRelative<CR><C-x><C-f> + +let &cpo = s:cpo_save +unlet s:cpo_save