-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
80 lines (69 loc) · 1.8 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
set nocompatible
set history=50
set undolevels=20
colorscheme kefo
filetype indent on
filetype plugin on
set autoread
" User interface
set statusline=%<%t\ %y%m\ %r%h%w%=Ln:%l/%L\ Col:%c\ [%{&ff}][%{&enc}]
set cmdheight=1
set laststatus=2
set backspace=indent,eol,start
set ruler
set showcmd
set showmatch
set showmode
set shortmess=at
set mat=2
set noequalalways
" Backups
set nobackup
set noswapfile
set nowritebackup
" Text
set autoindent
set expandtab
set shiftwidth=4
set tabstop=4
set textwidth=80
syntax enable
if has("gui_running")
set guifont=Courier_New:h10:cDEFAULT
set lines=34 columns=80
set showtabline=2
set number
hi LineNr guifg=DarkGray guibg=LightGray
endif
" Use GnuPG to open a .gpg file
augroup gpg
au!
au BufReadPre,FileReadPre *.gpg
\ set viminfo=
" Don't write unencrypted stuff to disk
au BufReadPre,FileReadPre *.gpg
\ set noswapfile noundofile nobackup nowritebackup history=0
" Switch to binary mode to read the encrypted file
au BufReadPre,FileReadPre *.gpg
\ set binary
au BufReadPre,FileReadPre *.gpg
\ let ch_save = &ch|set ch=2
" Descrypt the file
au BufReadPost,FileReadPost *.gpg
\ '[,']!gpg --decrypt 2>/dev/null
" Switch to normal mode for editing
au BufReadPost,FileReadPost *.gpg
\ set nobin
au BufReadPost,FileReadPost *.gpg
\ let &ch = ch_save|unlet ch_save
au BufReadPost,FileReadPost *.gpg
\ execute ":doautocmd BufReadPost " . expand("%:r")
" Encrypt all text before writing
au BufWritePre,FileWritePre *.gpg
\ set binary |
\ '[,']!gpg --encrypt --default-recipient-self
au BufWritePost,FileWritePost *.gpg
\ silent u |
\ set nobin
au VimLeave *.gpg :!clear
augroup END