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

fish: Command substitutions not allowed #300

Open
MontiL opened this issue Feb 23, 2022 · 1 comment
Open

fish: Command substitutions not allowed #300

MontiL opened this issue Feb 23, 2022 · 1 comment

Comments

@MontiL
Copy link

MontiL commented Feb 23, 2022

Problems summary

After configure this https://github.com/yuki-yano/fzf-preview.vim#coc-extensions-2
Execute command : <Leader>f gs to search Git Status
then get this issue:

fish: Command substitutions not allowed
[[ $(git diff --cached -- 'components/Footer.js') != "" ]] && git diff --cached --color=always -- 'components/Footer.js' || [[ $(git diff -- 'components/Footer.js') != "" ]] && git diff --color=always -- 'components/Footer.js' || bat --theme=OneHalfDark --color=always --plain --number 'components/Footer.js'

I had looked into the code, it should be related to this:
.config/coc/extensions/node_modules/coc-fzf-preview/plugin/fzf_preview.vim

if !exists('g:fzf_preview_git_status_preview_command')
  let g:fzf_preview_git_status_preview_command =  '[[ $(git diff --cached -- {-1}) != "" ]] && git diff --cached --color=always -- {-1} || ' .
  \ '[[ $(git diff -- {-1}) != "" ]] && git diff --color=always -- {-1} || ' .
  \ g:fzf_preview_command
endif

Fish shell doesn't work

Expected

Interactive git integration

Environment Information

  • fzf-preview version (package.json):
    "version": "2.12.8"

  • OS:
    iMac (24-inch, M1, 2021)
    macOS Monterey

  • Fish Shell:
    version 3.3.1

  • Vim/Neovim version:
    NVIM v0.7.0-dev+1102-gf4e24f1ea
    Build type: Release
    LuaJIT 2.1.0-beta3

Provide a minimal init.vim

Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'junegunn/fzf.vim' | Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'neovim/nvim-lspconfig'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'thinca/vim-qfreplace'

let g:coc_global_extensions = [ 
      \ 'coc-json', 'coc-html', 'coc-css', 'coc-tsserver', 
      \ 'coc-markdownlint', 
      \ 'coc-pyright',
      \ 'coc-webview', 'coc-markdown-preview-enhanced',
      \ 'coc-prettier', 'coc-eslint', 'coc-tslint', 'coc-stylelint',
      \ 'coc-diagnostic',
      \ 'coc-snippets',
      \ 'coc-emmet',
      \ 'coc-git',
      \ 'coc-fzf-preview'
      \ ]
let g:fzf_preview_if_binary_command = "string match 'binary' (file --mime {})"

nmap <Leader>f [fzf-p]
xmap <Leader>f [fzf-p]

nnoremap <silent> [fzf-p]p     :<C-u>CocCommand fzf-preview.FromResources project_mru git<CR>
nnoremap <silent> [fzf-p]gs    :<C-u>CocCommand fzf-preview.GitStatus<CR>
nnoremap <silent> [fzf-p]ga    :<C-u>CocCommand fzf-preview.GitActions<CR>
nnoremap <silent> [fzf-p]b     :<C-u>CocCommand fzf-preview.Buffers<CR>
nnoremap <silent> [fzf-p]B     :<C-u>CocCommand fzf-preview.AllBuffers<CR>
nnoremap <silent> [fzf-p]o     :<C-u>CocCommand fzf-preview.FromResources buffer project_mru<CR>
nnoremap <silent> [fzf-p]<C-o> :<C-u>CocCommand fzf-preview.Jumps<CR>
nnoremap <silent> [fzf-p]g;    :<C-u>CocCommand fzf-preview.Changes<CR>
nnoremap <silent> [fzf-p]/     :<C-u>CocCommand fzf-preview.Lines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'"<CR>
nnoremap <silent> [fzf-p]*     :<C-u>CocCommand fzf-preview.Lines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'<C-r>=expand('<cword>')<CR>"<CR>
nnoremap          [fzf-p]gr    :<C-u>CocCommand fzf-preview.ProjectGrep<Space>
xnoremap          [fzf-p]gr    "sy:CocCommand   fzf-preview.ProjectGrep<Space>-F<Space>"<C-r>=substitute(substitute(@s, '\n', '', 'g'), '/', '\\/', 'g')<CR>"
nnoremap <silent> [fzf-p]t     :<C-u>CocCommand fzf-preview.BufferTags<CR>
nnoremap <silent> [fzf-p]q     :<C-u>CocCommand fzf-preview.QuickFix<CR>
nnoremap <silent> [fzf-p]l     :<C-u>CocCommand fzf-preview.LocationList<CR>

Screenshot

Fish shell doesn't work
截圖 2022-02-23 下午2 25 44

@jinzhongjia
Copy link

me too

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

2 participants