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)
36 " Stay in visual after indenting
41 " I frequently type :Q or :WQ, etc instead of :q, :wq
59 " Make the number pad work
84 " Turn word wrap off, reset arrows, home, end, etc to default bindings
87 " Go up and down by physical linebreaks when not wordwrapped
89 iunmap <buffer> <Home>
90 iunmap <buffer> <Down>
92 nunmap <buffer> <Down>
95 nunmap <buffer> <Home>
99 vunmap <buffer> <Down>
101 vunmap <buffer> <End>
102 vunmap <buffer> <Home>
106 " Allow only backspace & space
110 " Turn word wrapping on and bind arrows, home, end, etc to display lines
113 " Go up and down by display lines, not linebreaks when wordwrapped
114 imap <buffer> <End> <C-o>g$
115 imap <buffer> <Home> <C-o>g0
116 imap <buffer> <Down> <C-o>gj
117 imap <buffer> <Up> <C-o>gk
118 nmap <buffer> <Down> gj
119 nmap <buffer> <Up> gk
120 nmap <buffer> <End> g$
121 nmap <buffer> <Home> g0
125 vmap <buffer> <Down> gj
126 vmap <buffer> <Up> gk
127 vmap <buffer> <End> g$
128 vmap <buffer> <Home> g0
132 " Allow backspace, space, left/right keys to move across lines
133 set whichwrap=b,s,<,>,[,]
137 " Toggle show invisible characters
140 echo "Invisible characters off"
143 echo "Invisible characters on"
144 set listchars=tab:.\ ,trail:!
150 " Spell checking mode toggle
151 function ToggleSpelling()
152 if !exists("s:spell_check") || s:spell_check == 0
153 echo "Spell check on"
154 let s:spell_check = 1
155 setlocal spell spelllang=en_au
157 echo "Spell check off"
158 let s:spell_check = 0
159 setlocal spell spelllang=