I'm using a custom Xdefaults file for my terminal (urxvt), and I like
how Vim looks
in the terminal.
Is there an easy way to make a colorscheme file for Gvim that makes Gvim look
like my terminal colors?
I've seen quite a few discussions on how to go from Gvim --> Terminal,
but not the other
way around.
Thanks,
--Nate
Difficult to help without a bit more detail about your context.
What color scheme - if any - are you using in the terminal?
I could be wrong, but this sounds like you could duplicate the color
scheme file, replace all instances of ctermfg and ctermbg by
respectively guifg and guibg, save the file.. and you're done (?)
Gen-Paul.
[..]
> I don't know if that's what you're asking about. I don't know how
> terminal vim interacts with the colors of urxvt, though.
I meant a _vim_ color scheme.
:h colorscheme
In particular: "For info about writing a colorscheme file .." since, to
the best of my knowledge, this is what you need to do.
What does this tell you?
:echo g:colors_name
Gen-Paul.
I'm using "moria" in Gvim. I'd like to make Gvim have the same colors as
vim does in my terminal. I don't know how to convert terminal colors
into a Gvim color scheme.
Thanks,
--Nate
In addition, when I type :echo g:colors_name in terminal vim, I get
"Undefined variable: g:colors_name", which makes sense because
g:colors_name only applies to Gvim.
--Nate
> In addition, when I type :echo g:colors_name in terminal vim, I get
> "Undefined variable: g:colors_name", which makes sense because
> g:colors_name only applies to Gvim.
Why do you think g:colors_name applies only to gvim?
g:colors_name is set when :colorscheme is executed, if the
colorscheme file is properly written. If vim says that
g:colors_name is undefined, then :colorscheme has not been executed.
Regards,
Gary
[..]
>>> What does this tell you?
>>>
>>> :echo g:colors_name
>> I'm using "moria" in Gvim. I'd like to make Gvim have the same colors as
>> vim does in my terminal. I don't know how to convert terminal colors
>> into a Gvim color scheme.
> In addition, when I type :echo g:colors_name in terminal vim, I get
> "Undefined variable: g:colors_name", which makes sense because
> g:colors_name only applies to Gvim.
No.
Type the following in terminal vim:
:colorscheme <space> <Tab>
You will be prompted for different color schemes in succession.
Select one by hitting <Enter>
Then:
:echo g:colors_name
The name of the color scheme that you selected is displayed.
My _guess_ is that you are using the "default" color scheme, which I
believe is hard-coded in vim and the trouble is that in this particular
case the colors_name global variable is not se.
I have not looked at the code, so someone correct me if that is not the
case.
So, I'm not sure where you can go from there. Maybe check if there is a
plugin that lets you dump the "default" color scheme to a colorscheme
file..?
Not sure that's even possible.
Obviously, once you have a copy of the "default" color scheme in a file,
porting it to gvim is trivial.
Otherwise, you could start terminal vim, use the :hi command to display
the current syntax highlighting settings, copy/paste them to a file, and
use these definitions to build a gvim color scheme.
Gen_Paul.
Pleas find attached the color scheme file I created manually via
copy/paste and a few substitutions + the relevant stanza of my
.Xdefaults file so all you need to do is replace my terminal color
definitions by yours.
:%s/#iiiiii/#jjjjjj/g (e.g.)
Would be nice if someone could suggest an automated solution, though.
:-/
Gen-Paul.
Guess you had manually defined Color0 to Color15 in Xdefaults?
I don't think there is an easy way to convert that into gvim scheme
unless someone had write script for it.
You may need to design a gui colorscheme file. Design your own gui
colorscheme file isn't very hard, you can start with your moria.vim and
change the colors.
It takes some time to know how to write your own colorscheme file, but
we'll be using vim in the rest of our life and I think it worth the cost.
On Mo, 31 Aug 2009, Gary Johnson wrote:
> g:colors_name is set when :colorscheme is executed, if the
> colorscheme file is properly written. If vim says that
> g:colors_name is undefined, then :colorscheme has not been executed.
>
Or the colorscheme did not set g:colors_name, which would be a bug.
(g:colors_name has to be defined by the colorscheme).
#v+
~$ grep g:colors_name ~/.vim/colors/*.vim
.vim/colors/black_angus.vim:let g:colors_name = "black_angus"
.vim/colors/cb256.vim:let g:colors_name="cb256"
.vim/colors/desert256.vim:let g:colors_name="desert256"
.vim/colors/dw_blue.vim:let g:colors_name="dw_blue"
.vim/colors/maroloccio.vim:let g:colors_name="maroloccio"
.vim/colors/peaksea.vim:let g:colors_name = expand("<sfile>:t:r")
.vim/colors/sean.vim:let g:colors_name = "sean"
.vim/colors/transparent.vim:let g:colors_name="transparent"
.vim/colors/zenburn.vim:let g:colors_name="zenburn"
#v-
regards,
Christian
Thanks Glen -- I tried your colorscheme, and it looks a lot like mine.
I'll go through the colors 1 by 1 when I have time -- in the meantime, I'll
use your colorscheme :-)
--Nate
Sorry, I meant Patrick-Gen Paul.
http://mysite.verizon.net/astronaut/vim/index.html#HICOLORS
(cutting edge)
http://vim.sourceforge.net/scripts/script.php?script_id=1081 (stable)
I used simple.vimrc:
set nocp
syn on
filetype plugin on
and the following:
vim -u simple.vimrc
:he hicolors
(place cursor atop a color) <cr>
(place cursor atop "WriteColorscheme") <cr>
(pick a name for the colorscheme)
Regards,
Chip Campbell
Well, you can probably tell that I was bored today... but here's a
port of the 16-color-terminal default colorscheme to gvim. Just
change the block of colors (the "let" lines..) to match your
terminal's colors (they're colors 0 through 15, in order, fwiw).
Hopefully gmail doesn't wrap this on me... In fact, just in case it
does, I've attached it as well - so there will be a plain text,
archivable copy in the list archives and a not-horribly-wrapped copy
in subscriber's inboxes. Sorry I can't disable wrapping ATM. :)
~Matt
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = 'sixteen'
" Change these to match your terminal!
let s:Black = '#000000'
let s:DarkBlue = '#AF0000'
let s:DarkGreen = '#00AF00'
let s:DarkCyan = '#AFAF00'
let s:DarkRed = '#00FF00'
let s:DarkMagenta = '#AF00AF'
let s:Brown = '#00AFAF'
let s:Grey = '#9A9A9A'
let s:DarkGrey = '#5F5F5F'
let s:Blue = '#D70000'
let s:Green = '#00D700'
let s:Cyan = '#D7D700'
let s:Red = '#00FF00'
let s:Magenta = '#D700D7'
let s:Yellow = '#00D7D7'
let s:White = '#D7D7D7'
" Both
exe 'hi ErrorMsg term=standout ctermbg=DarkRed guibg=' . s:DarkRed . '
ctermfg=White guifg=' . s:White
exe 'hi IncSearch term=reverse cterm=reverse gui=reverse'
exe 'hi ModeMsg term=bold cterm=bold gui=bold'
exe 'hi NonText term=bold ctermfg=Blue guifg=' . s:Blue
exe 'hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold'
exe 'hi StatusLineNC term=reverse cterm=reverse gui=reverse'
exe 'hi VertSplit term=reverse cterm=reverse gui=reverse'
exe 'hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold'
exe 'hi DiffText term=reverse cterm=bold gui=bold ctermbg=Red guibg=' . s:Red
exe 'hi PmenuThumb cterm=reverse gui=reverse'
exe 'hi PmenuSbar ctermbg=Grey guibg=' . s:Grey
exe 'hi TabLineSel term=bold cterm=bold gui=bold'
exe 'hi TabLineFill term=reverse cterm=reverse gui=reverse'
exe 'hi Cursor guibg=fg guifg=bg'
exe 'hi lCursor guibg=fg guifg=bg'
if &bg == 'light'
exe 'hi Directory term=bold ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi LineNr term=underline ctermfg=Brown guifg=' . s:Brown
exe 'hi MoreMsg term=bold ctermfg=DarkGreen guifg=' . s:DarkGreen
exe 'hi Question term=standout ctermfg=DarkGreen guifg=' . s:DarkGreen
exe 'hi Search term=reverse ctermbg=Yellow guibg=' . s:Yellow . '
ctermfg=NONE guifg=NONE'
exe 'hi SpellBad term=reverse ctermbg=Red guibg=' . s:Red
exe 'hi SpellCap term=reverse ctermbg=Blue guibg=' . s:Blue
exe 'hi SpellRare term=reverse ctermbg=Magenta guibg=' . s:Magenta
exe 'hi SpellLocal term=underline ctermbg=Cyan guibg=' . s:Cyan
exe 'hi Pmenu ctermbg=Magenta guibg=' . s:Magenta
exe 'hi PmenuSel ctermbg=Grey guibg=' . s:Grey
exe 'hi SpecialKey term=bold ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi Title term=bold ctermfg=DarkMagenta guifg=' . s:DarkMagenta
exe 'hi WarningMsg term=standout ctermfg=DarkRed guifg=' . s:DarkRed
exe 'hi WildMenu term=standout ctermbg=Yellow guibg=' . s:Yellow .
' ctermfg=Black guifg=' . s:Black
exe 'hi Folded term=standout ctermbg=Grey guibg=' . s:Grey . '
ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi FoldColumn term=standout ctermbg=Grey guibg=' . s:Grey . '
ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi SignColumn term=standout ctermbg=Grey guibg=' . s:Grey . '
ctermfg=DarkBlue guifg=' . s:DarkBlue
exe 'hi Visual term=reverse'
exe 'hi DiffAdd term=bold ctermbg=Blue guibg=' . s:Blue
exe 'hi DiffChange term=bold ctermbg=Magenta guibg=' . s:Magenta
exe 'hi DiffDelete term=bold ctermfg=Blue guifg=' . s:Blue . '
ctermbg=Cyan guibg=' . s:Cyan
exe 'hi TabLine term=underline cterm=underline gui=underline
ctermfg=Black guifg=' . s:Black . ' ctermbg=Grey guibg=' . s:Grey
exe 'hi CursorColumn term=reverse ctermbg=Grey guibg=' . s:Grey
exe 'hi CursorLine term=underline cterm=underline gui=underline'
exe 'hi MatchParen term=reverse ctermbg=Cyan guibg=' . s:Cyan
exe 'hi Normal gui=NONE'
else
exe 'hi Directory term=bold ctermfg=Cyan guifg=' . s:Cyan
exe 'hi LineNr term=underline ctermfg=Yellow guifg=' . s:Yellow
exe 'hi MoreMsg term=bold ctermfg=Green guifg=' . s:Green
exe 'hi Question term=standout ctermfg=Green guifg=' . s:Green
exe 'hi Search term=reverse ctermbg=Yellow guibg=' . s:Yellow . '
ctermfg=Black guifg=' . s:Black
exe 'hi SpecialKey term=bold ctermfg=Blue guifg=' . s:Blue
exe 'hi SpellBad term=reverse ctermbg=Red guibg=' . s:Red
exe 'hi SpellCap term=reverse ctermbg=Blue guibg=' . s:Blue
exe 'hi SpellRare term=reverse ctermbg=Magenta guibg=' . s:Magenta
exe 'hi SpellLocal term=underline ctermbg=Cyan guibg=' . s:Cyan
exe 'hi Pmenu ctermbg=Magenta guibg=' . s:Magenta
exe 'hi PmenuSel ctermbg=DarkGrey guibg=' . s:DarkGrey
exe 'hi Title term=bold ctermfg=Magenta guifg=' . s:Magenta
exe 'hi WarningMsg term=standout ctermfg=Red guifg=' . s:Red
exe 'hi WildMenu term=standout ctermbg=Yellow guibg=' . s:Yellow .
' ctermfg=Black guifg=' . s:Black
exe 'hi Folded term=standout ctermbg=DarkGrey guibg=' . s:DarkGrey
. ' ctermfg=Cyan guifg=' . s:Cyan
exe 'hi FoldColumn term=standout ctermbg=DarkGrey guibg=' .
s:DarkGrey . ' ctermfg=Cyan guifg=' . s:Cyan
exe 'hi SignColumn term=standout ctermbg=DarkGrey guibg=' .
s:DarkGrey . ' ctermfg=Cyan guifg=' . s:Cyan
exe 'hi Visual term=reverse'
exe 'hi DiffAdd term=bold ctermbg=DarkBlue guibg=' . s:DarkBlue
exe 'hi DiffChange term=bold ctermbg=DarkMagenta guibg=' . s:DarkMagenta
exe 'hi DiffDelete term=bold ctermfg=Blue guifg=' . s:Blue . '
ctermbg=DarkCyan guibg=' . s:DarkCyan
exe 'hi TabLine term=underline cterm=underline gui=underline
ctermfg=White guifg=' . s:White . ' ctermbg=DarkGrey guibg=' .
s:DarkGrey
exe 'hi CursorColumn term=reverse ctermbg=DarkGrey guibg=' . s:DarkGrey
exe 'hi CursorLine term=underline cterm=underline gui=underline'
exe 'hi MatchParen term=reverse ctermbg=DarkCyan guibg=' . s:DarkCyan
exe 'hi Normal gui=NONE'
endif
> Well, you can probably tell that I was bored today... but here's a
> port of the 16-color-terminal default colorscheme to gvim. Just
> change the block of colors (the "let" lines..) to match your
> terminal's colors (they're colors 0 through 15, in order, fwiw).
> Hopefully gmail doesn't wrap this on me... In fact, just in case it
> does, I've attached it as well - so there will be a plain text,
> archivable copy in the list archives and a not-horribly-wrapped copy
> in subscriber's inboxes. Sorry I can't disable wrapping ATM. :)
[..]
Thanks for the feedback.
Do not deride such efforts - and yours in particular. Stuff like that is
quite valuable in terms of introducing low-level vim users like myself
to vim scripting / customization.
An obvious limitation is that nobody is going to want to type in their
rrggbb's - even 16 of them.. And some folks have 256 colors terminals.
I plan to take a closer look at your port, tomorrow I hope.
:-)
Gen-Paul.