shapeoflambda / dark-purple.vim

Port of the dark purple intellij theme
MIT License
16 stars 7 forks source link

Errors with Lightline #2

Closed binaryronin closed 4 years ago

binaryronin commented 5 years ago

Neovim 0.3.7-3 Lightline: lastest Master branch

Getting this error when starting NeoVim with the dark-purple theme.

Error detected while processing /home/pritchard/.vim/pack/minpac/start/dark-purple.vim/colors/dark_purple.vim:
line  175:
E117: Unknown function: lightline#colorscheme#flatten
E15: Invalid expression: lightline#colorscheme#flatten(s:p)
shapeoflambda commented 5 years ago

There was a related fix, are you trying with the latest version of the theme? Also, please heck the order in which lightline and theme are loaded in the right order.

Edit: adding a minimum working example .vimrc

call plug#begin('~/.vim/plugged')

Plug 'shapeoflambda/dark-purple.vim'
Plug 'itchyny/lightline.vim'

call plug#end()

syntax enable
set termguicolors

" Always show lightline
set laststatus=2
let g:lightline = {
      \ 'colorscheme': 'dark_purple',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ],
      \             ['readonly', 'filename', 'modified' ] ],
      \   'right': [ [ 'lineinfo' ],
      \              [ 'filetype' ],
      \              [ 'gitbranch'] ]
      \ },
      \ 'component_function': {
      \   'gitbranch': 'fugitive#head'
      \ },
      \ }
colorscheme dark_purple

Using vim plug is not required, but make sure lightline is loaded after dark-purple theme. In case you didn't know this already, this can be verified using :set rtp?

binaryronin commented 5 years ago

Still getting errors even after updating everything. Here is my .vimrc


" General configurations
set mouse-=a
syntax on
set nocompatible
set backspace=indent,eol,start
set history=100
set ruler
set encoding=utf-8
set number
filetype plugin indent on
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath

" Set up global undo the persists between sessions
set undofile
set undodir=~/.local/share/nvim/undo

" Use new minpac to manage packages in Vim8 / NeoVim
packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('tmhedberg/SimpylFold')
call minpac#add('vim-scripts/indentpython.vim')
call minpac#add('airblade/vim-gitgutter')
call minpac#add('tpope/vim-fugitive')
call minpac#add('scrooloose/nerdtree')
call minpac#add('hashivim/vim-terraform')
call minpac#add('jiangmiao/auto-pairs')
call minpac#add('cespare/vim-toml')
call minpac#add('junegunn/fzf')
call minpac#add('w0rp/ale')
call minpac#add('itchyny/lightline.vim')
call minpac#add('mgee/lightline-bufferline')
call minpac#add('hdima/python-syntax')
call minpac#add('arcticicestudio/nord-vim')
call minpac#add('shapeoflambda/dark-purple.vim')
call minpac#add('pearofducks/ansible-vim')
call minpac#add('martinda/Jenkinsfile-vim-syntax')

" Define the fuction to install both CoC and the plugins we want
let s:coc_extensions = [
    \ 'coc-json',
    \ 'coc-pyls',
    \ 'coc-yaml'
    \ ]

function! s:coc_plugins(hooktype, name) abort
    execute 'packadd ' . a:name
    call coc#util#install()
    call coc#util#install_extension(join(get(s:, 'coc_extensions', [])))
endfunction

call minpac#add('neoclide/coc.nvim', {'do': function('s:coc_plugins')})

" Simplify the commands for minpac
command! PackUpdate call minpac#update()
command! PackClean call minpac#clean()
command! PackStatus call minpac#status()

" Enable folding
set foldmethod=indent
set foldlevel=99

" Enable folding with the spacebar
nnoremap <space> za

" Vim GitGutter options
set updatetime=250

" lightline options
set noshowmode
set laststatus=2
let g:lightline = {
      \ 'colorscheme': 'dark_purple',
      \ 'active': {
      \   'left': [ [ 'mode', 'paste' ], [ 'gitgutter' ],
      \             [ 'readonly', 'filename', 'modified' ] ],
      \   'right': [ [ 'lineinfo' ], ['percent'], 
      \              [ 'gitbranch', 'fileencoding', 'filetype' ] ]
      \ },
      \ 'component_function': {
      \   'gitbranch': 'fugitive#head',
      \   'gitgutter': 'Gitchanges'
      \ },
      \ }

" Gitgutter integration for lightline
function! Gitchanges()
  if ! exists('*GitGutterGetHunkSummary')
        \ || ! get(g:, 'gitgutter_enabled', 0)
        \ || winwidth('.') <= 90
    return ''
  endif
  let symbols = [
        \ g:gitgutter_sign_added . ' ',
        \ g:gitgutter_sign_modified . ' ',
        \ g:gitgutter_sign_removed . ' '
        \ ]
  let hunks = GitGutterGetHunkSummary()
  let ret = []
  for i in [0, 1, 2]
    if hunks[i] > 0
      call add(ret, symbols[i] . hunks[i])
    endif
  endfor
  return join(ret, ' ')
endfunction

" lightline bufferline options
set showtabline=2
let g:lightline#bufferline#show_number  = 0
let g:lightline#bufferline#unnamed      = '[No Name]'

let g:lightline.tabline          = {'left': [['buffers']], 'right': [['close']]}
let g:lightline.component_expand = {'buffers': 'lightline#bufferline#buffers'}
let g:lightline.component_type   = {'buffers': 'tabsel'}

" Remap Nerdtree open
map <C-x> :NERDTreeToggle<CR>

" Remap moving between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

" colorscheme
set termguicolors
colorscheme dark_purple

" switching buffers
nnoremap <Tab> :bnext<CR>

" better python syntax highlighting
let g:python_highlight_all = 1

"""Spellcheck
" Creates a spellcheck mode, akin to word and the like 
" instead of having weird-ass bindings like [s to find
" the next one and keeps annoying spellcheck highlighting
" off your screen when you don't care about it
function! MySpellCheck ()

    if &spell
        set spell!
        unmap <buffer> n
        unmap <buffer> N
        unmap <buffer> s
        unmap <buffer> a
        unmap <buffer> y
        nnoremap <buffer> y "+y
        unmap <buffer> l
    else
        set spell
        nnoremap <buffer> n ]s
        nnoremap <buffer> N [s
        " substitute current word
        nnoremap <buffer> s z=1
        "add to dictionary
        nnoremap <buffer> a zg
        "undo add
        nnoremap <buffer> y zug
        nnoremap <buffer> <silent> l :spellrepall <CR>
    endif

endfunction

nnoremap <silent> <F7> :call MySpellCheck() <CR>

" Remap for using C-p to open FZF
nnoremap <C-p> :<C-u>FZF<CR>

" Fix yaml spacing issues
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType yml setlocal ts=2 sts=2 sw=2 expandtab

" Fix Terraform spacing issues
autocmd FileType tf setlocal ts=2 sts=2 sw=2 expandtab

" Fix HTML spaces
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab

" Fix Jenkinsfile spaces
autocmd FileType Jenkinsfile setlocal ts=2 sts=2 sw=2 expandtab
shapeoflambda commented 5 years ago

Did you check the :set rtp? output and made sure that theme is loaded before lightline?

shapeoflambda commented 4 years ago

Resolving as I didn't hear back again. Feel free to open if the issue exists.