I have a multi-line string that I'm reading by:
let a = getreg('*')
What would be the best way to get the first line of that string? I was hoping I could do something like:
- match
- getbufline
But am having trouble finding the necessary string function to do this. In python it'd be something like: str.split('\n')[0]
If helpful, when I do echom a
the output looks like:
Also, what is ^@
in vim? I've seen ^M
for linebreak (return) but have never seen ^@
before.
Update: After some investigation it seems like that's the nul
or \0
byte, and can be entered in by doing ctrlv ctrl@. And I ended up using this:
let first_line = matchstr(register, '\v<[^\n]+>')
It's very odd that this regex is what's used, as I tried doing something basic like `\v^.+$' and although it would work on a search page, it returned no results when I tried to search the register with it...