Jump to content

vim/gvim syntax highlighting


Steve Scrimpshire
 Share

Recommended Posts

I code alot in Perl and PHP and I do not like the syntax highlighting for them. The bright green and yellow do not show up well against the white page bg. I understand that I could write my own syntax file, but I believe that's a little over my head right now. In the meantime, is there a way that I could have gvim start up in elflord color scheme each time (the syntax shows up well against a black page bg)? I cannot find an rc file to edit to allow that or anything in the toolbar to save settings. At least maybe a command line switch to have it start up in that color scheme. I've read all kinds of docs and if it's in there, I've overlooked it. TIA

Link to comment
Share on other sites

Hmmmmm...I have gvim in my toolbar in Gnome and I added the command line switch to the command to start it (using "Properties"), but when I booted into Windows and back, it was reverted back to its original state. Can I avoid that?

Link to comment
Share on other sites

Where do you see a properties option? I don't see that when>gvim --help.

I copied /usr/share/vim/gvimrc_example.vim ~/.gvimrc, then copied and pasted the elford.vim settings in to it after " ing out the default. Well I kept the examples

highlight Cursor guibg=Green guifg=NONE

 

" out elfords

"hi Normal guifg=cyan guibg=black (I hate cyan)

 

and changed the font

set guifont=-dec-terminal-medium-r-normal-*-*-140-*-*-c-*-iso8859-1

 

my ~/.gvimrc

" Make external commands work through a pipe instead of a pseudo-tty

"set noguipty



" set the X11 font to use

" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1

" font 4 -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1

set guifont=-dec-terminal-medium-r-normal-*-*-140-*-*-c-*-iso8859-1



"set ch=2  " Make command line two lines high



"set mousehide  " Hide the mouse when typing text



" Make shift-insert work like in Xterm

"map <S-Insert> <MiddleMouse>

"map! <S-Insert> <MiddleMouse>



" Only do this for Vim version 5.0 and later.

if version >= 500



 " I like highlighting strings inside C comments

 " let c_comment_strings=1



 " Switch on syntax highlighting if it wasn't on yet.

 if !exists("syntax_on")

   syntax on

 endif



 " Switch on search pattern highlighting.

 set hlsearch

 

 " Set nice colors

 " background for normal text is light grey

 " Text below the last line is darker grey

 " Cursor is green, Cyan when ":lmap" mappings are active

 " Constants are not underlined but have a slightly lighter background

" highlight Normal guibg=grey90

 highlight Cursor guibg=Green guifg=NONE

" highlight lCursor guibg=Cyan guifg=NONE

" highlight NonText guibg=grey80

" highlight Constant gui=NONE guibg=grey95

" highlight Special gui=NONE guibg=grey95

" 

let g:colors_name = "elflord"

"hi Normal  guifg=cyan 	 guibg=black

hi Comment	term=bold  ctermfg=DarkCyan  guifg=#80a0ff

hi Constant	term=underline	ctermfg=Magenta  guifg=Magenta

hi Special	term=bold  ctermfg=DarkMagenta	guifg=Red

hi Identifier term=underline	cterm=bold 	 ctermfg=Cyan guifg=#40ffff

hi Statement term=bold  ctermfg=Yellow gui=bold	guifg=#aa4444

hi PreProc	term=underline	ctermfg=LightBlue	guifg=#ff80ff

hi Type	term=underline  ctermfg=LightGreen	guifg=#60ff60 gui=bold

hi Function	term=bold  ctermfg=White guifg=White

hi Repeat	term=underline	ctermfg=White  guifg=white

hi Operator    ctermfg=Red 	 guifg=Red

hi Ignore    ctermfg=black  guifg=bg

hi Error	term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White

hi Todo	term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow



" Common groups that link to default highlighting.

" You can specify other highlighting easily.

hi link String	Constant

hi link Character	Constant

hi link Number	Constant

hi link Boolean	Constant

hi link Float  Number

hi link Conditional	Repeat

hi link Label  Statement

hi link Keyword	Statement

hi link Exception	Statement

hi link Include	PreProc

hi link Define	PreProc

hi link Macro  PreProc

hi link PreCondit	PreProc

hi link StorageClass	Type

hi link Structure	Type

hi link Typedef	Type

hi link Tag  Special

hi link SpecialChar	Special

hi link Delimiter	Special

hi link SpecialComment Special

hi link Debug  Special



endif

Link to comment
Share on other sites

demi-OT question:

 

which advantages do you see of using gvim over plain text vim in a xterm? I'm asking this because you all seem to use gvim, and I find it a little overbloated and much less flexible for experienced users like you. I'm not trying to be convinced by any means in that gvim is much better than (text-)vim, I'm just interested in hearing your reasons to use it and your experiences.

Link to comment
Share on other sites

uuuhhh....because there's still some commands I've never bothered to learn in vim, and gvim has them all in the toolbar. :oops: I know if I'd take some time and force myself to learn more vi/vim, I wouldn't be using gvim :wink:

 

For the simple, open>edit>and close operations I do use vim. If I'm doing a lot of moving around the fs it's faster for a slow typer like me to use open dialogs than typing everything.

 

Not all of us eat bash at every meal :lol: I'm just a midnight snacker :roll:

Link to comment
Share on other sites

Hmmmmm...I have gvim in my toolbar in Gnome and I added the command line switch to the command to start it (using "Properties"), but when I booted into Windows and back, it was reverted back to its original state. Can I avoid that?

 

i figured out how to set the color scheme in .gvimrc. just add the line:

colorscheme elflord

substitute elflord for whatever scheme you want, of course

which advantages do you see of using gvim over plain text vim

as bvc said, you don't have to remember every command because there's a toolbar and menu. also, i turn off word wrapping in the gui and that makes things much easier to read

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...