-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
82 lines (78 loc) · 2.17 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
" SETTINGS
" line numbers
set number
" where am i?
set ruler
" we don't need no word wrap
set nowrap
" spaces instead of tabs
set expandtab
" three spaces per tab
set tabstop=3
set shiftwidth=3
set softtabstop=3
" let syntax files provide fold info
set foldmethod=syntax
" mouse works everywhere
set mouse=a
" syntax hilighting
syntax on
" loads necessary stuff by filetype
filetype plugin indent on
" BINDINGS
" escape is too far to reach…
imap jk <Esc>
" \ is dumb, too
let mapleader = ","
" ,, instead of ZZ
nnoremap <leader><leader> :xa<cr>
inoremap <leader><leader> <esc>:xa<cr>
" copy all to system clipboard
noremap <C-y> gg"*yG
" more logical splits
noremap <C-w>- :new<Enter>
noremap <C-w>\| :vnew<Enter>
" COMMANDS
" sign whole buffer
command Sign :%!gpg -u "[email protected]" --clearsign
" COLORS
" 256 colors spinning out of control
set t_Co=256
" i like my background like i like my soul
set bg=dark
if &background == "dark"
hi normal guibg=black
endif
" github.com/tpope/vim-vividchalk
colorscheme vividchalk
" MISC
" install plugins by adding to ~/.vim/bundle
execute pathogen#infect()
" GPG editing
" Don't save backups of *.gpg files
set backupskip+=*.gpg
" To avoid that parts of the file is saved to .viminfo when yanking or
" deleting, empty the 'viminfo' option.
set viminfo=
augroup encrypted
au!
" Disable swap files, and set binary file format before reading the file
autocmd BufReadPre,FileReadPre *.gpg
\ setlocal noswapfile bin
" Decrypt the contents after reading the file, reset binary file format
" and run any BufReadPost autocmds matching the file name without the .gpg
" extension
autocmd BufReadPost,FileReadPost *.gpg
\ execute "'[,']!gpg --decrypt --default-recipient-self" |
\ setlocal nobin |
\ execute "doautocmd BufReadPost " . expand("%:r")
" Set binary file format and encrypt the contents before writing the file
autocmd BufWritePre,FileWritePre *.gpg
\ setlocal bin |
\ '[,']!gpg --encrypt --default-recipient-self
" After writing the file, do an :undo to revert the encryption in the
" buffer, and reset binary file format
autocmd BufWritePost,FileWritePost *.gpg
\ silent u |
\ setlocal nobin
augroup END