2 set backspace=indent,eol,start
8 set directory=~/.cache/vim/swap//
9 set backupdir=~/.cache/vim/backup//
10 set undodir=~/.cache/vim/undo//
11 silent exec "!mkdir -p ~/.cache/vim/{swap,backup,undo}/"
12 silent exec '!find ~/.cache/vim/ -type f -mtime +3 -delete'
16 filetype plugin indent on
18 " restore position when opening files
20 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
21 \ | exe "normal! g`\""
24 " don't automatically continue comments on new lines
25 autocmd BufNewFile,BufRead * setlocal formatoptions-=r
33 " filename (~/some/dir) (1 of 2) (hostname)
34 set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:~:h\")})%)%(\ %a%)\ (%{hostname()})
39 " show useful things on the status line
44 " display as much as possible of the last line, instead of @
50 " auto-complete should work like bash
51 set wildmode=longest,list
53 " show one extra line when scrolling
74 " single indent for line continuations
77 let g:pyindent_open_paren = &sw
78 let g:pyindent_continue = &sw
79 let g:vim_indent_cont = &sw
81 " don't allow syntax/sh.vim to change my iskeyword setting
84 " single space after full stop
94 nmap <C-l> :nohlsearch<CR>:redraw!<CR>
96 command SudoWrite call SudoWriteFunction()
98 map <F8> :call ToggleSpelling()<CR>
99 imap <F8> <C-o>:call ToggleSpelling()<CR>
100 map <F9> :call InvShow()<CR>
101 imap <F9> <C-o>:call InvShow()<CR>
102 map <F10> :call WrapToggle()<CR>
103 imap <F10> <C-o>:call WrapToggle()<CR>
104 map <F11> :call PasteToggle()<CR>
105 imap <F11> <C-o>:call PasteToggle()<CR>
108 function ToggleSpelling()
109 if !exists("s:spell_check") || s:spell_check == 0
110 echo "Spell check on"
111 let s:spell_check = 1
112 setlocal spell spelllang=en_au
114 echo "Spell check off"
115 let s:spell_check = 0
116 setlocal spell spelllang=
120 function WrapToggle()
132 echo "Invisible characters off"
135 echo "Invisible characters on"
136 set listchars=tab:.\ ,trail:!
141 function SudoWriteFunction()
146 function PasteToggle()
149 echo "Paste mode disabled"
152 echo "Paste mode enabled"