2 set backspace=indent,eol,start
7 set directory=~/.cache/vim/swap//
8 set backupdir=~/.cache/vim/backup//
9 set undodir=~/.cache/vim/undo//
10 silent exec "!mkdir -p ~/.cache/vim/{swap,backup,undo}/"
11 silent exec '!find ~/.cache/vim/ -type f -mtime +3 -delete'
15 filetype plugin indent on
17 " restore position when opening files
19 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
20 \ | exe "normal! g`\""
23 " don't automatically continue comments on new lines
24 autocmd BufNewFile,BufRead * setlocal formatoptions-=r
32 " filename (~/some/dir) (1 of 2) (hostname)
33 set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:~:h\")})%)%(\ %a%)\ (%{hostname()})
38 " show useful things on the status line
43 " display as much as possible of the last line, instead of @
49 " auto-complete should work like bash
50 set wildmode=longest,list
52 " show one extra line when scrolling
73 " single indent for line continuations
76 let g:pyindent_open_paren = &sw
77 let g:pyindent_continue = &sw
78 let g:vim_indent_cont = &sw
80 " don't allow syntax/sh.vim to change my iskeyword setting
83 " single space after full stop
93 nmap <C-l> :nohlsearch<CR>:redraw!<CR>
95 command SudoWrite call SudoWriteFunction()
97 map <F8> :call ToggleSpelling()<CR>
98 imap <F8> <C-o>:call ToggleSpelling()<CR>
99 map <F9> :call InvShow()<CR>
100 imap <F9> <C-o>:call InvShow()<CR>
101 map <F10> :call WrapToggle()<CR>
102 imap <F10> <C-o>:call WrapToggle()<CR>
103 map <F11> :call PasteToggle()<CR>
104 imap <F11> <C-o>:call PasteToggle()<CR>
107 function ToggleSpelling()
108 if !exists("s:spell_check") || s:spell_check == 0
109 echo "Spell check on"
110 let s:spell_check = 1
111 setlocal spell spelllang=en_au
113 echo "Spell check off"
114 let s:spell_check = 0
115 setlocal spell spelllang=
119 function WrapToggle()
131 echo "Invisible characters off"
134 echo "Invisible characters on"
135 set listchars=tab:.\ ,trail:!
140 function SudoWriteFunction()
145 function PasteToggle()
148 echo "Paste mode disabled"
151 echo "Paste mode enabled"