1 " Function key mappings
2 map <F8> :call ToggleSpelling()<CR>
3 imap <F8> <C-o>:call ToggleSpelling()<CR>
4 map <F9> :call InvShow()<CR>
5 imap <F9> <C-o>:call InvShow()<CR>
6 map <F10> :call WrapToggle()<CR>
7 imap <F10> <C-o>:call WrapToggle()<CR>
10 command! -nargs=+ Calc :r! python -c "from math import *; print <args>"
12 " Unhighlight search results and redraw the screen
13 nmap <C-l> :nohlsearch<CR>:redraw!<CR>
15 " Map Y to be consistent with D, C, etc
18 " CTRL-n and CTRL-p to go forwards and backwards through files
22 " CTRL-J/K to move up and down, collapsing open windows
23 map <C-J> <C-W>j<C-W>_
24 map <C-K> <C-W>k<C-W>_
26 " Press CTRL-z after pasting something to fix up formatting
27 imap <C-z> <ESC>u:set paste<CR>.:set nopaste<CR>i
29 " Tab to switch between split windows
33 " Q to reformat paragraph. I never use ex mode anyway (default binding for Q)
37 " I frequently type :Q or :WQ, etc instead of :q, :wq
55 " Make the number pad work
80 " Turn word wrap off, reset arrows, home, end, etc to default bindings
83 " Go up and down by physical linebreaks when not wordwrapped
85 iunmap <buffer> <Home>
86 iunmap <buffer> <Down>
88 nunmap <buffer> <Down>
91 nunmap <buffer> <Home>
95 vunmap <buffer> <Down>
98 vunmap <buffer> <Home>
102 " Allow only backspace & space
106 " Turn word wrapping on and bind arrows, home, end, etc to display lines
109 " Go up and down by display lines, not linebreaks when wordwrapped
110 imap <buffer> <End> <C-o>g$
111 imap <buffer> <Home> <C-o>g0
112 imap <buffer> <Down> <C-o>gj
113 imap <buffer> <Up> <C-o>gk
114 nmap <buffer> <Down> gj
115 nmap <buffer> <Up> gk
116 nmap <buffer> <End> g$
117 nmap <buffer> <Home> g0
121 vmap <buffer> <Down> gj
122 vmap <buffer> <Up> gk
123 vmap <buffer> <End> g$
124 vmap <buffer> <Home> g0
128 " Allow backspace, space, left/right keys to move across lines
129 set whichwrap=b,s,<,>,[,]
133 " Toggle show invisible characters
136 echo "Invisible characters off"
139 echo "Invisible characters on"
140 set listchars=tab:.\ ,trail:!
146 " Spell checking mode toggle
147 function ToggleSpelling()
148 if !exists("s:spell_check") || s:spell_check == 0
149 echo "Spell check on"
150 let s:spell_check = 1
151 setlocal spell spelllang=en_au
153 echo "Spell check off"
154 let s:spell_check = 0
155 setlocal spell spelllang=