Syntastic: Unknown function: SyntasticStatuslineFlag

Created on 18 Oct 2015  路  5Comments  路  Source: vim-syntastic/syntastic

I'm unable to use the awesomeness that is Syntastic because of this error. My vim install is fine according to the requirements, so I'm kind of at a loss about what my issue is.

Error messages:

E117: Unknown function: SyntasticStatuslineFlag
Press ENTER or type command to continue
E15: Invalid expression: SyntasticStatuslineFlag()
Press ENTER or type command to continue

My .vimrc:

"NeoBundle Scripts-----------------------------
if has('vim_starting')
  if &compatible
    set nocompatible               " Be iMproved
  endif

  " Required:
  set runtimepath+=~/.vim/bundle/neobundle.vim/
endif

" Required:
call neobundle#begin(expand('/home/ronnie/.vim/bundle'))

" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'

" Add or remove your Bundles here:
NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'ctrlpvim/ctrlp.vim'
NeoBundle 'flazz/vim-colorschemes'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'digitaltoad/vim-jade'

" You can specify revision/branch/tag.
NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }

" Required:

call neobundle#end()



" Required:
filetype plugin indent on

NeoBundleLazy 'jelera/vim-javascript-syntax', {'autoload':{'filetypes':['javascript']}}
NeoBundleLazy 'pangloss/vim-javascript', {'autoload':{'filetypes':['javascript']}}
NeoBundleLazy 'nathanaelkane/vim-indent-guides', {'autoload':{'filetypes':['javascript']}}
NeoBundleLazy 'Raimondi/delimitMate', {'autoload':{'filetypes':['javascript']}}



" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"End NeoBundle Scripts-------------------------
au BufNewFile,BufReadPost *.jade set filetype=jade
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

" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

imap <C-c> <CR><Esc>O

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
set t_Co=256
colorscheme distinguished
syntax on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
  filetype plugin indent on
endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set backspace=indent,eol,start "Backspace fix
set showcmd             " Show (partial) command in status line.
set showmatch           " Show matching brackets.
set ignorecase          " Do case insensitive matching
set smartcase           " Do smart case matching
set incsearch           " Incremental search
set autowrite           " Automatically save before commands like :next and :make
set hidden             " Hide buffers when they are abandoned
"set mouse=a            " Enable mouse usage (all modes)
set number
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
set tabstop=4
set shiftwidth=4
set expandtab

" Put plugins and dictionaries in this dir (also on Windows)
let vimDir = '$HOME/.vim'
let &runtimepath.=','.vimDir

" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
    let myUndoDir = expand(vimDir . '/undodir')
    " Create dirs
    call system('mkdir ' . vimDir)
    call system('mkdir ' . myUndoDir)
    let &undodir = myUndoDir
    set undofile
endif

func Backspace()
  if col('.') == 1
    if line('.')  != 1
      return  "\<ESC>kA\<Del>"
    else
      return ""
    endif
  else
    return "\<Left>\<Del>"
  endif
endfunc

Most helpful comment

I had this problem after moving my .vimrc to a different machine. Removed the following line: set laststatus=2 fixed it.

All 5 comments

Your installation is broken: syntastic is not yet loaded at the time Vim gets to see the set statusline line. This is not a problem with syntastic. It might be a bug in NeoBundle (perhaps related to lazy loading), a problem in your vimrc, or something else entirely. You could try to debug it by adding set runtimepath just before set statusline+=%{SyntasticStatuslineFlag()} and looking at the output (syntastic should be listed there).

I see this is closed however I ran into this problem and the solution was to make sure powerline-status was installed. YMMV..

@edrolo-paulm Then your installation is broken even worse. As noted in the manual, you aren't supposed to add set statusline+=... to your vimrc if you're using powerline:

Please note that __these settings might conflict with other Vim plugins that change the way 'statusline' works__. Refer to the syntastic-compatibility notes below and to the respective plugins' documentation for possible solutions.

In particular see syntastic-airline below if you're using the "airline" Vim plugin (https://github.com/vim-airline/vim-airline). See syntastic-flagship if you're using "flagship" (https://github.com/tpope/vim-flagship). See also syntastic-powerline if you're using the "powerline" Vim plugin (https://github.com/powerline/powerline).

I had this problem after moving my .vimrc to a different machine. Removed the following line: set laststatus=2 fixed it.

Disregard my last comment. My .vim/bundle directory got blown away during some git hiccup.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HabbaRazzer picture HabbaRazzer  路  5Comments

noprompt picture noprompt  路  5Comments

ErikBjare picture ErikBjare  路  3Comments

zoecarver picture zoecarver  路  8Comments

lemeb picture lemeb  路  6Comments