vim-find-files
vim-find-files copied to clipboard
Strip off ANSI Escapes from g:find_files_findprg command output
Output from g:find_files_findprg
command may contain AnsiEsc sequence (e.g.^[[0m^[[32m./output/dir^[[0m
). This pull request makes vim-find-files
able to open files/directories in the "File List" buffer with AnsiEsc sequence in it (by stripping off the ansi escape sequence before following the link to the file).
This allows vim-find-files
to have output being colored inside Vim using AnsiEsc plugin by adding the following setting to .vimrc
:
function! SetHighlightFindFiles()
if &filetype ==# 'findfiles'
AnsiEsc
endif
endfunction
augroup my_find_files_customization
autocmd! FileType findfiles :call SetHighlightFindFiles()
augroup END " my_find_files_customization
And here is the result (with "File List" buffer with syntax highlight using AnsiEsc):
The current code in the master branch uses "gf" to navigate to the filenames in the "File List" window, which would be impossible if the output "File List" window contains ANSI Escape sequence like this:
(this screenshot is what things look like without AnsiEsc and the code in this pull request)