Sink in quickfix with filename & linenum from fzf#vim#grep
- Dominant language
- Vim Script
- Stars
- 10.3k
- Forks
- 608
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 2
Description
- Category
- [x] Question
- [ ] Bug
- [ ] Suggestion
- OS
- [x] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.
- Vim
- [ ] Vim
- [x] Neovim
I'd like to populate the quickfix list with line number from the output of a fzf#vim#grep command.
I'm using the command:
```
command! -bang FLines call fzf#vim#grep(
\'grep -vnITr --color=always "^$"',
\ 0,
\ {'options': '--reverse --prompt "FLines> "'})
```
to recursively grep all lines within the pwd. Therefore, I need to populate the quickfix list with both filepath and line number to accurately jump to the search results.
I tried to implement something similar in [this comment](https://github.com/junegunn/fzf.vim/issues/185#issuecomment-322120216), but I failed to get anywhere. For some reason, I can't do any introspection while inside build_quickfix_list: I can't echo or assign to a global variable to try to figure out how to break up a:lines in setqflist:
```
function! s:build_quickfix_list(lines)
echom a:lines " Does not work?
let g:tml_variable = cope(a:lines) " Does not work?
" TODO: split a:lines between filename, linenum and text
call setqflist(map(copy(a:lines), '{ "filename": v:val, "lnum": , "text": }'))
copen
cc
endfunction
```
1. Why can't I echo / set global vars from this function?
2. Am I on the right track to set the quickfix list with filepath/linenum?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.