Skip to content

bug: g_ctrlp_extensons execution priority is too low #617

@q962

Description

@q962

for [ke, va] in items(s:opts)
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
endfo

What is obtained here is s:usrign, but the filtering function is realized through a g:ctrlp_custom_ignore (alias s:usrign).

The autoignore.vim extension modifies g:ctrlp_custom_ignore

" Extensions
if !( exists('extensions') && extensions == s:extensions )
for each in s:extensions
exe 'ru autoload/ctrlp/'.each.'.vim'
endfo
en

s:usrign has already used the default value, and it is too late to wait for autoignore.vim to modify g:ctrlp_custom_ignore.

To call the autoignore function requires three operations, which is too cumbersome


What happens if you increase the execution priority of an extension?

patch

diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim
index 600ffa2..bb4512d 100644
--- a/autoload/ctrlp.vim
+++ b/autoload/ctrlp.vim
@@ -228,6 +228,16 @@ fu! s:opts(...)
 	for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each)
 		let {each} = s:{each}
 	en | endfo
+
+	" Extensions
+	let key="extensions"
+	let s:{key} = exists(s:pref.key) ? {s:pref.key} : s:opts[key][1]
+	if ! exists('extensions')
+		for each in s:extensions
+			exe 'ru autoload/ctrlp/'.each.'.vim'
+		endfo
+	en
+
 	for [ke, va] in items(s:opts)
 		let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
 	endfo
@@ -271,12 +281,6 @@ fu! s:opts(...)
 	if s:lazy
 		cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) })
 	en
-	" Extensions
-	if !( exists('extensions') && extensions == s:extensions )
-		for each in s:extensions
-			exe 'ru autoload/ctrlp/'.each.'.vim'
-		endfo
-	en
 	" Keymaps
 	if type(s:urprtmaps) == 4
 		cal extend(s:prtmaps, s:urprtmaps)
@@ -551,7 +555,7 @@ fu! s:UserCmd(lscmd)
 		let argv = [&shell, &shellcmdflag, printf(lscmd, path)]
 		if !has('nvim')
 			let s:job = job_start(argv, {
-						\ 'out_cb': function('s:async_glob_on_stdout'), 
+						\ 'out_cb': function('s:async_glob_on_stdout'),
 						\ 'exit_cb': function('s:async_glob_on_exit')
 						\ })
 		el

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions