Changing colors in netrw?

1,121 views
Skip to first unread message

François Ingelrest

unread,
Jul 2, 2008, 10:35:25 AM7/2/08
to vim...@googlegroups.com
Hi all,

Is there a way to configure colors used by netrw?

For instance, executable files are displayed using the same color as
directories, except that they have a star close to them. I would like
to change such colors, if possible.

--
François INGELREST
LCAV, I&C school
BC 364, EPFL
CH-1015 Lausanne, Switzerland

Tel. : +41 (0)21 693 12 81
E-Mail: Francois....@epfl.ch
WWW : http://fingelrest.silent-blade.org

Charles E Campbell Jr

unread,
Jul 2, 2008, 10:54:42 AM7/2/08
to vim...@googlegroups.com
François Ingelrest wrote:
> Hi all,
>
> Is there a way to configure colors used by netrw?
>
> For instance, executable files are displayed using the same color as
> directories, except that they have a star close to them. I would like
> to change such colors, if possible.
>
>

Executable files (those shown with a trailing *) are shown in the
"netrwExe->PreProc" highlighting group, and directories are shown using
the "netrwDir->Directory" highlighting group. You may change them by
specifying them as you wish in a .vim/after/syntax/netrw.vim file. Example:

hi link netrwExe Statement

As a bonus, if you have

let g:netrw_special_syntax= 1

you'll get additional highlighting of *.bak, *.gz, etc groups (see
:help g:netrw_special_syntax).

These comments are predicated on the use of netrw v125 or v126[a-e];
v126e is available from my website as

http://mysite.verizon.net/astronaut/vim/index.html#NETRW

Both of these versions require a vim that has fnameescape() and
shellescape() -- ie. vim 7.2a will do.

Regards,
Chip Campbell

François Ingelrest

unread,
Jul 3, 2008, 2:24:57 AM7/3/08
to vim...@googlegroups.com
On Wed, Jul 2, 2008 at 16:54, Charles E Campbell Jr
<drc...@campbellfamily.biz> wrote:
> Executable files (those shown with a trailing *) are shown in the
> "netrwExe->PreProc" highlighting group, and directories are shown using
> the "netrwDir->Directory" highlighting group. You may change them by
> specifying them as you wish in a .vim/after/syntax/netrw.vim file. Example:
>
> hi link netrwExe Statement
>
> As a bonus, if you have
>
> let g:netrw_special_syntax= 1
>
> you'll get additional highlighting of *.bak, *.gz, etc groups (see
> :help g:netrw_special_syntax).
>
> These comments are predicated on the use of netrw v125 or v126[a-e];
> v126e is available from my website as
>
> http://mysite.verizon.net/astronaut/vim/index.html#NETRW
>
> Both of these versions require a vim that has fnameescape() and
> shellescape() -- ie. vim 7.2a will do.

Thanks for your help !

François Ingelrest

unread,
Jul 6, 2008, 3:37:11 AM7/6/08
to vim...@googlegroups.com, drc...@campbellfamily.biz
Hi,

On Wed, Jul 2, 2008 at 16:54, Charles E Campbell Jr
<drc...@campbellfamily.biz> wrote:

> Executable files (those shown with a trailing *) are shown in the
> "netrwExe->PreProc" highlighting group, and directories are shown using
> the "netrwDir->Directory" highlighting group. You may change them by
> specifying them as you wish in a .vim/after/syntax/netrw.vim file. Example:
>
> hi link netrwExe Statement
>
> As a bonus, if you have
>
> let g:netrw_special_syntax= 1
>
> you'll get additional highlighting of *.bak, *.gz, etc groups (see
> :help g:netrw_special_syntax).
>
> These comments are predicated on the use of netrw v125 or v126[a-e];
> v126e is available from my website as
>
> http://mysite.verizon.net/astronaut/vim/index.html#NETRW
>
> Both of these versions require a vim that has fnameescape() and
> shellescape() -- ie. vim 7.2a will do.

I have another question. I've tried to set up some links in my .vimrc,
like this:

highlight link netrwVersion Comment

I know the preferred way would be to put this line in
.vim/after/syntax/netrw.vim file, but my .vimrc is small enough to
contain everything I need. Actually, putting this line in .vimrc does
not work, because (from what I understood) netrw does not use the
"default" keyword when setting the default value. From :h hi:

Using [default] is especially useful to overrule the highlighting of a
specific syntax file. For example, the C syntax file contains:
:highlight default link cComment Comment
If you like Question highlighting for C comments, put this in your vimrc file:
:highlight link cComment Question
Without the "default" in the C syntax file, the highlighting would be
overruled when the syntax file is loaded.

Would it be possible to add that keyword?

François Ingelrest

unread,
Aug 12, 2008, 3:46:24 AM8/12/08
to vim...@googlegroups.com, drc...@campbellfamily.biz
Hi,

On Sun, Jul 6, 2008 at 09:37, François Ingelrest
<francois....@gmail.com> wrote:
> I have another question. I've tried to set up some links in my .vimrc,
> like this:
>
> highlight link netrwVersion Comment
>
> I know the preferred way would be to put this line in
> .vim/after/syntax/netrw.vim file, but my .vimrc is small enough to
> contain everything I need. Actually, putting this line in .vimrc does
> not work, because (from what I understood) netrw does not use the
> "default" keyword when setting the default value. From :h hi:
>
> Using [default] is especially useful to overrule the highlighting of a
> specific syntax file. For example, the C syntax file contains:
> :highlight default link cComment Comment
> If you like Question highlighting for C comments, put this in your vimrc file:
> :highlight link cComment Question
> Without the "default" in the C syntax file, the highlighting would be
> overruled when the syntax file is loaded.
>
> Would it be possible to add that keyword?

This is just to know whether this is possible. This does not seem too
complicated and would help for integration.

Reply all
Reply to author
Forward
0 new messages