So here is how I managed to get output from MySQL into TeXmacs, using vim along the way.
If you paste directly the data into TeXmacs, you don't get much. This is because the
| gets in the way, and the spaces are reduced to two. Also, you need to separate each line with a blank line to make it clear to TeXmacs that these should be formatted as single lines and not be joined.Why does it do that ?? Why do you ask ??
So here's the process :
Copy your data from mysql into vi, which would be something like that :
+--------+-----------+ | % | name | +--------+-----------+ | 51.00 | number | | 84.00 | volume | +--------+-----------+
Then replace each
| with \|, remove any trailing spaces, replaces every spaces by \{space}, and finally insert a line in between every lines.The sequence of operation to perform is vi is the following :
:%s/ \+$// :%s/|/\\|/g :%s/ /\\ /g :%s/$/^M/g
To get the
^M, you should hit Ctrl+V Enter, for any properly configured terminal.To make this into a function, embed that into
function! MySQL2TeXmacs() %s/|/\\|/g %s/ /\\ /g %s/$/^M/g endfunctionand save it into
~/.vimrc.You can use the insert command to insert
^M, since in insert mode, Ctrl+V switch to Visual Mode and back.Then you can perform the transformation with
:call MySQL2TeXmacs()
You can use
Tab here.Copy the result with the mouse, or use
gg"*yG if that works, then in TeXmacs, hit the following keys sequence :\center F7 Ctrl+Y
This should paste your data properly into TeXmacs.
(cr)Happy TeXmacs-ing ! :))
No comments:
Post a Comment