From 50e95383941e8d2c08c93242623794ddb6a91397 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 31 Jan 2018 16:29:22 +0100 Subject: [PATCH] Added scratch command --- vimrc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/vimrc b/vimrc index f9d05dc..a5d3853 100644 --- a/vimrc +++ b/vimrc @@ -270,20 +270,24 @@ command! -nargs=1 QFind call setqflist(MatchingLinesDict()) function! s:hex(...) if !(a:000 == [""]) - let l:args = map(copy(a:000), {i,val -> "-".val}) + let l:args = map(copy(a:000), {i,val -> "".val}) else let l:args = [] end if !exists("b:hex") - exec '%!xxd '.join(l:args, " ") + silent exec '%!xxd '.join(l:args, " ") let b:hex = 1 let b:prev_filetype = &filetype let &filetype = "xxd" + nnoremap i i + echo "A witch turned your file into a hexadecimal toad!" else - exec '%!xxd -r '.join(l:args, " ") + nunmap i + silent exec '%!xxd -r '.join(l:args, " ") unlet b:hex let &filetype = b:prev_filetype unlet b:prev_filetype + echo "The witch turned your file back into binary data" end endfunction command! -nargs=* Hex call hex() @@ -335,6 +339,8 @@ function! s:snapshot() endfun command! Snapshot call snapshot() +command! -nargs=? Scrantch | set buftype=nofile | set filetype= + " === GENERAL KEY MAPPINGS === let mapleader = "\\" @@ -554,7 +560,6 @@ endfunc " === GENERIC AUTOCOMMANDS === if has("autocmd") - " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. @@ -679,6 +684,16 @@ function! s:init_html_file() nnoremap t ""ciw<""p>m'""p>`'l nnoremap T ""diw"_cc<""p>o""p>O + function! s:insert_tag(tag, newline) + if !a:newline + let l:text = "<".a:tag.">" + else + end + put =l:text + endfunction + + nnoremap :call insert_tag(input(""), 0) + inoremap ""ciw<""p>m'""p>`'l inoremap ""diw"_cc<""p>o""p>O endfunction