Skip to content

Commit f34337a

Browse files
committed
Cleanup/cosmetics
1 parent 7dd363b commit f34337a

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

autoload/LaTeXtoUnicode.vim

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,14 @@ function! s:L2U_Setup()
88

99
" Keep track of whether LaTeX-to-Unicode is activated
1010
" (used when filetype changes)
11-
if !has_key(b:, "l2u_enabled")
12-
let b:l2u_enabled = 0
13-
endif
14-
if !has_key(b:, "l2u_autodetect_enable")
15-
let b:l2u_autodetect_enable = 1
16-
endif
17-
18-
" Did we install the L2U tab mappings?
19-
if !has_key(b:, "l2u_tab_set")
20-
let b:l2u_tab_set = 0
21-
endif
22-
if !has_key(b:, "l2u_cmdtab_set")
23-
let b:l2u_cmdtab_set = 0
24-
endif
25-
if !has_key(b:, "l2u_keymap_set")
26-
let b:l2u_keymap_set = 0
27-
endif
11+
let b:l2u_enabled = get(b:, "l2u_enabled", 0)
12+
let b:l2u_autodetect_enable = get(b:, "l2u_autodetect_enable", 1)
2813

29-
" Did we activate the L2U as-you-type substitutions?
30-
if !has_key(b:, "l2u_autosub_set")
31-
let b:l2u_autosub_set = 0
32-
endif
14+
" Did we install the L2U tab/as-you-type/keymap... mappings?
15+
let b:l2u_tab_set = get(b:, "l2u_tab_set", 0)
16+
let b:l2u_cmdtab_set = get(b:, "l2u_cmdtab_set", 0)
17+
let b:l2u_autosub_set = get(b:, "l2u_autosub_set", 0)
18+
let b:l2u_keymap_set = get(b:, "l2u_keymap_set", 0)
3319

3420
" Following are some flags used to pass information between the function which
3521
" attempts the LaTeX-to-Unicode completion and the fallback function
@@ -367,12 +353,8 @@ function! s:L2U_SetFallbackMapping(s, k)
367353
return
368354
endif
369355
let pre = '<buffer>'
370-
if mmdict["silent"]
371-
let pre = pre . '<silent>'
372-
endif
373-
if mmdict["expr"]
374-
let pre = pre . '<expr>'
375-
endif
356+
let pre = pre . (mmdict["silent"] ? '<silent>' : '')
357+
let pre = pre . (mmdict["expr"] ? '<expr>' : '')
376358
if mmdict["noremap"]
377359
let cmd = 'inoremap '
378360
else
@@ -561,8 +543,8 @@ function! s:L2U_SetTab(wait_insert_enter)
561543
endif
562544

563545
" Backup the previous completefunc (the check is probably not really needed)
564-
if get(b:, "prev_completefunc", "") != "LaTeXtoUnicode#completefunc"
565-
let b:prev_completefunc = &completefunc
546+
if get(b:, "l2u_prev_completefunc", "") != "LaTeXtoUnicode#completefunc"
547+
let b:l2u_prev_completefunc = &completefunc
566548
endif
567549
setlocal completefunc=LaTeXtoUnicode#completefunc
568550

@@ -584,7 +566,7 @@ function! s:L2U_UnsetTab()
584566
if !b:l2u_tab_set
585567
return
586568
endif
587-
exec "setlocal completefunc=" . get(b:, "prev_completefunc", "")
569+
exec "setlocal completefunc=" . get(b:, "l2u_prev_completefunc", "")
588570
iunmap <buffer> <Tab>
589571
if empty(maparg("<Tab>", "i"))
590572
call s:L2U_SetFallbackMapping(s:l2u_fallback_trigger, '<Tab>')

0 commit comments

Comments
 (0)