I would like to sort some lines, ignoring a leading part of them.
Here's an example from my .spacemacs
file:
'(
better-defaults
elixir
emacs-lisp
erlang
evil-commentary
finance
git
haskell
html
ivy
javascript
lua
markdown
my-eshell
my-org
nginx
nixos
(org :variables org-projectile-file "TODO.org")
python
(ruby :variables ruby-test-runner 'rspec)
shell-scripts
spell-checking
(syntax-checking :variables syntax-checking-enable-tooltips nil)
vinegar
yaml
)
I would like to sort these, but I need to ignore the leading (
for that.
Similarly, here's an excerpt from my configuration.nix
:
packages = with pkgs; [
## Basics
atool
bashInteractive
entr
ethtool
fasd
fd
file
fzf
git
git-crypt
gitAndTools.hub
google-cloud-sdk
gparted
hdparm
htop
i7z
inotify-tools
iperf
lm_sensors
neovim
p7zip
parted
pwgen
ripgrep
sshfs
# tarsnap
tmux
tree
unzip
wget
xclip
zip
];
Here, I would like to sort the lines, ignoring the leading #
part.
How would I do this in Vim?
I'm aware of :sort /\v# /
, but that would only sort lines that match the pattern, then ignore the pattern for sorting.