Article View: news.software.readers
Article #138205[vim] different startups with cursor placement (was: [slrn] using vim)
From: Sven Guckes
Date: Tue, 25 Nov 2003 22:44
Date: Tue, 25 Nov 2003 22:44
115 lines
5255 bytes
5255 bytes
* Mike Vanecek <MikeV99@privacy.net>:
> On Tue, 25 Nov 2003 15:16:46 +0100, Tobias Mummert wrote:
>> set post_editor_command "vim -c '/^-- $/-'"
>
> Yes it works!! Places the cursor at the line just above the signature space.
>
> FYI, here is what I now have [in the] .slrnrc:
> set editor_command "gvim -geometry 106x42+10+10 %s +%d -c '+/^$/+'"
> set mail_editor_command "gvim -f -geometry 106x42+10+10 '+set tw=72' +%d '%s'"
> set post_editor_command "gvim -f -geometry 106x42+10+10 '+set tw=78' -c '/^-- $/-'"
> set score_editor_command "gvim -f -geometry 106x42+10+10 '+set tw=72' +%d '%s'"
>
> ..
> I understand the -f and -geometry. The set tw=78 sets
> the text width to 78 for the current edit session. If I
> understand it correctly, it could also have been written as
> -c 'set tw=78' since the + and -c means execute a command?
not quite. compare:
$ vim --help | grep -- -c
$ vim --help | grep -- +
> The command -c '/^-- $/-' says to execute a search command for
> --space, go to the end of the line, and then up one line?
no. it means this:
/ search for...
^ beginning-of-line
-- dash-dash-space
/ end of search pattern
- go back one line
so it finds the sigdashes line and then
set the cursor onto the line before.
> How does the /- tell it to go up one line?
both the search command and the '-' are "ex" commands
which are put nto the command line and executed by
the underlying editor. "man ed", "LINE EDITING".
> Also, the +%d %s options are not on the line.
> What exactly is their interpretation?
$ man slrn
/6.* editor_
6.24. editor_command
The following % escapes can be used:
%s name of the file to edit
%d number of the first line of the message body
> au BufRead ~/.followup :% s/^>[ >]*$//
> The other autocommand says whenever .followup is read into a buffer,
> search this file (:%), do a global find and replace for > starting
> at the beginning of a line, followed by either a space or another >,
> followed by either a space or another >, until the end of line;
> if match is true, replace it with nothing. Anywhere close?
yep - close enough.
% in all lines
s substitute
/ begin of search pattern
^ beginning of line
> literal greater-than character
[ >] set with space and greater-than character
* zero or more occurrances of previous set
$ end of line
/ end of search pattern and start of replace pattern
/ end of replace pattern
read aloud as:
"in all lines substitute lines starting with '>'
and followed by run of '>' and 'space' of any length
unto the end of line by nothing".
informal short description:
clear all lines containing quote characters runs, allowing spaces.
> Thank you very much for your help. Even with a Vi Editor book,
> man gvim, and online gvim help, this stuff is close to magic.
try the ":help" command - and read all of it.
read up up ":help winpos" and you should be able
to get rid of the "-geometry" in the calls
(they are the same in all cases, anyway).
this would boil down the editor calls to this:
slrnrc:
set editor_command "gvim -f +%d '%s' -c '+/^$/+'"
set mail_editor_command "gvim -f +%d '%s'"
set post_editor_command "gvim -f +%d '%s' -c '/^-- $/-'"
set score_editor_command "gvim -f +%d '%s'"
vimrc:
au FileType mail set tw=72
however, if you have a reason for making each editor command
in slrn contain a long list of startup commands then i'm sure
you have good reasons for that - whatever they might be.
but please get a clue about posting questions
about editors and editing to *comp.editors*..
Sven
--
VI SUBSTITUTION FAQ http://www.guckes.net/vi/subst.html
VI substitution command aka "search and replace": HOWTO make use of
addresses (esp line ranges), regular expressions (aka patterns), and flags.
Everyday examples with explanations. --Sven Guckes guckes(at)vi-editor.org
Technical Details
Message-ID:
<2003-11-25T21-43-37@guckes.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.editors.mbox.zip!archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!pima.hostsharing.NET!not-for-mailReferences:
<2e44pb.oq3.ln@127.0.0.1> <slrnbrbpoa.26n.teergrube@doczook.de> <gs3l81-jp7.ln1@news.invalid.99computer> <slrnbrhb5p.15c.teergrube@doczook.de> <bfd791-6td.ln1@news.invalid.99computer> <slrnbs6p2e.1rm.teergrube@doczook.de> <87rc91-pmv.ln1@news.invalid.99computer>Show Full Headers
Complete Article Headers
Message-ID: <2003-11-25T21-43-37@guckes.net> Subject: [vim] different startups with cursor placement (was: [slrn] using vim) Date: Tue, 25 Nov 2003 22:44:02 +0000 From: Sven Guckes <usenet@guckes.net> References: <2e44pb.oq3.ln@127.0.0.1> <slrnbrbpoa.26n.teergrube@doczook.de> <gs3l81-jp7.ln1@news.invalid.99computer> <slrnbrhb5p.15c.teergrube@doczook.de> <bfd791-6td.ln1@news.invalid.99computer> <slrnbs6p2e.1rm.teergrube@doczook.de> <87rc91-pmv.ln1@news.invalid.99computer> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.editors.mbox.zip!archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!pima.hostsharing.NET!not-for-mail Newsgroups: news.software.readers,comp.editors Followup-To: comp.editors Lines: 114 Reply-To: Sven Guckes <usenet-reply@guckes.net> NNTP-Posting-Host: pima.hostsharing.net (212.42.230.40) X-Trace: news.uni-berlin.de 1069800242 65139582 212.42.230.40 ([44059]) Mail-Copies-To: guckes-usenet-cc@guckes.net User-Agent: slrn/0.9.7.4 (Linux)