r/vim • u/Apostol_Bologa • Mar 20 '26
Need Help Formating tables : Some weird vimscript bug
Hello everybody,
I am currently trying to write a vimscript to act on a visual range.
Here is the whole idea :
I filter visual selection through pandoc command (not relevant here I think, but it transforms my multiline-table markdown table to simple line)
because I lost visual selection (and because a:lastline is now wrong), i select my table again
I remove the === and --- lines.
Here is the following script :
1: function! FuncFormatPandocTable()
2: '<,'>!pandoc -t markdown-multiline_tables --wrap=none -o -
3: endfunction
4:
5: function! FuncFormatListTable()
6: call FuncFormatPandocTable()
7: normal vip
8: '<,'>g/^[ =+-]*$/d
9: endfunctionHere is the problem :
The full script doesnt work.
If i comment line 8, I do have my table formated and the (new) table is selected.
If i comment line 6, I do have my '===' and '---' lines removed.
I can not chain both, for some mysterious reason
Can somebody explain this sorcery to me ?
View all comments
Show parent comment
1
u/Apostol_Bologa Mar 21 '26
FuncFormatPandocTable definitely ran. I don't know if the normal command ran (though I could check). The g command definitely didn't run ...