aboutsummaryrefslogtreecommitdiff
path: root/plugin/novim_mode.vim
blob: d5601b176958d056f7a2f31334bf85a879293c90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
" novim_mode.vim - 'Conventional' editor keybindings plugin
" Author:       tombh
" Version:      0.1
"
" ============================================================================

let s:save_cpo = &cpo
set cpo&vim

let s:settings = {
  \ 'use_general_app_shortcuts': 1,
  \ 'use_editor_fixes': 1,
  \ 'use_pane_controls': 1,
  \ 'use_copypasting': 1,
  \ 'use_indenting': 1,
  \ 'use_finding': 1,
  \ 'use_undoing': 1,
  \ 'use_text_tricks': 1,
  \ 'use_better_wrap_navigation': 1,
  \ 'use_shortcuts': 1
\}

" Fetches existing values from user and sets defaults if not set.
function! s:init_settings(settings)
  for [key, value] in items(a:settings)
    let sub = ''
    if type(value) == 0
      let sub = '%d'
    elseif type(value) == 1
      let sub = '"%s"'
    endif
    let fmt = printf("let g:novim_mode_%%s=get(g:, 'novim_mode_%%s', %s)",
          \ sub)
    exec printf(fmt, key, key, value)
  endfor
endfunction

call s:init_settings(s:settings)

" Plugin entry point
call novim_mode#StartNoVimMode()

let &cpo = s:save_cpo
unlet s:save_cpo