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 command SudoWrite call SudoWriteFunction()
39 " I frequently type :Q or :WQ, etc instead of :q, :wq
57 " Make the number pad work
82 " Turn word wrap off, reset arrows, home, end, etc to default bindings
85 " Go up and down by physical linebreaks when not wordwrapped
87 iunmap <buffer> <Home>
88 iunmap <buffer> <Down>
90 nunmap <buffer> <Down>
93 nunmap <buffer> <Home>
97 vunmap <buffer> <Down>
100 vunmap <buffer> <Home>
104 " Allow only backspace & space
108 " Turn word wrapping on and bind arrows, home, end, etc to display lines
111 " Go up and down by display lines, not linebreaks when wordwrapped
112 imap <buffer> <End> <C-o>g$
113 imap <buffer> <Home> <C-o>g0
114 imap <buffer> <Down> <C-o>gj
115 imap <buffer> <Up> <C-o>gk
116 nmap <buffer> <Down> gj
117 nmap <buffer> <Up> gk
118 nmap <buffer> <End> g$
119 nmap <buffer> <Home> g0
123 vmap <buffer> <Down> gj
124 vmap <buffer> <Up> gk
125 vmap <buffer> <End> g$
126 vmap <buffer> <Home> g0
130 " Allow backspace, space, left/right keys to move across lines
131 set whichwrap=b,s,<,>,[,]
135 " Toggle show invisible characters
138 echo "Invisible characters off"
141 echo "Invisible characters on"
142 set listchars=tab:.\ ,trail:!
148 " Spell checking mode toggle
149 function ToggleSpelling()
150 if !exists("s:spell_check") || s:spell_check == 0
151 echo "Spell check on"
152 let s:spell_check = 1
153 setlocal spell spelllang=en_au
155 echo "Spell check off"
156 let s:spell_check = 0
157 setlocal spell spelllang=
163 function SudoWriteFunction()