On 31/03/13 17:24, Dotan Cohen wrote:
> On Sat, Mar 23, 2013 at 12:58 AM, Paul Isambert <zappathustra@free.fr> wrote:
>>> I notice that some settings use the format ':set name=value' and other
>>> use ':name value'. For instance:
>>> :set syntax=php
>>> :syntax off
>>
>> Note that ":syntax php" doesn't work.
>>
>>> Can the string 'set ' always be safely elided?
>>
>> No.
>>
>>> If not, then what are the guidelines?
>>
>> As far as I can tell, there aren't any. Some commands have the same name as
>> options (e.g. :filetype and 'filetype', :confirm and 'confirm'), but they don't
>> do the same things.
>>
>> Best,
>> Paul
>>
>
> I notice that the following doesn't work:
> :syntax php
>
> However the following does work:
> :colorscheme desert
>
> Why is "syntax" an option yet "colorscheme" a command?
>
>
>
> --
> Dotan Cohen
>
> http://gibberish.co.il
> http://what-is-what.com
>
There is both a :syntax command and a 'syntax' option, and they are not
interchangeable: The command can be:
:syntax on
:syntax off
:syntax enable
:syntax list " with optional arguments
:syntax sync fromstart
:syntax sync clear
:syntax sync ccomment
" also other variants
:syntax sync " with no arguments: "tell me"
etc. Most of the variants of this command are for use in syntax scripts,
to define how the particular syntax of a certain filetype must be
highlighted. ":syntax on" can be used in your vimrc to enable syntax
highlighting. ":syntax sync" with no arguments and ":syntax list" are
used from the keyboard, to request information.
The 'syntax' option is something else: it defines which named syntax
applies to a given file. It can be set, usually by ":setlocal"; normally
this is done automatically as part of the FileType event handling. You
can also do it manually, for instance
:setlocal syntax=
to remove all syntax highlighting for one editfile only, until it is
reloaded.
As for the :colorscheme command, ":colorscheme foobar" is approximately
equivalent with (IIUC) ":doautocmd ColorScheme foobar | runtime
colors/foobar.vim" which is also a command. If you want to determine
which colorscheme is in use, you should check the global variable
colors_name which every properly constructed colorscheme will set to its
own filename (without the path and the .vim extension). You can do that
with ":colorscheme" with no argument, which (in a Vim with +eval
compiled-in) does something similar to ":if exists('g:colors_name') |
echo g:colors_name | else | echo 'default' | endif", another command.
Best regards,
Tony.
--
LETTERS TO THE EDITOR (The Times of London)
Dear Sir,
I am firmly opposed to the spread of microchips either to the home or
to the office. We have more than enough of them foisted upon us in
public places. They are a disgusting Americanism, and can only result
in the farmers being forced to grow smaller potatoes, which in turn
will cause massive unemployment in the already severely depressed
agricultural industry.
Yours faithfully,
Capt. Quinton D'Arcy, J. P.
Sevenoaks
--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Sunday, March 31, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment