Saturday, November 28, 2009

Re: Feature request: change settings using ncurses menus (TUI)

On 04/11/09 08:40, Gary Johnson wrote:
>
> On 2009-11-04, James Vega wrote:
>> On Tue, Nov 03, 2009 at 11:02:38PM -0800, Gary Johnson wrote:
>>> On 2009-11-04, Parker Jones wrote:
>>>> Recently, I wanted to change the syntax highlighting language, but even after
>>>> spending 15 minutes reading the documentation I got fed up and gave up. It
>>>> really shouldn't be that hard. A menu-driven interface could solve this by
>>>> just letting the user pick out settings from a list and likewise choose from
>>>> possible values.
>>>
>>> I don't see how a menu-driven interface will help with this.
>>> Writing syntax highlighting rules is more akin to writing a program
>>> than it is to choosing option settings.
>>
>> I think this is referring to changing the filetype for a buffer, not
>> changing the syntax highlighting rules.
>
> OH. I see now. Thanks.
>
> If that's the case, then executing
>
> :set ft=<filetype>
>
> where the set of<filetype> values can be found from
>
> :!ls $VIMRUNTIME/syntax
>
> seems pretty simple to me. Yes, I realize that's not nearly as
> clear and straightforward as selecting the file type from a menu,
> but a user should very rarely need to select the file type manually;
> Vim should almost always be able to determine the file type
> automatically.
>
> If Vim is not able to determine the correct file type automatically,
> the proper solution is to give it better guidance in the user's
> ~/.vim/filetype.vim, not require the user to set the file type
> manually every time he opens such a file.
>
> Regards,
> Gary

I thought the OP _was_ referring to constructing a syntax script, which
is indeed a kind of programming and would IMHO not benefit at all from a
menu-driven interface.

However, if the matter is merely choosing among the existing "known"
filetypes, then there _is_ a menu, however you must first enable it by
using "Syntax => Show filetypes in menu". Then you get a menu for
setting the 'syntax' option. Experiment shows that it also sets the
filetype, e.g., after you've added the filetypes to the Syntax menu,
clicking "Syntax => A => Aap" sets both 'filetype' and 'syntax' to "aap".

In Console Vim, it is possible to use the same menus as in gvim,
provided that your Console Vim is compiled with +menu. They look
slightly different because of the differences between a text interface
and a GUI; and they are at bottom rather than at top. See ":help
console-menus" about how to enable them in your vimrc.

I agree that automatic setting of filetypes is the Vim-like way to go.
Some filetypes are so similar that user guidance (I mean, guidance
_from_ the user _to_ filetype.vim) can help discriminate among them.
This can be done either by means of global options, or of modelines,
depending on the particular circumstances. For details, see:
:help filetype.txt
:help syntax.txt

Best regards,
Tony.
--
More than any time in history, mankind now faces a crossroads. One
path leads to despair and utter hopelessness, the other to total
extinction. Let us pray that we have the wisdom to choose correctly.
-- Woody Allen

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment