Created
February 3, 2019 17:26
-
-
Save dduleone/2d8d24fde9812859936e66c9f4f91d60 to your computer and use it in GitHub Desktop.
curl. json & vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/.vimrc | |
syntax on | |
au BufRead,BufNewFile *.json set filetype=json | |
colorscheme darkblue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/.vim/syntax/json.vim | |
" Vim syntax file | |
" Language: JSON | |
" Maintainer: Eli Parra <[email protected]> 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.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" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment