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

Strip off ANSI Escapes from g:find_files_findprg command output #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

phongvcao
Copy link

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):

Screenshot at Jul 26 21-43-13

@phongvcao
Copy link
Author

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:

Screenshot at Jul 26 21-46-23

(this screenshot is what things look like without AnsiEsc and the code in this pull request)

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

Successfully merging this pull request may close these issues.

1 participant