From 2f6eca0dc513d474765290f1a5a4c02aed549be0 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 7 Nov 2018 10:34:07 +0100 Subject: Plein de trucs en vrac... J’ai honte.. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoload/fuf/givenfile.vim | 121 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 autoload/fuf/givenfile.vim (limited to 'autoload/fuf/givenfile.vim') diff --git a/autoload/fuf/givenfile.vim b/autoload/fuf/givenfile.vim new file mode 100644 index 0000000..5419ff8 --- /dev/null +++ b/autoload/fuf/givenfile.vim @@ -0,0 +1,121 @@ +"============================================================================= +" Copyright (c) 2007-2010 Takeshi NISHIDA +" +"============================================================================= +" LOAD GUARD {{{1 + +if !l9#guardScriptLoading(expand(':p'), 0, 0, []) + finish +endif + +" }}}1 +"============================================================================= +" GLOBAL FUNCTIONS {{{1 + +" +function fuf#givenfile#createHandler(base) + return a:base.concretize(copy(s:handler)) +endfunction + +" +function fuf#givenfile#getSwitchOrder() + return -1 +endfunction + +" +function fuf#givenfile#getEditableDataNames() + return [] +endfunction + +" +function fuf#givenfile#renewCache() +endfunction + +" +function fuf#givenfile#requiresOnCommandPre() + return 0 +endfunction + +" +function fuf#givenfile#onInit() +endfunction + +" +function fuf#givenfile#launch(initialPattern, partialMatching, prompt, items) + let s:prompt = (empty(a:prompt) ? '>' : a:prompt) + let s:items = map(copy(a:items), 'fuf#makePathItem(v:val, "", 0)') + call fuf#mapToSetSerialIndex(s:items, 1) + call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') + call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) +endfunction + + +" }}}1 +"============================================================================= +" LOCAL FUNCTIONS/VARIABLES {{{1 + +let s:MODE_NAME = expand(':t:r') + +" }}}1 +"============================================================================= +" s:handler {{{1 + +let s:handler = {} + +" +function s:handler.getModeName() + return s:MODE_NAME +endfunction + +" +function s:handler.getPrompt() + return fuf#formatPrompt(s:prompt, self.partialMatching, '') +endfunction + +" +function s:handler.getPreviewHeight() + return g:fuf_previewHeight +endfunction + +" +function s:handler.isOpenable(enteredPattern) + return 1 +endfunction + +" +function s:handler.makePatternSet(patternBase) + return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', + \ self.partialMatching) +endfunction + +" +function s:handler.makePreviewLines(word, count) + return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) +endfunction + +" +function s:handler.getCompleteItems(patternPrimary) + return s:items +endfunction + +" +function s:handler.onOpen(word, mode) + call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) +endfunction + + +" +function s:handler.onModeEnterPre() +endfunction + +" +function s:handler.onModeEnterPost() +endfunction + +" +function s:handler.onModeLeavePost(opened) +endfunction + +" }}}1 +"============================================================================= +" vim: set fdm=marker: -- cgit v1.2.3