Closed DemarcatedTitle closed 6 years ago
This is probably happening because colorscheme onedark
is probably being run before autoload/onedark.vim
is loaded in your .vimrc
, but autoload/onedark.vim
should be loaded first.
Pasting or linking to your .vimrc
would help me confirm whether that's the case.
I feel like it's probably pretty long, but here it goes: Error still happens when colo set at very bottom
let g:syntastic_javascript_checkers = ['eslint']
"HTML vs html matters
" let g:syntastic_html_checkers= ['jshint']
let g:syntastic_html_checkers= ['eslint']
let g:syntastic_json_checkers = ['jsonlint']
if $SHELL =~ 'bin/fish'
set shell=/bin/sh
endif
set term=xterm-256color
" let g:ycm_path_to_python_interpreter = '/usr/bin/python'
"***
set foldmethod=marker
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
"
" " Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
" Move to the next buffer
nmap <leader>l :bnext<CR>
" " Move to the previous buffer
nmap <leader>h :bprevious<CR>
" " Move to the previous buffer
nmap <leader>q :bd<CR>
let NERDTreeQuitOnOpen=1
set t_Co=256
highlight normal ctermbg=none
"Backup settings for mucomplete
set completeopt+=menuone
"************************
" let g:mucomplete#enable_auto_at_startup = 1
" ^This might be kind of unusable. Typing is slooooow if i'm just writing a
" basic comment.
" set complete-=i
" set complete-=t
let g:mucomplete#chains = { 'default' : ['file', 'ulti','omni'] }
set noshowmode shortmess+=c
set completeopt-=preview
set completeopt+=menuone,noinsert,noselect
" set completeopt+=noinsert
" set noinfercase
" let g:clang_library_path = '/usr/local/opt/llvm/lib/libclang.dylib'
" let g:clang_user_options = '-std=c++14'
" let g:clang_complete_auto = 1
" let g:mucomplete#enable_auto_at_startup = 1
"
" From Sam's vimrc************************************
set smartindent
set autoindent
set autoread " reload files when changed on disk, i.e. via `git checkout`
set backspace=2 " Fix broken backspace in some setups
set backupcopy=yes " see :help crontab
set clipboard=unnamed " yank and paste with the system clipboard
set directory-=. " don't store swapfiles in the current directory
set encoding=utf-8
set ignorecase " case-insensitive search
set incsearch " search as you type
set laststatus=2 " always show statusline
set list " show trailing whitespace
set listchars=tab:▸\
" ,trail:▫
set number " show line numbers
set ruler " show where you are
set scrolloff=3 " show context above/below cursorline
set showcmd
set smartcase " case-sensitive search if any caps
set tabstop=8 " actual tabs occupy 8 characters
set wildignore=log/**,node_modules/**,target/**,tmp/**,*.rbc
set wildmenu " show a navigable menu for tab completion
set wildmode=longest,list,full
" set noexpandtab
" set shiftwidth=2
" set softtabstop=2
set shiftwidth=4
set softtabstop=4
" From Sam's vimrc^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
autocmd BufRead,BufNewFile *.wiki setlocal spell
set fdm=marker
set nocompatible
filetype plugin on
au FileType vimwiki set textwidth=80
au FileType python set formatoptions=croql
command! -nargs=+ NewGrep execute 'silent grep! -m 1 -r <args>' | copen 10
set runtimepath^=~/.vim/bundle/ctrlp.vim
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/node_modules/*
" :g//#
" ^ when typed and executed, does an interesting thing that shows you the lines where your search
" query is found
" This makes leader space remove the highlight from a search
nnoremap <leader><space> :noh<cr>
nnoremap <leader>t :put =strftime('%c')<cr>
" line 111 is for transparency friendliness.
hi Normal ctermbg=none
highlight NonText ctermbg=none
" ##snippet stuff
" For ultisnips and mucomplete apparently ultisnips needs to be the up to date
" one, not the one from the vim-addon-manager package installed with apt-get
let g:UltiSnipsExpandTrigger = "<nop>"
let g:ulti_expand_or_jump_res = 0
function ExpandSnippetOrCarriageReturn()
let snippet = UltiSnips#ExpandSnippetOrJump()
if g:ulti_expand_or_jump_res > 0
return snippet
else
return "\<CR>"
endif
endfunction
inoremap <expr> <CR> pumvisible() ? "<C-R>=ExpandSnippetOrCarriageReturn()<CR>" : "\<CR>"
let g:jsx_ext_required = 0
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
autocmd FileType javascript.jsx,javascript setlocal formatprg=prettier\ --tab-width\ 4
" autocmd BufWritePre *.js :normal gggqG
nmap <leader>f gggqG
let g:neoformat_try_formatprg = 1
autocmd BufWritePre *.js Neoformat
colo codedark
syntax on
let g:onedark_termcolors=256
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
colo onedark
This is probably happening because colorscheme onedark is probably being run before autoload/onedark.vim is loaded in your .vimrc, but autoload/onedark.vim should be loaded first.
See, I thought it was some kind of race condition type of thing. I recently compiled vim 8 on this machine and I know they made some changes, particularly regarding async stuff and adding a default package management system, which I opted to use over pathogen.
packloadall
seems to be what fixes it.
I would like to add something to the readme and submit a pr if this solution seems appropriate to you.
I was unable to reproduce this issue using Vim 8.0.1175 on macOS High Sierra, installed with Homebrew, using your configuration (I commented out the syntastic statusline part of your configuration, which should not be related.)
To be clear, you have this file at ~/.vim/colors/onedark.vim
and this file at ~/.vim/autoload/onedark.vim
?
I have the repo in ~/.vim/pack/plugins/start/
and haven't ran into trouble after adding packloadall to my .vimrc
.
I see, I didn't realize you were using the Vim 8 packages mechanism instead of following the installation instructions in the README. After reading :help packages
it seems like I could make some symlinks inside the repo that make the plugin behave better as a Vim 8 package, but I couldn't get it to work; I could never get the current autoload/onedark.vim
file to load before the colorscheme attempts to call onedark#GetColors()
. There has to be a better solution than using packloadall
, but I can't figure out what it is.
I second this!
When using Vim's (new) native package management capabilities, this package/plugin spits out errors.
packloadall
seems to be a good workaround for this.
Rather than installing into pack/*/start
and having to explicitly rely on packloadall
, an alternative is to put things in pack/*/opt
. This allows the following:
packadd! onedark.vim
colorscheme onedark
@nvs I should have thought about this before. This is way better! Thanks for enlightening us!
Great solution @nvs, about to push an update to the README.
I was unable to reproduce this issue using Vim 8.0.1175 on macOS High Sierra, installed with Homebrew, using your configuration (I commented out the syntastic statusline part of your configuration, which should not be related.)
To be clear, you have this file at
~/.vim/colors/onedark.vim
and this file at~/.vim/autoload/onedark.vim
?
Thanks for this answer! I had the same problem but simply forgot to copy the autoload file. The problem was that on;y the colors/onedark.vim
was loaded.
Terminal Emulator Info
Terminal emulator(s) and their version(s) used, if applicable:
Replace this text if applicable; otherwise delete this section
Output From
vim --version
Issue Description
I start vim with colo set to one dark, it throws errors. I start it without, no errors thrown.
After vim is started, setting colo to onedark works fine.
Error detected while processing /home/author/.vim/pack/plugins/start/onedark.vim/colors/onedark.vim: line 110: E117: Unknown function: onedark#GetColors E15: Invalid expression: onedark#GetColors() line 112: E121: Undefined variable: s:colors E15: Invalid expression: s:colors.red (truncated)