Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/axiaoxin/vim-json-line-format
format json line in Vim (VIM插件:格式化json文本行)
https://github.com/axiaoxin/vim-json-line-format
Last synced: about 11 hours ago
JSON representation
format json line in Vim (VIM插件:格式化json文本行)
- Host: GitHub
- URL: https://github.com/axiaoxin/vim-json-line-format
- Owner: axiaoxin
- Created: 2014-11-04T05:44:15.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-08-18T02:36:01.000Z (about 4 years ago)
- Last Synced: 2023-08-06T15:42:28.276Z (over 1 year ago)
- Language: Vim script
- Homepage:
- Size: 1.96 MB
- Stars: 32
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Format json text line in VIM
================_ ____ ___ _ _ _ ___ _ _ _____ _____ ___ ____ __ __ _ _____
| / ___| / _ \| \ | | | | |_ _| \ | | ____| | ___/ _ \| _ \| \/ | / \|_ _|
_ | \___ \| | | | \| |___| | | || \| | _| ___| |_ | | | | |_) | |\/| | / _ \ | |
| |_| |___) | |_| | |\ |___| |___ | || |\ | |__|___| _|| |_| | _ <| | | |/ ___ \| |
\___/|____/ \___/|_| \_| |_____|___|_| \_|_____| |_| \___/|_| \_\_| |_/_/ \_\_|If you open a text by VIM which contents are json lines text, such as:
{"question": "\u53d1\u5458\u5de5\u7684\u4e1c\u897f", "choices": ["\u6781\u6b63", "\u504f\u6b63", "\u4e2d\u6027", "\u504f\u8d1f", "\u6781\u8d1f", "\u975e\u8bc4\u4ef7"]}
{"question": "\u6613\u8fc5\u8fd9\u6837\u6ca1\u6cd5\u6bd4", "choices": ["\u6781\u6b63", "\u504f\u6b63", "\u4e2d\u6027", "\u504f\u8d1f", "\u6781\u8d1f", "\u975e\u8bc4\u4ef7"]}
{"question": "\u5f88\u591a\u4e1c\u897f\u5df2\u7ecf\u6bd4", "choices": ["\u6781\u6b63", "\u504f\u6b63", "\u4e2d\u6027", "\u504f\u8d1f", "\u6781\u8d1f", "\u975e\u8bc4\u4ef7"]}These json lines are inconvenient for human to read it, because of formating and encoding. Using this plugin, you can read these lines easily!
![](pic.gif)
### Install
If you use Plug, add `Plug 'axiaoxin/vim-json-line-format'` in your `.vimrc`, then use `:PlugInstall` to install this plugin.
Elseif you use Vundle, add `Plugin 'axiaoxin/vim-json-line-format'` in your `.vimrc`, then use `:PluginInstall` to install this plugin.
Else copy `plugin/json_line_format.vim` to your `.vim/plugin` Manually.
### Usage
Open a file in `Normal mode`, move your cursor on the json line, use `pj` to show formated json by print it, use `wj` could change the text to formatted json.
Invalid json can not be formatted!
Link:
# Stargazers over time
[![Stargazers over time](https://starchart.cc/axiaoxin/vim-json-line-format.svg)](https://starchart.cc/axiaoxin/vim-json-line-format)