paradigm / SkyBison

Vim plugin to expedite use of cmdline commands
73 stars 9 forks source link

Mapping SkyBison('') inserts leading space in cmdline #19

Closed jamessan closed 10 years ago

jamessan commented 10 years ago

Using :nnoremap : :<C-u>call SkyBison('')<CR> causes all ex commands to have a leading space inserted.

As an example, after setting up that map, run :ls. Then :<Up> will show : ls.

paradigm commented 10 years ago

Interesting. I'm able to reproduce that here after doing a

vim -u NONE -c "set nocp|colorscheme desert|source ~/.vim/bundle/skybison/plugin/skybison.vim|nnoremap : :<C-u>call SkyBison('')<CR>"

However, not with my default settings - apparently I've got some other setting that fixes this.

This also lead to another discovery - apparently with the default colorscheme Identifier isn't set, which SkyBison uses. I'll have to find a way to detect if the highlight option is available before using it.

I'll investigate both issues.

paradigm commented 10 years ago

Found the issue - not sure why my settings were masking it. Line 280:

let l:cmdline = l:cmdline_head.' '.l:results[0]

If l:cmdline_head is empty, that ends up prepending a space. A similar line is around line 217. I'll re-read through the code/comments to try to remember why I did that and try to get a patch up in the next few days. My guess is that it is as simple as checking to see if l:cmdline_head is empty and, if so, just using l:results[0] instead of trying to concatonate it.

paradigm commented 10 years ago

Replacing both lines line 217 and 280 with:

let l:cmdline = l:cmdline_head != "" ?  l:cmdline_head.' '.l:results[0] : l:results[0]

Seems to work just fine.

paradigm commented 10 years ago

Fixed in 1bc37a87a2517c57d9421e06a6dbf974b73d9238