Hacker News new | ask | show | jobs
Detrail: a dead-simple command line utility to fix trailing whitespace (github.com)
7 points by LINKIWI 3588 days ago
4 comments

Zero dependencies... Except nodejs, which on Debian has about 60 dependencies from memory.

this is the problem I have with the nodejs community.

I first learnt to write code using php. I still use php but that doesn't mean I don't also use shell scripts, lua, JavaScript, hell sometimes even Java.

Just because you can do something in nodejs, doesn't mean you should

sed 's/\s*$//g'
Funnily, that doesn't work as expected on OS X due to a rather old version of sed installed by default that doesn't support \s. Try the following instead:

  sed 's/[[:blank:]]*$//g'
Delete all trailing whitespace in vim:

  :%s/\s\+$//
I use the following two lines to highlight extra white spaces and clean them with a leader shortcut on vim.

    highlight ExtraWhitespace ctermbg=red guibg=red
    noremap <Leader>c :%s/\s\+$//g<CR>