03/05/17 19:57
>>367
とりあえず、それっぽく動くのができたよ。
inoremap <buffer> + <C-O>:call InsertSpace('+')<CR>
function! InsertSpace(chr)
let left = getline(".")[col(".")-2]
let right = getline(".")[col(".")-1]
if left == ' ' && right == ' '
execute "normal i\<C-V>".a:chr."\<Right>"
elseif left != ' ' && right != ' '
execute "normal i \<C-V>".a:chr." \<Right>"
elseif left != ' '
execute "normal i \<C-V>".a:chr."\<Right>\<Right>"
elseif right != ' '
execute "normal i\<C-V>".a:chr." \<Right>"
endif
endfunction