Saturday, August 25, 2012

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

Still nothing is shown on the status bar.

Can't we create a function named Toogletw() and call it on this mapping?

On 8/25/12, Paul Isambert <zappathustra@free.fr> wrote:
> Santosh Kumar <sntshkmr60@gmail.com> a écrit:
>>
>> 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).
>
> Try this:
>
> :nnoremap <silent> tw :exe "set textwidth=" . (&tw ? 0 : 78)<CR> <Bar>
> :echo "textwidth=" . &tw<CR>
>
> Best,
> Paul
>
> --
> 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
>

--
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: