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>
8 map <F11> :call PasteToggle()<CR>
9 imap <F11> <C-o>:call PasteToggle()<CR>
11 " Unhighlight search results and redraw the screen
12 nmap <C-l> :nohlsearch<CR>:redraw!<CR>
14 " Map Y to be consistent with D, C, etc
17 " CTRL-n and CTRL-p to go forwards and backwards through files
21 " CTRL-J/K to move up and down, collapsing open windows
22 map <C-J> <C-W>j<C-W>_
23 map <C-K> <C-W>k<C-W>_
25 " Press CTRL-z after pasting something to fix up formatting
26 imap <C-z> <ESC>u:set paste<CR>.:set nopaste<CR>i
28 " Tab to switch between split windows
32 " Q to reformat paragraph. I never use ex mode anyway (default binding for Q)
36 command SudoWrite call SudoWriteFunction()
38 " I frequently type :Q or :WQ, etc instead of :q, :wq
56 " Make the number pad work
81 " Turn word wrap off, reset arrows, home, end, etc to default bindings
84 " Go up and down by physical linebreaks when not wordwrapped
86 iunmap <buffer> <Home>
87 iunmap <buffer> <Down>
89 nunmap <buffer> <Down>
92 nunmap <buffer> <Home>
96 vunmap <buffer> <Down>
99 vunmap <buffer> <Home>
103 " Allow only backspace & space
107 " Turn word wrapping on and bind arrows, home, end, etc to display lines
110 " Go up and down by display lines, not linebreaks when wordwrapped
111 imap <buffer> <End> <C-o>g$
112 imap <buffer> <Home> <C-o>g0
113 imap <buffer> <Down> <C-o>gj
114 imap <buffer> <Up> <C-o>gk
115 nmap <buffer> <Down> gj
116 nmap <buffer> <Up> gk
117 nmap <buffer> <End> g$
118 nmap <buffer> <Home> g0
122 vmap <buffer> <Down> gj
123 vmap <buffer> <Up> gk
124 vmap <buffer> <End> g$
125 vmap <buffer> <Home> g0
129 " Allow backspace, space, left/right keys to move across lines
130 set whichwrap=b,s,<,>,[,]
134 " Toggle show invisible characters
137 echo "Invisible characters off"
140 echo "Invisible characters on"
141 set listchars=tab:.\ ,trail:!
147 " Spell checking mode toggle
148 function ToggleSpelling()
149 if !exists("s:spell_check") || s:spell_check == 0
150 echo "Spell check on"
151 let s:spell_check = 1
152 setlocal spell spelllang=en_au
154 echo "Spell check off"
155 let s:spell_check = 0
156 setlocal spell spelllang=
162 function SudoWriteFunction()
168 function PasteToggle()
171 echo "Paste mode disabled"
174 echo "Paste mode enabled"