Re: How to setup an external command to indent bash script?

2021-04-05 Thread Enno
This commit https://github.com/z0mbix/vim-shfmt/commit/1f0e72322a8cb38805c276f7f3d10e21822b5376 to the Readme of the vim-shfmt plugin explains how to set up &formatprg to indent shell scripts with shfmt. Le samedi 3 avril 2021 à 03:50:43 UTC+2, Gary Johnson a écrit : > On 2021-04-02, Peng Yu

Re: How to setup an external command to indent bash script?

2021-04-02 Thread Gary Johnson
On 2021-04-02, Peng Yu wrote: > > You can enable it in your vimrc for sh and bash files like this: > > > > au FileType sh setlocal equalprg=shfmt > > I put the above line in my ~/.vimrc. It just works. Thanks. > > It seems that this is the simplest solution. > > I don't know what is the adva

Re: How to setup an external command to indent bash script?

2021-04-02 Thread Gary Johnson
On 2021-04-02, Peng Yu wrote: > > According to the shfmt project page, https://github.com/mvdan/sh, > > someone has written a Vim plugin for shfmt, > > https://github.com/z0mbix/vim-shfmt. You may want to check that > > out, too. > > This probably is a better approach. I am trying to set it up. I

Re: How to setup an external command to indent bash script?

2021-04-02 Thread Peng Yu
> You can enable it in your vimrc for sh and bash files like this: > > au FileType sh setlocal equalprg=shfmt I put the above line in my ~/.vimrc. It just works. Thanks. It seems that this is the simplest solution. I don't know what is the advantage of the shfmt vim plugin is. Do you know?

Re: How to setup an external command to indent bash script?

2021-04-02 Thread Peng Yu
> According to the shfmt project page, https://github.com/mvdan/sh, > someone has written a Vim plugin for shfmt, > https://github.com/z0mbix/vim-shfmt. You may want to check that > out, too. This probably is a better approach. I am trying to set it up. I use pathogen. So I set it up like this.

Re: How to setup an external command to indent bash script?

2021-04-02 Thread Gary Johnson
On 2021-04-02, Peng Yu wrote: > On 4/2/21, 'Grant Taylor' via vim_use wrote: > > On 4/2/21 3:52 PM, Peng Yu wrote: > >> I want to use shfmt to indent bash script in vim instead of using the > >> default vim indenter. Could anybody show me how to set this up in vim? > > > > I would play with the fo

Re: How to setup an external command to indent bash script?

2021-04-02 Thread 'Grant Taylor' via vim_use
On 4/2/21 4:16 PM, Peng Yu wrote: It can take the file from STDIN in this way. The output is to STDOUT. Even better. Could you show me the commands... I don't know as I've not used formatprg in recent memory. I'd try interactively setting it and testing it with a file. Quickly poking at t

Re: How to setup an external command to indent bash script?

2021-04-02 Thread Peng Yu
On 4/2/21, 'Grant Taylor' via vim_use wrote: > On 4/2/21 3:52 PM, Peng Yu wrote: >> I want to use shfmt to indent bash script in vim instead of using the >> default vim indenter. Could anybody show me how to set this up in vim? > > I would play with the formatprg setting. > > :help formatprg > >>

Re: How to setup an external command to indent bash script?

2021-04-02 Thread 'Grant Taylor' via vim_use
On 4/2/21 3:52 PM, Peng Yu wrote: I want to use shfmt to indent bash script in vim instead of using the default vim indenter. Could anybody show me how to set this up in vim? I would play with the formatprg setting. :help formatprg shfmt -l -w script.sh Based on my read of the help section

How to setup an external command to indent bash script?

2021-04-02 Thread Peng Yu
I want to use shfmt to indent bash script in vim instead of using the default vim indenter. Could anybody show me how to set this up in vim? https://github.com/mvdan/sh#shfmt shfmt -l -w script.sh -- Regards, Peng -- -- You received this message from the "vim_use" maillist. Do not top-post!