Friday, January 1, 2010

Re: Is vim just for programmers?

Anthony Campbell wrote:
> Having recently rather unexpectedly found myself back on this list after
> being unable to get on it for several years, I seem to see a difference
> in emphasis. Most people who post here appear to be programmers,
> whereas previously there were other kinds of users as well. Nothing
> wrong with that, of course, and I'm not trying to start a flame war. But
> I'm not a programmer yet I use vim for all my writing and I'm wondering
> if I'm unusual.
>
> I write books among other things, and for that I first compose the text
> in vim, which allows me to concentrate on the meaning withoug bothering
> about the appearance, and then transfer it to LyX for final formatting.
> I find it useful to have these two different phases in writing. What I
> like about vim is the possibility to make quick transpositions of blocks
> of text and other changes. I usually end up with several files
> containing different versions of what I've written.
>
> Searching the web for people's views on writing methods I found a number
> who said that one should use vim for programming but emacs for other
> kinds of writing. So I had a look at emacs out of curiosity but couldn't
> see any real advantage for me in learning it. Am I missing something
> here? Is anyone else still using vim for writing lengthy texts?

Anthony,
I am a programmer, but I also use Vim for non-programming tasks: for
example, I keep copious notes on a wide range of topics (professional,
personal, understanding, etc...) in a system of journal files containing
well over 50,000 lines. I wrote a Vim filetype plugin that facilitates
creating journal entries with the sort of header I like (subject, date,
tags, etc...), and a Vim syntax plugin that knows how to highlight the
entries sensibly. I also wrote a Perl GUI that provides advanced search
capabilities, and can send search results to a Vim instance in a way
that makes it easy for me to cycle through the results.

Although the aforementioned Vim syntax plugin knows how to do basic
journal entry highlighting, I sometimes find myself wanting a more
flexible syntax highlighting mechanism: e.g., something analogous to the
"rich text" capability supported by word processors. For this sort of
highlighting, I use the Txtfmt plugin:

http://www.vim.org/scripts/script.php?script_id=2208
Screenshots: http://www.txtfmt.webs.com

One of the nice features of Vim's plugin system is that it doesn't force
me to choose between my journal syntax (jnl) and the Txtfmt syntax
(txtfmt): I can use both in the same file, simply by setting 'filetype'
equal to "jnl.txtfmt". The result is that things like journal entry
headers (as well the simple markup understood by the jnl syntax) are
highlighted automatically, but extra highlighting (e.g,. fg/bg colors,
bold, underline, italic, etc...) can be added as desired with Txtfmt.
This synergy is certainly not limited to Txtfmt and Jnl. Others have
written plugins for working with text, which can be integrated with
Txtfmt in a similar way:

Notes (lightweight note taker by Hari Krishna Dara)
ywchaos (journal taking and diary making by Yue Wu)
txt (plain text browser by Yongping Guo)
TVO (The Vim Outliner by Ned Konz)
etc...

If I had known about some of the above (or in some cases, if they had
existed) when I wrote the Jnl plugin, I might have used one of them
instead of writing my own. The point here is not that my solution is
right for everyone, but that Vim can be made to do just about whatever
you like. Figure out what your requirements are, and craft a tailored
solution. The solution could rely upon tools you write yourself, tools
written by other Vim users, or some combination of the two.

One other example of Vim's usefulness for text applications occurs to
me... Several years ago, I was writing the script for a sort of radio
drama I was producing with my children. I created a syntax file that
provided highlighting for various things: scene numbering, scene
descriptions, character names, sound effect cues, etc... I also created
a filetype plugin that facilitated, among other things, making the
recordings of the voice parts by bringing up a recorder application to
record the speaking part under the cursor and ensuring that the
resulting .wav file was saved to a file whose name could be derived from
scene, speaker, and position within the scene. This plugin saved me a
great deal of time and frustration during recording sessions, allowing
me to focus entirely on the (easily distracted) children playing the
parts rather than on the mundane and repetitive logistics of recording.

Hope this helps...

Brett Stahlman

>
>
> Anthony
>

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: