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

--color=always in .ripgreprc overrides --color=never in vim-clap #609

Closed
paulgrow-octane opened this issue Jan 7, 2021 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@paulgrow-octane
Copy link

paulgrow-octane commented Jan 7, 2021

Environment (please complete the following information):

  • OS: Catalina 10.15.6
  • NeoVim version: 0.4.4
  • vim-clap version: 0.1.22
  • Have you reproduced with a minimal vimrc: yes
  • Have you updated to the latest plugin version: yes
  • Have you upgraded to/compiled the latest Rust binary: yes

Describe the bug
A clear and concise description of what the bug is.

Clap debug

            has cargo: 1
            has maple: /Users/paul.garaud/.vim/plugged/vim-clap/target/release/maple
           maple info: version 0.1.22, built for x86_64-apple-darwin by rustc 1.48.0 (7eac88abb 2020-11-16).

         has +python3: 1
has py dynamic module: 1
            has ctags: ctags without JSON output support
    Current sync impl: Python
     Current FileType: markdown
Third Party Providers: []
       Global Options:
    let g:clap#autoload_dir = '/Users/paul.garaud/.vim/plugged/vim-clap/autoload'
    let g:clap#provider_alias = {'gfiles': 'git_files', 'hist:': 'command_history', 'hist/': 'search_history'}
    let g:clap_background_shadow_blend = 50
    let g:clap_disable_bottom_top = 0
    let g:clap_disable_matches_indicator = v:false
    let g:clap_disable_optional_async = v:false
    let g:clap_disable_run_rooter = v:false
    let g:clap_enable_background_shadow = v:true
    let g:clap_enable_debug = v:false
    let g:clap_enable_icon = 0
    let g:clap_forerunner_status_sign = {'done': '•', 'running': '!', 'using_cache': '*'}
    let g:clap_insert_mode_only = v:false
    let g:clap_multi_selection_warning_silent = 0
    let g:clap_no_matches_msg = 'NO MATCHES FOUND'
    let g:clap_open_action = {'ctrl-v': 'vsplit', 'ctrl-x': 'split', 'ctrl-t': 'tab split'}
    let g:clap_popup_border = 'rounded'
    let g:clap_preview_size = 5
    let g:clap_providers_relaunch_code = '@@'
    let g:clap_search_box_border_style = 'nil'
    let g:clap_search_box_border_symbols = {'nil': ['', ''], 'curve': ['', ''], 'arrow': ['', '']}
  Provider Variables:
                     []

To Reproduce
Steps to reproduce the behavior:

  1. create a .ripgreprc with --color=always

  2. export RIPGREP_CONFIG_PATH=<location of .ripgreprc>

  3. Create the minimal vimrc min.vim:

set nocompatible
set runtimepath^=/path/to/vim-clap
syntax on
filetype plugin indent on

call plug#begin('~/.vim/plugged')
Plug 'liuchengxu/vim-clap'
call plug#end()
  1. Start (neo)vim with command: vim -u min.vim

  2. Type :Clap grep and enter a few arbitrary character

  3. See something akin to:

image

Expected behavior
I see references to --color=never in some of the rust code and my expectation would be that vim-clap would disable/override any problematic options when invoking rg internally. The problem goes away if color != always in the .ripgreprc. Also note that passing --color=never on the command line overrides the .ripgreprc setting as intended.

Screenshots
See above.

Additional context

@paulgrow-octane paulgrow-octane added the bug Something isn't working label Jan 7, 2021
@liuchengxu
Copy link
Owner

Thanks for the report, should be resolved in the latest commit. BTW, it's recommended to use :Clap grep2 since you have the Rust binary which is much more responsive than :Clap grep.

@paulgrow-octane
Copy link
Author

paulgrow-octane commented Jan 8, 2021

Thanks for the suggestion and the super fast fix 🙇

Two quick questions:

  1. does space-vim default to Clap grep when searching projects? (i think it does, which is actually how i encountered the above issue.) is there a way to specify in my .spacevim config to default to grep2?
  2. grep2 seems to have different behavior from grep-- the former appears to do fuzzy match whereas the latter is exact. that may not matter in practice for my use cases (time will tell), but it seems like they're not exact substitutes.

i scanned the help docs and didn't see answers to these questions, but let me know if i missed something and need to RTFM 😅

@liuchengxu
Copy link
Owner

  1. liuchengxu/space-vim@45e6bbc changed the default to grep2 now. And you can actually always redefine the related key mapping to any other command.

  2. Yeah, grep and grep2 is not exactly the same, grep will spawn a job to run ripgrep and display the grepped result on your every input. grep2 will firstly get the total results and then do the fuzzy match on your every input.

@paulgrow-octane
Copy link
Author

Got it, thanks for the explanation 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants