Only allow ninja modes if hoon_ninja exists and is not 0.

This commit is contained in:
Philip Monk 2013-10-03 18:50:00 -07:00
parent f6db3e9200
commit 8e0dbaed41

View File

@ -18,13 +18,28 @@ if exists("*HoonIndent")
finish
endif
if exists("b:hoon_did_submode_mapping")
function! HoonIndent(lnum)
let prevlnum = prevnonblank(a:lnum-1)
if prevlnum == 0
return 0
endif
let prevl = substitute(getline(prevlnum),'::.*$','','')
let ind = indent(prevlnum)
if prevl =~ '++\s*\w*\s*$'
" luslus operator
let ind += &sw
endif
return ind
endfunction
if exists("b:hoon_did_submode_mapping") || !exists("g:hoon_ninja") || g:hoon_ninja == 0
finish
endif
let g:submode_timeout = 0
"call submode#enter_with('hoon_ninja', 'i', '', '/ninja')
call submode#enter_with('hoon_ninja', 'i', '', '//')
call submode#map('hoon_ninja', 'i', '', 'bar', '\|')
call submode#map('hoon_ninja', 'i', '', 'gal', '<')
@ -181,19 +196,3 @@ call submode#map('hoon_jnn', 'i', '', '9', 'pl')
call submode#map('hoon_jnn', 'i', '', '0', 'pr')
let b:hoon_did_submode_mapping = 1
function! HoonIndent(lnum)
let prevlnum = prevnonblank(a:lnum-1)
if prevlnum == 0
return 0
endif
let prevl = substitute(getline(prevlnum),'::.*$','','')
let ind = indent(prevlnum)
if prevl =~ '++\s*\w*\s*$'
" luslus operator
let ind += &sw
endif
return ind
endfunction