Skip to content

How to remove CRLF characters when using grep_live? #1404

Closed Answered by echasnovski
AmerM137 asked this question in Q&A
Discussion options

You must be logged in to vote

fzf-lua seems to strip the crlf endings just fine

Yes, because it seems to adjust that during file reading regardless of platform. I think I'd like a more OS robust approach if it is possible.

Do we need to post-process the results somehow to convert the crlf to lf endings?

Yes, adjusting how items are shown was next step. Would you mind, please, checking two possible solutions to this? Apply each of these independently from one another:

  • Replace this line with local items = vim.split(table.concat(data_feed), H.is_windows and '\r\n' or '\n'). This one adjusts how lines are separated when getting results from CLI.
  • Replace this line with lines = vim.tbl_map(function(l) return l:gsub('…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@AmerM137
Comment options

@echasnovski
Comment options

Comment options

You must be logged in to vote
4 replies
@AmerM137
Comment options

@echasnovski
Comment options

Answer selected by AmerM137
@AmerM137
Comment options

@AmerM137
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants