nordtheme / vim

An arctic, north-bluish clean and elegant Vim theme.
https://www.nordtheme.com/ports/vim
MIT License
2.52k stars 274 forks source link

Error while loading in terminal #4

Closed kamwitsta closed 7 years ago

kamwitsta commented 7 years ago

The theme is great but when I run it in Gnome Terminal 3.22.1, I get this:

Error detected while processing function <SNR>50_hi: line 17: E254: Cannot allocate colour 1 E254: Cannot allocate colour 3 E254: Cannot allocate colour 7 E254: Cannot allocate colour 15

The theme seems to load nonetheless. I suppose it might be about the guisp parameter.

arcticicestudio commented 7 years ago

Thanks for your report. Which OS and Vim version are you running? In which mode (terminal/GUI) does the error occur?

I was not able to reproduce this for both modes, Vim starts without errors using version 8.0.0086.

ghost commented 7 years ago

The same here. I am using vim-8.0.0134 under MacVim GUI on macOS. After this error I am able to press enter and theme loads, except lightline.vim still has default colors.

PS @arcticicestudio could you please share your vim/OS specs and .vimrc? I'd like to get the same look for myself ๐Ÿ˜

arcticicestudio commented 7 years ago

I was able to reproduce it now too. I'm on Arch Linux running the normal vim package which has different compile flags than the gvim package. I had no errors with the default vim package, but the gvim package raised the errors listed above. I checked the documentation of the flags and it seems like the gvim package is more verbose when it comes to logging. The default vim package suppresses the errors and ignores malformed code, while the gvim package logs it to the user and ignores the malformed code when the user presses a key.

In the end it turned out this is a bug in the Nord Vim theme file. As mentioned by @kamwitsta, the guisp attribute had the wrong color codes. The four Spell* attributes where set to use *_term- instead of *_gui color variables for the undercurl style.

I'll release a patch version to fix this.

@ipelekhan Thanks for your help too. I checked the homebrew build script for the MacVim package quickly and hope this will fix it on macOS too. I'll post all relevant .vimrc configs after fixing this issue. You can check out my whole config in my dotfile repo as soon as I clean up the code mess ๐Ÿ˜„

arcticicestudio commented 7 years ago

I've released version 0.1.1 to fix this issue. If you've installed Nord Vim via vim-plug you can easily update via :PlugUpdate.

@ipelekhan Here are all relevant configs which affect the appearance of my Vim setup.

Base configs

set nocompatible
filetype plugin on
filetype indent on
syntax enable

UI configs

set wildmenu
set noshowmode
set number

set ruler
set showmatch
set list

set colorcolumn=160
set cursorline
set guicursor=n-i-v-c-a:iCursor

set laststatus=2

set hlsearch
set incsearch
set smartcase

set magic

set gfn=Source\ Code\ Pro\ Regular\ 8
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
set guicursor=a:ver25-Cursor/lCursor

colorscheme nord

Plugins

call plug#begin(expand('~/.vim/plugged'))
Plug 'scrooloose/nerdtree'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'Yggdroot/indentLine'
Plug 'itchyny/lightline.vim'
Plug 'pangloss/vim-javascript'
Plug 'gorodinskiy/vim-coloresque'
Plug 'arcticicestudio/nord-vim'
call plug#end()

GitGutter configuration

let g:gitgutter_sign_column_always = 1
let g:gitgutter_realtime = 1
let g:gitgutter_eager = 1
set updatetime=250

pangloss/vim-javascript configuration

let g:javascript_enable_domhtmlcss = 1

lightline.vim configuration

let g:lightline = {
      \ 'colorscheme': 'nord',
      \ 'active': {
      \   'left': [
      \     [ 'mode', 'paste' ],
      \     [ 'fugitive', 'filename' ]
      \   ]
      \ },
      \ 'component_function': {
      \   'fugitive': 'LightlineFugitive',
      \   'readonly': 'LightlineReadonly',
      \   'modified': 'LightlineModified',
      \   'filename': 'LightlineFilename'
      \ },
      \ 'separator': {
      \   'left': '๎‚ฐ',
      \   'right': '๎‚ฒ'
      \ },
      \ 'subseparator': {
      \   'left': '๎‚ฑ',
      \   'right': '๎‚ณ'
      \ }
    \ }

function! LightlineModified()
  if &filetype == "help"
    return ""
  elseif &modified
    return "+"
  elseif &modifiable
    return ""
  else
    return ""
  endif
endfunction

function! LightlineReadonly()
  if &filetype == "help"
    return ""
  elseif &readonly
    return "โญค"
  else
    return ""
  endif
endfunction

function! LightlineFugitive()
  if exists("*fugitive#head")
    let branch = fugitive#head()
    return branch !=# '' ? '๎‚  '.branch : ''
  endif
  return ''
endfunction

function! LightlineFilename()
  return ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
       \ ('' != expand('%:t') ? expand('%:t') : '[No Name]') .
       \ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
endfunction
ghost commented 7 years ago

Thanks for the update. I can confirm that there are no errors either in iTerm terminal or MacVim gui app now. For some reason on my Mac set colorscheme nord takes no effect in MacVim and by default colorscheme is set to MacVim's default, but adding this line helps:

let macvim_skip_colorscheme=1

@arcticicestudio, thanks a lot for your work! Nord theme for vim is so awesome, so I can finally switch to vim from atom permanently ๐Ÿ˜Ž Let me ask you a one more question, could you share your listchars config? Or please give some hints how to make vim to show those invisible spaces as dots? I have googled some solutions, but all of them were far from what I saw on your screenshots. Thanks in advance!

arcticicestudio commented 7 years ago

Thanks, nice to hear you like it ๐Ÿ˜„ Good to know that there are small differences between vim and MacVim, I'll add it to the "Activation" section of the README.

And here's my listchars:

set listchars=eol:ยฌ,space:ยท,tab:ยป\
kamwitsta commented 7 years ago

I confirm the theme loads correctly now. Thanks for the great work!