aboutsummaryrefslogtreecommitdiff
path: root/plugin/heresy.vim
blob: 827e920588aa6130b0c433ff742776bf8055c554 (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
45
46
47
48
49
50
51
52
53
54
55
" heresy.vim - Make Vim behave more like a "normal" editor
" Author:       j-james
" Version:      0.1
"
" ============================================================================

let s:save_cpo = &cpo
set cpo&vim

" Choose what groups of shortcuts to use (default: all)
" 0 is off, 1 is on
" 'shortcuts' controls all but 'better_wrap_navigation'
let s:settings = {
  \ 'shortcuts': 1,
  \ 'app_shortcuts': 1,
  \ 'copypaste_shortcuts': 1,
  \ 'undo_shortcuts': 1,
  \ 'plugin_shortcuts': 1,
  \ 'find_shortcuts': 1,
  \ 'line_shortcuts': 1,
  \ 'tab_shortcuts': 1,
  \ 'pane_shortcuts': 1,
  \ 'indentation_shortcuts': 1,
  \ 'navigation_fixes': 1,
  \ 'better_wrap_navigation': 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:heresy_%%s=get(g:, 'heresy_%%s', %s)",
          \ sub)
    exec printf(fmt, key, key, value)
  endfor
endfunction

call s:init_settings(s:settings)

if has('timers') == 0
  echo "vim-heresy: Your Vim version (Vim <7.5 or Neovim <0.1.5) doesn't "
  echo "support `timer()`, which causes a bug where Insert Mode is "
  echo "inappropriately set for some panes."
endif

" Plugin entry point
call g:heresy#StartHeresy()

let &cpo = s:save_cpo
unlet s:save_cpo