2016-01-22 03:42:10 +00:00
|
|
|
" Preferred global default settings:
|
2016-01-22 03:36:44 +00:00
|
|
|
set number
|
|
|
|
set background=dark
|
|
|
|
set smartindent
|
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
|
|
|
set expandtab
|
2016-08-26 01:04:46 +00:00
|
|
|
set t_Co=256 " use 265 colors in vim
|
2016-01-22 03:36:44 +00:00
|
|
|
syntax enable
|
2016-08-26 01:04:46 +00:00
|
|
|
colorscheme solarized
|
2016-01-22 03:36:44 +00:00
|
|
|
match ErrorMsg '\s\+$'
|
2016-01-22 03:42:10 +00:00
|
|
|
|
2016-03-28 06:40:36 +00:00
|
|
|
" Set up the status line so it's colored and always on
|
|
|
|
set laststatus=2
|
2016-04-04 03:54:54 +00:00
|
|
|
highlight StatusLine cterm=none ctermbg=darkgreen ctermfg=black
|
|
|
|
highlight StatusLineNC cterm=none ctermbg=darkgreen ctermfg=black
|
|
|
|
highlight VertSplit cterm=none ctermbg=darkgreen ctermfg=black
|
2016-03-28 06:40:36 +00:00
|
|
|
|
2016-01-22 03:42:10 +00:00
|
|
|
" Removes trailing spaces:
|
2016-01-22 03:36:44 +00:00
|
|
|
function! TrimWhiteSpace()
|
|
|
|
%s/\s\+$//e
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
nnoremap <silent> <Leader>RemoveTrailingWhiteSpace :call TrimWhiteSpace()<CR>
|
|
|
|
autocmd FileWritePre * :call TrimWhiteSpace()
|
|
|
|
autocmd FileAppendPre * :call TrimWhiteSpace()
|
|
|
|
autocmd FilterWritePre * :call TrimWhiteSpace()
|
|
|
|
autocmd BufWritePre * :call TrimWhiteSpace()
|
|
|
|
|
2016-04-04 04:04:59 +00:00
|
|
|
" Transparent editing of gpg encrypted files.
|
|
|
|
" By Wouter Hanegraaff <wouter@blub.net>
|
|
|
|
augroup encrypted
|
|
|
|
au!
|
|
|
|
|
|
|
|
" First make sure nothing is written to ~/.viminfo while editing
|
|
|
|
" an encrypted file.
|
|
|
|
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
|
|
|
|
" We don't want a swap file, as it writes unencrypted data to disk
|
|
|
|
autocmd BufReadPre,FileReadPre *.gpg set noswapfile
|
|
|
|
" Switch to binary mode to read the encrypted file
|
|
|
|
autocmd BufReadPre,FileReadPre *.gpg set bin
|
|
|
|
autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2
|
|
|
|
autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2> /dev/null
|
|
|
|
" Switch to normal mode for editing
|
|
|
|
autocmd BufReadPost,FileReadPost *.gpg set nobin
|
|
|
|
autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save
|
|
|
|
autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r")
|
|
|
|
|
|
|
|
" Convert all text to encrypted text before writing
|
|
|
|
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --default-key=04CE4B93 --default-recipient-self -ae 2>/dev/null
|
|
|
|
" Undo the encryption so we are back in the normal text, directly
|
|
|
|
" after the file has been written.
|
|
|
|
autocmd BufWritePost,FileWritePost *.gpg u
|
|
|
|
augroup END
|
|
|
|
|
2016-01-22 03:42:10 +00:00
|
|
|
" Add files ending in md to the list of files recognised as markdown:
|
2016-01-22 03:36:44 +00:00
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown
|
|
|
|
|
2016-02-01 02:44:51 +00:00
|
|
|
" My Markdown environment
|
|
|
|
function! MarkdownSettings()
|
|
|
|
set textwidth=79
|
2016-02-15 11:21:00 +00:00
|
|
|
set spell spelllang=en_au
|
2016-02-01 02:44:51 +00:00
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.mdwn :call MarkdownSettings()
|
|
|
|
|
2016-02-15 04:47:30 +00:00
|
|
|
" My ReStructured Text environment
|
|
|
|
function! ReStructuredSettings()
|
|
|
|
set textwidth=79
|
2016-02-15 11:21:00 +00:00
|
|
|
set spell spelllang=en_au
|
2016-02-15 04:47:30 +00:00
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.rst :call ReStructuredSettings()
|
2016-10-27 09:39:51 +00:00
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.txt :call ReStructuredSettings()
|
2016-02-15 04:47:30 +00:00
|
|
|
|
2016-03-28 06:12:31 +00:00
|
|
|
" My LaTeX environment:
|
|
|
|
function! LaTeXSettings()
|
|
|
|
set textwidth=79
|
|
|
|
set spell spelllang=en_au
|
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.tex :call LaTeXSettings()
|
|
|
|
|
2016-01-22 03:42:10 +00:00
|
|
|
" Settings for my Haskell environment:
|
2016-01-22 03:36:44 +00:00
|
|
|
function! HaskellSettings()
|
2016-02-18 02:05:20 +00:00
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
2016-01-22 03:36:44 +00:00
|
|
|
set expandtab
|
2016-02-18 02:05:20 +00:00
|
|
|
set textwidth=79
|
2016-01-22 03:36:44 +00:00
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.hs :call HaskellSettings()
|
|
|
|
|
2016-01-22 03:42:10 +00:00
|
|
|
" Settings for my Golang environment:
|
2016-01-22 03:36:44 +00:00
|
|
|
function! GoSettings()
|
|
|
|
set tabstop=7
|
|
|
|
set shiftwidth=7
|
|
|
|
set noexpandtab
|
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.go :call GoSettings()
|
|
|
|
|
2016-01-22 03:42:10 +00:00
|
|
|
" Settings for my Python environment:
|
2016-01-22 03:36:44 +00:00
|
|
|
function! PythonSettings()
|
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
|
|
|
set expandtab
|
|
|
|
set textwidth=79
|
2016-01-22 04:57:14 +00:00
|
|
|
set spell!
|
2016-01-22 03:36:44 +00:00
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.py :call PythonSettings()
|
2016-08-26 01:04:46 +00:00
|
|
|
|
|
|
|
" My Mutt environment
|
|
|
|
function! MuttSettings()
|
|
|
|
set textwidth=79
|
|
|
|
set spell spelllang=en_au
|
|
|
|
set tabstop=4
|
|
|
|
set shiftwidth=4
|
|
|
|
set expandtab
|
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead mutt-* :call MarkdownSettings()
|
|
|
|
|
2016-10-27 09:39:51 +00:00
|
|
|
" Settings for my C environment:
|
|
|
|
function! CSettings()
|
|
|
|
set tabstop=2
|
|
|
|
set shiftwidth=2
|
|
|
|
set expandtab
|
|
|
|
set textwidth=79
|
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufFilePre,BufRead *.c :call CSettings()
|
|
|
|
|