Skip to content

Instantly share code, notes, and snippets.

@dduleone
Created February 3, 2019 17:26
Show Gist options
  • Select an option

  • Save dduleone/2d8d24fde9812859936e66c9f4f91d60 to your computer and use it in GitHub Desktop.

Select an option

Save dduleone/2d8d24fde9812859936e66c9f4f91d60 to your computer and use it in GitHub Desktop.

Revisions

  1. dduleone created this gist Feb 3, 2019.
    4 changes: 4 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    " ~/.vimrc
    syntax on
    au BufRead,BufNewFile *.json set filetype=json
    colorscheme darkblue
    39 changes: 39 additions & 0 deletions json.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    " ~/.vim/syntax/json.vim
    " Vim syntax file
    " Language: JSON
    " Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
    " Last Change: 2014-05-20 added warning toggle

    "uncomment to enable folding of `{...}` and `[...]` blocks
    "setlocal foldmethod=syntax

    "conceal by default
    if !exists("g:vim_json_syntax_conceal")
    let g:vim_json_syntax_conceal = 1
    end

    "have warnings by default
    if !exists("g:vim_json_warnings")
    let g:vim_json_warnings = 1
    end

    "set concealcursor blank by default
    "this should turn off the concealing in the current line (where the cursor is at),
    "on all modes (normal, visual, insert)
    if !exists("g:vim_json_syntax_concealcursor")
    let g:vim_json_syntax_concealcursor = ""
    end

    if has('conceal')
    if (g:vim_json_syntax_conceal == 1)
    "level 2 means concealed text gets completely hidden unless a
    "replacement is defined (none is defined by us)
    setlocal conceallevel=2
    let &l:concealcursor = g:vim_json_syntax_concealcursor
    else
    "level 0 means text is shown normally = no concealing
    setlocal conceallevel=0
    endif
    "maybe g:vim_json_syntax_conceal could be settable to 0,1,2 to map
    "directly to vim's conceallevels? unsure if anyone cares
    endif
    28 changes: 28 additions & 0 deletions shellfunctions.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    # ~/.oh-my-zsh/custom/dduleone.zsh

    # CURL something, expecting JSON, prettify it, and pipe the results to json_pp.
    # This function generally replaces curl if I'm expecting to get JSON in the response.
    curlj() {
    curl $@ | json_pp
    }

    # CURL something, expecting JSON, prettify it, and pipe it to the clipboard.
    # This function is useful when I know I want to save the results or use them in another application
    curljcp() {
    curl $@ | json_pp | pbcopy
    }

    # CURL something, expecting JSON, prettify it, and pipe it to vim
    # Glorious timesaver! This function will open vim, and automagically add:
    #  - Line Numbers
    #  - JSON Syntax Highlighting
    curljv() {
    curl $@ | json_pp | view - -c "set syntax=json" -c "set number"
    }

    # CURL something, and pipe it to vim
    # Glorious timesaver! This function will open vim, and automagically add:
    #  - Line Numbers
    curlv() {
    curl $@ | view - -c "set number"
    }