molok / vim-smartusline

Vim plugin that changes the color of the statusbar of the focused window according with the current mode (normal/insert/replace)
34 stars 1 forks source link

Error in function Smartuslinewin only on certain files #6

Closed totoUser closed 12 years ago

totoUser commented 12 years ago

I've got a problem when using smartusline which it happens only when I load certain file like for example a spell file add (this file currently contains only 2 words. And it works without problem when launching vim without a file in argument or when editing .vimrc

The error :

"~/.vim/spell/fr.utf-8.add" 2L, 28C
Error detected while processing function SmartusLineWin:
line   33:
E10: \ should be followed by /, ? or &
Press ENTER or type command to continue

Here is an excerpt of my .vimrc :

set ruler           " always show current position
set laststatus=2        " set statusline

function! MyStatusLine()
    let s = '» %t %([%M%R%H%W]%)%( ┤ %{&ft} ├ %) '
    let s .= '%{&fenc?&fenc:"none"}/%{&fileformat} '
    if &softtabstop == &shiftwidth
    let s .= 'tab:%{&softtabstop?&softtabstop:&tabstop} '
    else
    let s .= 'sts:%{&softtabstop} sw:%{&shiftwidth} tab:%{&tabstop}'
    endif
    let s .= '%='                          " right align

    if exists('b:git_dir')
    let s .= '| %{fugitive#statusline()} | '
    endif

    let s .= '%-14.(%l,%c%V%) %<%P     '   " offset

    return s
endfunction
set statusline=%!MyStatusLine()

"
" -------------
"  Smartusline
" -------------
"
let smartusline_deep_eval = 1
let smartusline_string_to_highlight = '%t'
molok commented 12 years ago

Thanks for the report, I'll look into this, but you don't really have to set smartusline_deep_eval =1 since %t is not in a %{} item

molok commented 12 years ago

Note to myself: it has to do with the escaping of the stl, use escape(new_stl, ' |') or something like that. Also, I should find out which characters need escaping, since it is not very clear right now

molok commented 12 years ago

Hey totoUser, I think I fixed this bug, but if you can still reproduce it, feel free to comment and reopen it.