All Projects → z0mbix → Vim Shfmt

z0mbix / Vim Shfmt

Licence: mit
Vim plugin for shfmt (https://github.com/mvdan/sh)

Labels

Projects that are alternatives of or similar to Vim Shfmt

Xcodecolorsense
🎈 An Xcode plugin that makes working with color easier
Stars: ✭ 79 (-8.14%)
Mutual labels:  plugin
Nodejs Ue4
Embed node.js as an unreal plugin.
Stars: ✭ 82 (-4.65%)
Mutual labels:  plugin
Xmake Vscode
🍩 A XMake integration in Visual Studio Code
Stars: ✭ 84 (-2.33%)
Mutual labels:  plugin
Betterdiscordapp
Better Discord App enhances Discord desktop app with new features.
Stars: ✭ 1,225 (+1324.42%)
Mutual labels:  plugin
Sentinl
Kibana Alert & Report App for Elasticsearch
Stars: ✭ 1,233 (+1333.72%)
Mutual labels:  plugin
Levelgenerator
Unity plug-in for procedurally generating indoor levels using abstract chunks.
Stars: ✭ 82 (-4.65%)
Mutual labels:  plugin
Pluginapplication
学习Android插件化必备demo
Stars: ✭ 79 (-8.14%)
Mutual labels:  plugin
Speed tools
敏捷开发工具包
Stars: ✭ 85 (-1.16%)
Mutual labels:  plugin
Phantom
Phantom — 唯一零 Hook 稳定占坑类 Android 热更新插件化方案
Stars: ✭ 1,238 (+1339.53%)
Mutual labels:  plugin
Metismenujs
MetisMenu: Collapsible menu plugin with Vanilla-JS
Stars: ✭ 84 (-2.33%)
Mutual labels:  plugin
Hidden Secrets Gradle Plugin
🔒 Deeply hide secrets on Android
Stars: ✭ 79 (-8.14%)
Mutual labels:  plugin
Obs Gnome Screencast
GNOME Screen Cast OBS Studio plugin
Stars: ✭ 80 (-6.98%)
Mutual labels:  plugin
Git Identity
Manage your identity in Git
Stars: ✭ 82 (-4.65%)
Mutual labels:  plugin
Craft Async Queue
Async Queue Handler for Craft 3
Stars: ✭ 80 (-6.98%)
Mutual labels:  plugin
Gajim Omemo
Gajim plugin for OMEMO Multi-End Message and Object Encryption
Stars: ✭ 84 (-2.33%)
Mutual labels:  plugin
Vue Rawmodel
RawModel.js plugin for Vue.js v2. Form validation has never been easier!
Stars: ✭ 79 (-8.14%)
Mutual labels:  plugin
Magane
Bringing LINE's sticker to Discord in a chaotic way.
Stars: ✭ 81 (-5.81%)
Mutual labels:  plugin
Flutter inappwebview
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
Stars: ✭ 1,259 (+1363.95%)
Mutual labels:  plugin
Audiokitsynthone
AudioKit Synth One: Open-Source iOS Synthesizer App
Stars: ✭ 1,258 (+1362.79%)
Mutual labels:  plugin
Fluttertoast
Flutter Toast
Stars: ✭ 84 (-2.33%)
Mutual labels:  plugin

Vim plugin for shfmt

The Vim shfmt plugin runs shfmt to auto format the current buffer by a command :Shfmt. If instead you prefer to format a textobject, say a paragraph, by gq, then add to the file after/ftplugin/sh.vim in your Vim configuration folder the lines

if executable('shfmt')
  let &l:formatprg='shfmt -i ' . &l:shiftwidth . ' -ln posix -sr -ci -s'
endif

and press, say gqip. Customize the options -ln posix -sr -ci -s to your liking.

Requirements

You just need the shfmt command

Installation

Obtain a copy of this plugin and place shfmt.vim in your Vim plugin directory or be sensible and use something like Plug:

Plug 'z0mbix/vim-shfmt', { 'for': 'sh' }

Usage

You can use the :Shfmt command to run shfmt and automatically format the current buffer

You can also use the :Shfmt command together with options. For example,

:Shfmt -p
:Shfmt -i 2

Configuration

shfmt uses tabs by default for auto formatting, so if you prefer to use 2 spaces, you can set the following in your .vimrc file:

let g:shfmt_extra_args = '-i 2'

Auto format on save

If you would like to auto format shell scripts on save, you can add the following to your vim config:

let g:shfmt_fmt_on_save = 1

License

The Vim shfmt plugin is open-sourced software licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].