z0mbix / vim-shfmt

Vim plugin for shfmt (https://github.com/mvdan/sh)
MIT License
132 stars 11 forks source link

Not running on save. Did I skip a step? #9

Open coolaj86 opened 3 years ago

coolaj86 commented 3 years ago
  1. I've installed shfmt:
    curl -sS https://webinstall.dev/shfmt | bash
  2. I've installed vim-shfmt in the vim 8 plugin style:
    mkdir -p ~/.vim/pack/plugins/start/
    git clone --depth=1 https://github.com/z0mbix/vim-shfmt.git ~/.vim/pack/plugins/start/shfmt
  3. I've created a file with the options I want:
    ~/vim/plugins/shfmt.vim
    let g:shfmt_extra_args = '-i 4 -sr -s'
    let g:shfmt_fmt_on_save = 1
  4. I've sourced that file in my ~/.vimrc:
    " Shfmt: TODO add to Webi
    source ~/.vim/plugins/shfmt.vim

Now if I run :Shfmt I can see that it indents, but it's not indenting on save.

What have I misunderstood or done wrong?

z0mbix commented 3 years ago

Are your settings actually in ~/vim/plugins/shfmt.vim or was that a typo?

also, is the file you’re editing detected as a shell script (filetype sh)?