Closed j5shi closed 2 years ago
Could you please show me your configuration for ctrlp.vim? I can't reproduce this.
@mattn Thanks for your quick response.
let g:ctrlp_map = ''
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_follow_symlinks = 0
let g:ctrlp_by_filename = 0
let g:ctrlp_regexp = 1
let g:ctrlp_switch_buffer = 0
let g:ctrlp_lazy_update = 250
let g:ctrlp_match_current_file = 0
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_match_window = 'bottom,order:ttb,min:1,max:10000,results:200'
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
let g:ctrlp_tabpage_position = 'ac'
let g:ctrlp_working_path_mode = 'r'
let g:ctrlp_open_multiple_files = 't'
let g:ctrlp_root_markers = ['.root', '.git', '.svn', '.vim', '_vimrc', '.vimrc', '.bash_profile']
let g:ctrlp_use_caching = 1
let g:ctrlp_show_hidden = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '.*=+.*$',
\ 'link': '',
\ }
let g:ctrlp_max_files = 0
let g:ctrlp_max_depth = 100
let g:ctrlp_extensions = ['tag', 'rtscript']
let g:ctrlp_buftag_ctags_bin = 'ctags'
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<cr>'],
\ 'AcceptSelection("t")': ['<c-t>', '<2-LeftMouse>'],
\ 'PrtHistory(1)': ['<c-p>', '<c-q>'],
\ }
let g:ctrlp_buftag_types = {
\ 'cpp' : '--c++-kinds=+pxl',
\ 'c' : '--c-kinds=+pxl',
\ 'markdown' : '',
\ 'make' : '',
\ 'terraform' : '',
\ 'neosnippet': '',
\ 'text' : '',
\ 'json' : '',
\ 'yaml' : '',
\ 'dosini' : ''
\}
Hi, I found the root cause of this issue was that the escaped path broke some vim builtin functions, like readdir()
here, and as far as I know there are some other builtin functions having the same issue. These functions does not recognize escaped paths, e.g. /this/is/escaped\#/path
where #
was escaped. So I tried to de-escape the path (e
in the image) before passing it to these functions and then it worked. I used substitute()
as I could not find a better way to restore the escaped path to it's original state.
Hi mattn, any plan to fix this? Shall I make a pull request for it?
I wonder where the escaped #
comes from.
It was generated by ctrlp itself.
I guess it is utils.vim:82. But it is not called with a:type=c
Could you please try this patch?
diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim
index 38b6ed8..60c18ce 100644
--- a/autoload/ctrlp.vim
+++ b/autoload/ctrlp.vim
@@ -428,7 +428,8 @@ endf
if has('patch-8.2-0995')
fu! s:GlobPath(dirs, depth)
let entries = []
- for e in split(a:dirs, ',')
+ let dirs = substitute(a:dirs, '\\\([%# ]\)', '\1', 'g')
+ for e in split(dirs, ',')
sil let files = readdir(e, '1', {'sort': 'none'})
if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en
let entries += map(files, 'e.s:lash.v:val')
related issue https://github.com/ctrlpvim/ctrlp.vim/issues/138
Yes, this patch seems to be able to fix the issue :)