Skip to content

usage ideas

jeanCarloMachado edited this page Sep 16, 2018 · 4 revisions
"format json blocks jq: https://stedolan.github.io/jq/
call toop#mapShell('jq .', '<leader>jb')

"MD5 the text block
call toop#mapShell('md5sum | cut -d " " -f1 ', '<leader>md5')

"base 64
call toop#mapShell('base64 --decode ', '<leader>d64')

"translate shell
call toop#mapShell('trans -b  -no-theme -no-auto -no-ansi de:en', '<leader>ge')
call toop#mapShell('trans -b  -no-theme -no-auto -no-ansi en:de', '<leader>eg')

"make markdown numbered list
call toop#mapShell("awk 'BEGIN { c=1 } // { print c\". \"$0; c = c+1 }'", '<leader>nl')

"make list
call toop#mapShell("awk '// { print \"- \"$0 }'", '<leader>ml')

"make awesome ascii graphs
"https://github.com/ironcamel/Graph-Easy
call toop#mapShell('graph-easy', '<leader>mg')

fun! FoldSomething(str)
    let comment=split(&commentstring, '%s')
    if len(l:comment)==1
        call add(comment, l:comment[0])
    endif
    return l:comment[0]." {{{\n".a:str."\n".l:comment[1]."}}}"
endfun

"fold block
call toop#mapFunction('FoldSomething', '<leader>fo')

Toggle quotes

#file toggleQuote.py
import sys
input = sys.stdin.read()
result = ''
for i in input:
        if i == '"':
                result = result + "'"
        elif i == "'":
                result = result + '"'
        else:
                result = result + i
print(result)
call toop#mapShell("python toggleQuote.py", '<leader>tq')

Markdown blocks

call toop#mapAround('~~', '~~', '<leader>st')
"math block
call toop#mapAround('$', '$', '<leader>mb')
call toop#mapAround('`', '`', "<leader>`")
call toop#mapAround("'", "'", "<leader>'")
call toop#mapAround('"', '"', '<leader>"')
call toop#mapAround('*', '*', '<leader>*')
call toop#mapAround('(', ')', '<leader>(')
call toop#mapAround('[', ']', '<leader>[')
call toop#mapAround('{', '}', '<leader>{')
call toop#mapAround('$', '$', '<leader>$')
call toop#mapAround('<', '>', '<leader><')
"markdown italic
call toop#mapAround('*', '*', '<leader>it')
"markdown bold
call toop#mapAround('**', '**', '<leader>bo')
call toop#mapAround("***\n", '***', '<leader>hl')
call toop#mapAround("```sh\n", "\n```", '<leader>c')

Want more ideas? Take a look at my .vimrc

Clone this wiki locally