Issue
I'm looking for a way to write content of a quickfix window to a file with a specific formatting, preferably in a way that is easily scriptable.
What I'm trying to achieve is a very light integration of Vim and ipdb:
- I set 'breakpoints' as items on a quickfix list with mapping:
nmap <leader>s :call setqflist([], 'a', {'items': [{'filename': @%, 'lnum':line('.'), 'text':'break'}]})
- Write content of the quickfix to
.pdbrc
file withbreak file_path:line_number
formatting - Run ipdb on specified script
Solution
You have two problems:
Turning
items
into a list of properly formatted lines.You will need to:
- get the quickfix list with
:help getqflist()
, - format each item of the list with
:help map()
, - derive
file_path
from thebufnr
field with:help bufname()
and possibly:help fnamemodify()
.
- get the quickfix list with
Writing that list to a given file.
You will need
:help writefile()
.
Answered By - romainl
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.