Create a gist now

Instantly share code, notes, and snippets.

@JeffreyWay /.vimrc Secret
Created Feb 23, 2016

What would you like to do?
Auto-sort your PHP 'use' statements by length.
"Sort PHP use statements
vmap <Leader>su ! awk '{ print length(), $0 \| "sort -n \| cut -d\\ -f2-" }'<cr>

JeffreyWay commented Feb 23, 2016

Visually select the set of 'use' statements, and then press <Leader>su to sort them by length.

You're so good to us. I get particularly annoyed that PHP CS Fixer doesn't do this with their Vim plugin

Thank you, for sharing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment