Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: g_ctrlp_extensons execution priority is too low #617

Open
q962 opened this issue Feb 28, 2023 · 0 comments
Open

bug: g_ctrlp_extensons execution priority is too low #617

q962 opened this issue Feb 28, 2023 · 0 comments

Comments

@q962
Copy link

q962 commented Feb 28, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant