Saturday, August 25, 2012

Re: How do I define function for toggling textwidth (and echoing along)?

On Aug 25, 2012, at 8:00 PM, vim_use@googlegroups.com wrote:
> From: Santosh Kumar <sntshkmr60@gmail.com>
> Date: Aug 25 02:37PM +0530
> Url: http://groups.google.com/group/vim_use/msg/62cda81d82f8ec51
>
> By default I have textwidth set to 78:
> set textwidth=78
>
> 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=" . (&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=0 at statusline).


:help colorcolumn

Add this to your .vimrc:

set colorcolumn=+1
hi ColorColumn NONE ctermbg=Cyan

When textwidth=0 there is no colorcolumn,
otherwise it is drawn just after the textwidth.

Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment