diff --git a/vim/ansi.vim b/vim/ansi.vim new file mode 100644 index 0000000..9651e32 --- /dev/null +++ b/vim/ansi.vim @@ -0,0 +1,95 @@ +" http://www.lingua-systems.com/knowledge/unicode-mappings/cp850-to-unicode.html +" http://www.obliquity.com/computer/html/unicode2500.html + + +map c1 :call CharDraw_blocks() +map c2 :call CharDraw_lines() +map c3 :call CharDraw_doublelines() +map c4 :call CharDraw_arrows() +map c5 :call CharDraw_extrachars() +map c0 :call CharDraw_clear() + +map cr :so ansi.vim + +function! CharDraw_clear () + mapclear! +set laststatus=2 + echo 'N to create 80,25 empty drawing. Select chars and draw with numpad' + map N 80i yy24p( + set statusline=%f\ %=\ \[c1-1:chars\ c0:clr]\ (%v,%l)\ HEX:%B +endfunction +call CharDraw_clear() + + +function! CharDraw_blocks () + mapclear! + map! 1 ░ + map! 2 ▀ + map! 3 ▒ + map! 4 ▐ + map! 5 ■ + map! 6 ▌ + map! 7 ▓ + map! 8 ▄ + map! 9 █ + map! - ▞ + map! + ▚ + set statusline=%f\ %=\ [░▀▒▐■▌▓▄█▞▚]\(%v,%l)\ HEX:%B +endfunction + +function! CharDraw_lines () + mapclear! + map! 1 └ + map! 2 ┴ + map! 3 ┘ + map! 4 ├ + map! 5 ┼ + map! 6 ┤ + map! 7 ┌ + map! 8 ┬ + map! 9 ┐ + map! - ─ + map! + │ + set statusline=%f\ %=\ [└┴┘├┼┤┌┬┐─│]\(%v,%l)\ HEX:%B +endfunction + +function! CharDraw_doublelines () + mapclear! + map! 1 ╚ + map! 2 ╩ + map! 3 ╝ + map! 4 ╠ + map! 5 ╬ + map! 6 ╣ + map! 7 ╔ + map! 8 ╦ + map! 9 ╗ + map! - ═ + map! + ║ + set statusline=%f\ %=\ [╚╩╝╠╬╣╔╦╗═║]\(%v,%l)\ HEX:%B +endfunction + +function! CharDraw_extrachars () + mapclear! + map! 1 © + map! 2 · + map! 3 × + map! 4 « + map! 5 ° + map! 6 » + map! 7 ╲ + map! 8 ╳ + map! 9 ╱ + set statusline=%f\ %=\ [©·×«°»╲╳╱]\(%v,%l)\ HEX:%B +endfunction + +function! CharDraw_arrows () + mapclear! + map! 2 ▼ + map! 4 ◀ + map! 5 ◆ + map! 6 ▶ + map! 8 ▲ + set statusline=%f\ %=\ [▲▶▼◀◆]\(%v,%l)\ HEX:%B +endfunction + diff --git a/vim/checklist.vim b/vim/checklist.vim new file mode 100644 index 0000000..9d1e216 --- /dev/null +++ b/vim/checklist.vim @@ -0,0 +1,19 @@ +" alias vimbox="vim -S ~/BTSync/Homeshare/lib/chkl.vim" +map cr :so chkl.vim + +function! Box_clear () + mapclear! + map :call Flip_box() + map a i[ ] + set laststatus=2 + set statusline=%f\ %=\ \[ChkLst\ spc,a]\ (%v,%l)\ HEX:%B +endfunction +call Box_clear() + +function! Flip_box () + s!^\(\s*\)\[ \]!\1[xXx]!e + s!^\(\s*\)\[x\]!\1[ ]!e + s!\[xXx\]![x]!e +endfunction + + diff --git a/vim/vimcrypted b/vim/vimcrypted new file mode 100755 index 0000000..97fad6c --- /dev/null +++ b/vim/vimcrypted @@ -0,0 +1,45 @@ +#!/bin/bash + +# Unsecure implementation of a simple encrypted file editor +# The file is saved IN PLAIN TEXT when editing, +# this script only takes care of storing the file +# encrypted + + +if [ ! -f "$1" ] +then + echo "Give me an encrypted text file" + exit 1 +fi +unc=($(echo "$1" | sed 's/.gpg$//')) +if [ "$1" = "$unc" ] +then + echo "source is not .gpg" + exit 1 +fi +if [ -e "$unc" ] +then echo "$unc already exists. exiting" + exit 1 +fi + +gpg --decrypt "$1" > "$unc" + +edit=`date +%s -r $unc` +if [ -s "$unc" ] +then vim -i NONE -n "$unc" +else echo Error in decrypting + rm "$unc" + exit 1 +fi + +afteredit=`date +%s -r "$unc"` + +if (( $edit != $afteredit )) +then + cat "$unc" | gpg -ca > "$1".tmp + if [ -s "$1".tmp ] + then mv "$1" "$1".old + mv "$1".tmp "$1" + fi +fi +rm "$unc"