[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vim tip-o-rama



On Sun, May 06, 2001 at 11:03:15PM -0400, MaD dUCK wrote:
> also sprach mdevin (on Wed, 02 May 2001 03:12:19PM +1000):
> > Can you explain further how that works to someone who barely know
> > that i puts vim in insert mode and esc takes it out?  I had a look
> > at the manpage and vimtutor and I can't see how gqip works - but it
> > did work and it is cool!
> 
> i haven't heard of gqip before this, the official way of doing the
> same is gq}. at least i've been with vim pretty much since it started
> and that's how it's been...

official schmofficial.

:help v_gq

								*v_gq*
	{Visual}gq		Format the highlighted text.  (for {Visual} see
				|Visual-mode|).  {not in Vi}

	Example: To format the current paragraph use
	>	gqap

	The "gq" command leaves the cursor in the line where the
	motion command takes the cursor.  This allows you to repeat
	formatting repeated with ".".  This works well with "gqj"
	(format current and next line) and "gq}" (format until end of
	paragraph).  Note: When 'formatprg' is set, "gq" leaves the
	cursor on the first formatted line (as with using a filter
	command).

> gq is a composite command which replaces the former G, which is now
> used differently.
> the formal definition of the command is something like
> 
> gq<movement>

there's also "visual" mode where you 'v' (hilite chars) or 'V'
(hilite lines) to select first, then act (as in "gq" if you like)
just like the mac in 1984 (and ever since).

> which is typical vi(m): you specify a command, and then you move over
> the text to which you want the command applied. since } steps to the
> end of the paragraph, the entire paragraph will be gq'd. for this to
> work, you need to be at the beginning of the paragraph, something gqip
> doesn't require (yes, i want an analysis of the ip movement too).

:help v_ap

	                                *v_ap*
	ap			"a paragraph", select [count] paragraphs (see
				|paragraph|).

	                                *v_ip*
	ip			"inner paragraph", select [count] paragraphs (see
				|paragraph|).

:help v_i

	==================================================================
	6. Text object selection         *object-select* *text-objects*
	                                 *v_a* *v_i*

	This is a series of commands that can only be used while in
	Visual mode or after an operator.  The commands that start
	with "a" select "a"n object including white space, the
	commands starting with "i" select an "inner" object without
	white space, or just the white space.  Thus the "inner"
	commands always select less text than the "a" commands.

> nevertheless, you can't do this with gqip:
> 
> 1GgqG
> 
> which reformats the entire document.
> 
> > Also can you give me a tip on how to make mutt with vim wrap the
> > lines at 72 chars or does everyone just press enter when the text is
> > near the side of the page?  Because I didn't on these last 3 lines
> > to see how it would look when I posted it.  Sorry if that upsets
> > people.  I normally use netscape mail but am beginning to use mutt
> > (with vim).
> 
> my relevant settings:
> 
> set nowrap
> set nolinebreak
> set textwidth=0
> set wrapmargin=10
> set wrapscan

aha. BUT the key is, how to get VIM to know when you're editing a
MUTT file... and set configs accordingly?

i'm sure there are several ways --

	#~/.muttrc
	set editor="vim -c tw=64"

or

	#~/.vimrc
	augroup mail
		au!
		autocmd BufRead,BufNewFile .letter,mutt*,nn.*,snd.* set tw=64
	augroup END

tmtowtdi, that's for sure.

--

by the way --

$ dpkg -L vim-rt | xargs grep ft=mail
/usr/share/vim/vim56/filetype.vim:au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt-*-\d\+,ae\d\+.txt
set ft=mail
/usr/share/vim/vim56/scripts.vim:  set ft=mail
/usr/share/vim/vimrc:  au BufRead reportbug.*           set ft=mail
/etc/vimrc:  au BufRead reportbug.*             set ft=mail

the mutt pattern (mutt-*-\d\+) works on new messages, but not on
'resumed' messages that have previously been postponed... (buffer
for new email via mutt is /tmp/mutt-<hostname>-#####-## but
resumed messages are just /tmp/mutt?????)

-- 
DEBIAN NEWBIE TIP #21 from Will Trillich <will@serensoft.com> 
:
Looking to configure your Debian NETWORK SETTINGS? Look at the
file /etc/network/interfaces (try "man interfaces" for more
info). Then "ifup -a" to reload your settings, and "ifconfig" to
display them. (Also check out "apt-get install ipmasq"!)

Also see http://newbieDoc.sourceForge.net/ ...



Reply to: