Little reindenting.

This commit is contained in:
Markus Braun
2008-01-28 09:30:59 +00:00
parent febf2d4685
commit 9f4f083367

View File

@@ -71,22 +71,21 @@ let g:loaded_gnupg = "$Revision$"
" Section: Autocmd setup {{{1 " Section: Autocmd setup {{{1
augroup GnuPG augroup GnuPG
autocmd! autocmd!
" initialize the internal variables " initialize the internal variables
autocmd BufNewFile,BufReadPre,FileReadPre *.\(gpg\|asc\|pgp\) call s:GPGInit() autocmd BufNewFile,BufReadPre,FileReadPre *.\(gpg\|asc\|pgp\) call s:GPGInit()
" force the user to edit the recipient list if he opens a new file and public " force the user to edit the recipient list if he opens a new file and public
" keys are preferred " keys are preferred
autocmd BufNewFile *.\(gpg\|asc\|pgp\) if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 0) | call s:GPGEditRecipients() | endi autocmd BufNewFile *.\(gpg\|asc\|pgp\) if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 0) | call s:GPGEditRecipients() | endi
" do the decryption " do the decryption
autocmd BufReadPost,FileReadPost *.\(gpg\|asc\|pgp\) call s:GPGDecrypt() autocmd BufReadPost,FileReadPost *.\(gpg\|asc\|pgp\) call s:GPGDecrypt()
" convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.\(gpg\|asc\|pgp\) call s:GPGEncrypt()
" undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.\(gpg\|asc\|pgp\) call s:GPGEncryptPost()
" convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.\(gpg\|asc\|pgp\) call s:GPGEncrypt()
" undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.\(gpg\|asc\|pgp\) call s:GPGEncryptPost()
augroup END augroup END
" Section: Highlight setup {{{1 " Section: Highlight setup {{{1
@@ -242,13 +241,13 @@ fun s:GPGDecrypt()
call s:GPGDebug(1, "recipient is " . recipient) call s:GPGDebug(1, "recipient is " . recipient)
let name=s:GPGNameToID(recipient) let name=s:GPGNameToID(recipient)
if (strlen(name) > 0) if (strlen(name) > 0)
let b:GPGRecipients=b:GPGRecipients . name . ":" let b:GPGRecipients=b:GPGRecipients . name . ":"
call s:GPGDebug(1, "name of recipient is " . name) call s:GPGDebug(1, "name of recipient is " . name)
else else
let b:GPGUnknownRecipients=b:GPGUnknownRecipients . recipient . ":" let b:GPGUnknownRecipients=b:GPGUnknownRecipients . recipient . ":"
echohl GPGWarning echohl GPGWarning
echo "The recipient " . recipient . " is not in your public keyring!" echo "The recipient " . recipient . " is not in your public keyring!"
echohl None echohl None
end end
let start=match(output, "gpg: public key is [[:xdigit:]]\\{8}", start) let start=match(output, "gpg: public key is [[:xdigit:]]\\{8}", start)
endw endw
@@ -507,14 +506,14 @@ fun s:GPGEditRecipients()
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer() autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
else else
if (bufwinnr(editbuffername) >= 0) if (bufwinnr(editbuffername) >= 0)
" switch to scratch buffer window " switch to scratch buffer window
exe 'silent! ' . bufwinnr(editbuffername) . "wincmd w" exe 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
else else
" split scratch buffer window " split scratch buffer window
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'") exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
" add a autocommand to regenerate the recipients after a write " add a autocommand to regenerate the recipients after a write
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer() autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishRecipientsBuffer()
endi endi
" empty the buffer " empty the buffer
@@ -630,12 +629,12 @@ fun s:GPGFinishRecipientsBuffer()
if (strlen(recipient) > 0) if (strlen(recipient) > 0)
let gpgid=s:GPGNameToID(recipient) let gpgid=s:GPGNameToID(recipient)
if (strlen(gpgid) > 0) if (strlen(gpgid) > 0)
let GPGRecipients=GPGRecipients . gpgid . ":" let GPGRecipients=GPGRecipients . gpgid . ":"
else else
let GPGUnknownRecipients=GPGUnknownRecipients . recipient . ":" let GPGUnknownRecipients=GPGUnknownRecipients . recipient . ":"
echohl GPGWarning echohl GPGWarning
echo "The recipient " . recipient . " is not in your public keyring!" echo "The recipient " . recipient . " is not in your public keyring!"
echohl None echohl None
end end
endi endi
@@ -717,14 +716,14 @@ fun s:GPGEditOptions()
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer() autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
else else
if (bufwinnr(editbuffername) >= 0) if (bufwinnr(editbuffername) >= 0)
" switch to scratch buffer window " switch to scratch buffer window
exe 'silent! ' . bufwinnr(editbuffername) . "wincmd w" exe 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
else else
" split scratch buffer window " split scratch buffer window
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'") exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
" add a autocommand to regenerate the options after a write " add a autocommand to regenerate the options after a write
autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer() autocmd BufHidden,BufUnload,BufWriteCmd <buffer> call s:GPGFinishOptionsBuffer()
endi endi
" empty the buffer " empty the buffer
@@ -863,24 +862,24 @@ fun s:GPGNameToID(name)
" search for the next uid " search for the next uid
if (pub_seen == 1) if (pub_seen == 1)
if (s:GetField(linecontent, ":", 0) == "uid") if (s:GetField(linecontent, ":", 0) == "uid")
if (uid_seen == 0) if (uid_seen == 0)
let choices=choices . counter . ": " . s:GetField(linecontent, ":", 9) . "\n" let choices=choices . counter . ": " . s:GetField(linecontent, ":", 9) . "\n"
let counter=counter+1 let counter=counter+1
let uid_seen=1 let uid_seen=1
else else
let choices=choices . " " . s:GetField(linecontent, ":", 9) . "\n" let choices=choices . " " . s:GetField(linecontent, ":", 9) . "\n"
endi endi
else else
let uid_seen=0 let uid_seen=0
let pub_seen=0 let pub_seen=0
endi endi
endi endi
" search for the next pub " search for the next pub
if (pub_seen == 0) if (pub_seen == 0)
if (s:GetField(linecontent, ":", 0) == "pub") if (s:GetField(linecontent, ":", 0) == "pub")
let gpgids=gpgids . s:GetField(linecontent, ":", 4) . ":" let gpgids=gpgids . s:GetField(linecontent, ":", 4) . ":"
let pub_seen=1 let pub_seen=1
endi endi
endi endi
@@ -929,13 +928,13 @@ fun s:GPGIDToName(identity)
while (strlen(linecontent) && !finish) while (strlen(linecontent) && !finish)
if (pub_seen == 0) " search for the next pub if (pub_seen == 0) " search for the next pub
if (s:GetField(linecontent, ":", 0) == "pub") if (s:GetField(linecontent, ":", 0) == "pub")
let pub_seen=1 let pub_seen=1
endi endi
else " search for the next uid else " search for the next uid
if (s:GetField(linecontent, ":", 0) == "uid") if (s:GetField(linecontent, ":", 0) == "uid")
let pub_seen=0 let pub_seen=0
let finish=1 let finish=1
let uid=s:GetField(linecontent, ":", 9) let uid=s:GetField(linecontent, ":", 9)
endi endi
endi endi