2 command! -nargs=+ Calc :r! python -c "from math import *; print <args>"
4 " I frequently type :Q or :WQ, etc instead of :q, :wq
22 " Unhighlight search results
23 nmap <C-l> :nohlsearch<CR>:redraw!<CR>
25 " Map Y to be consistent with D, C, etc
28 " CTRL-n and CTRL-p to go forwards and backwards through files
32 " CTRL-J/K to move up and down, collapsing open windows
33 map <C-J> <C-W>j<C-W>_
34 map <C-K> <C-W>k<C-W>_
36 " Press CTRL-z after pasting something to fix up formatting
37 imap <C-z> <ESC>u:set paste<CR>.:set nopaste<CR>i
39 " Tab to switch between split windows
42 " Q to reformat paragraph. I never use ex mode anyway (default binding for Q)
56 map <F10> :call WrapToggle()<CR>
57 imap <F10> <C-o>:call WrapToggle()<CR>
59 " Turn word wrap off, reset arrows, home, end, etc to default bindings
62 " Go up and down by physical linebreaks when not wordwrapped
64 iunmap <buffer> <Home>
65 iunmap <buffer> <Down>
67 nunmap <buffer> <Down>
70 nunmap <buffer> <Home>
74 " Allow only backspace & space
78 " Turn word wrapping on and bind arrows, home, end, etc to display lines
81 " Go up and down by display lines, not linebreaks when wordwrapped
82 imap <buffer> <End> <C-o>g$
83 imap <buffer> <Home> <C-o>g0
84 imap <buffer> <Down> <C-o>gj
85 imap <buffer> <Up> <C-o>gk
86 nmap <buffer> <Down> gj
88 nmap <buffer> <End> g$
89 nmap <buffer> <Home> g0
93 " Allow backspace, space, left/right keys to move across lines
94 set whichwrap=b,s,<,>,[,]
98 " Toggle show invisible characters
101 echo "Invisible characters off"
104 echo "Invisible characters on"
105 set listchars=tab:.\ ,trail:!
109 map <F9> :call InvShow()<CR>
110 imap <F9> <C-o>:call InvShow()<CR>
113 " Spell checking mode toggle
114 function ToggleSpelling()
115 if !exists("s:spell_check") || s:spell_check == 0
116 echo "Spell check on"
117 let s:spell_check = 1
118 setlocal spell spelllang=en_au
120 echo "Spell check off"
121 let s:spell_check = 0
122 setlocal spell spelllang=
125 map <F8> :call ToggleSpelling()<CR>
126 imap <F8> <C-o>:call ToggleSpelling()<CR>