MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: use vim to edit mathematica file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91814] Re: use vim to edit mathematica file
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Tue, 9 Sep 2008 06:55:13 -0400 (EDT)
  • References: <ga2pmd$p57$1@smc.vnet.net>

Peng Yu wrote:
> Hi,
> 
> It seems the vim front end is too old. I'm wondering if it is
> worthwhile to install it.
> 
> http://library.wolfram.com/infocenter/MathSource/2584/
> 
> Anyway, I'm trying to use vim to edit mathematica file. But it seems
> the .nb files are full of something like
> 
> Notebook[{
> Cell[BoxData[
>  RowBox[{
> 
> These things are not readable in the text mode. 

... and they are not ment to be...

> How does people usually do when editing
> mathematica files with vim?

editing "mathematica files" with any text editor is usually done with
files in mathematica package format, that is ASCII files that contain
mathematica InputForm. Notebook files are not really ment to be edited
with something else than the mathematica frontend and are not ment to be
human readable although you can actually do both...

> I'm wondering how to get rid of these things.

you don't. What you can do is to make all the cells in a notebook to be
InitializationCells (Cell -> Properties -> InitializationCell). When you
then save the file, you will be asked whether you want to automatically
create a package file. If you answer yes, a file with extension .m will
be created which you then can edit with vim, if you want. Still there
will be some unfriendly formatting, e.g. a greek alpha will look like
this: \[Alpha]. So if you really want to do this, you better get rid of
anything that's non-ASCII...

On the other hand I would really recommend to reflect what the pros and
cons are to write mathematica code with an ASCII editor. It is an
absolutley underrated advantage to be able to write formulas in a
mathematical notation to avoid typos. I have just by accident found an
error in a formula in years old code by just pasting it into the front
end: someone interchanged a ^ for a *, which is something you hardly see
in a multi-line ASCII-art formula, but will immediatly see in
StandardForm in a notebook.


hth,

albert


  • Prev by Date: Re: How can I do a "grep -v" equivalent in Import[]?
  • Next by Date: Re: use vim to edit mathematica file
  • Previous by thread: Re: use vim to edit mathematica file
  • Next by thread: Re: use vim to edit mathematica file