vim-shfmt icon indicating copy to clipboard operation
vim-shfmt copied to clipboard

Not running on save. Did I skip a step?

Open coolaj86 opened this issue 3 years ago • 1 comments

  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?

coolaj86 avatar Mar 27 '21 23:03 coolaj86

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)?

z0mbix avatar May 12 '21 20:05 z0mbix