Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How do I define function for toggling textwidth (and echoing along)?

Received: by 10.14.220.131 with SMTP id o3mr6960865eep.6.1345899032201;
        Sat, 25 Aug 2012 05:50:32 -0700 (PDT)
X-BeenThere: vim_use@googlegroups.com
Received: by 10.14.177.133 with SMTP id d5ls709384eem.4.gmail; Sat, 25 Aug
 2012 05:50:26 -0700 (PDT)
Received: by 10.14.178.1 with SMTP id e1mr6794282eem.7.1345899026008;
        Sat, 25 Aug 2012 05:50:26 -0700 (PDT)
Received: by 10.14.178.1 with SMTP id e1mr6794281eem.7.1345899025999;
        Sat, 25 Aug 2012 05:50:25 -0700 (PDT)
Return-Path: <zappathus...@free.fr>
Received: from smtp3-g21.free.fr (smtp3-g21.free.fr. [2a01:e0c:1:1599::12])
        by gmr-mx.google.com with ESMTP id v3si17641744eep.1.2012.08.25.05.50.25;
        Sat, 25 Aug 2012 05:50:25 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of zappathus...@free.fr designates 2a01:e0c:1:1599::12 as permitted sender) client-ip=2a01:e0c:1:1599::12;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of zappathus...@free.fr designates 2a01:e0c:1:1599::12 as permitted sender) smtp.mail=zappathus...@free.fr
Received: from attila (unknown [83.157.76.4])
	by smtp3-g21.free.fr (Postfix) with ESMTP id D4F3AA621D
	for <vim_use@googlegroups.com>; Sat, 25 Aug 2012 14:50:21 +0200 (CEST)
Content-Type: text/plain; charset=UTF-8
To: vim_use@googlegroups.com
References: <CAE7MaQYj519RO1MQa5vdHSZLnS7sC=TeZCNYgcyCLEem7Fr9ZQ@mail.gmail.com>
Date: Sat, 25 Aug 2012 14:50:20 +0200
Subject: Re: How do I define function for toggling textwidth (and echoing along)?
MIME-Version: 1.0
User-Agent: Homemade email client working with Vim, still alpha and not public.
In-Reply-To: <CAE7MaQYj519RO1MQa5vdHSZLnS7sC=TeZCNYgcyCLEem7Fr9ZQ@mail.gmail.com>
Content-Transfer-Encoding: quoted-printable
From: Paul Isambert <zappathus...@free.fr>
Message-Id: <20120825125021.D4F3AA621D@smtp3-g21.free.fr>

Santosh Kumar <sntshkm...@gmail.com> a =C3=A9crit:
> 
> By default I have textwidth set to 78:
> set textwidth=3D78
> 
> By this setting if I type more than 78 characters in a line, those
> will be moved to next line.
> I want a mapping that will toogle that textwidth to 0 (or say disable
> textwidth), so that I can type long sentences in a single line.
> 
> Currently I have this mapping:
> nnoremap <silent> <leader>tw :exe "set textwidth=3D" . (&tw ? 0 : 78)<cr>
> 
> This does the work but I don't get notified if the work has been done.
> All I want is along with toggling the setting I should be notified
> (i.e. if textwidth is zero then show textwidth=3D0 at statusline).

Try this:

  :nnoremap <silent> tw :exe "set textwidth=3D" . (&tw ? 0 : 78)<CR> <Bar> =
:echo "textwidth=3D" . &tw<CR>

Best,
Paul