Reputation: 5227
I have a .c file with a bunch of functions. Is there some way to put these functions in alphabetical order in vim?
Upvotes: 4
Views: 650
Reputation: 721
If you use the vim Taglist plugin. Which is the top rated and most downloaded plugin for vim.
http://vim-taglist.sourceforge.net/
Then you can easily view the functions ordered alphabetically or in the order they are defined.
By adding the following line to your vimrc file, the default order will be alphabetical.
let Tlist_Sort_Type = "name"
You can press the 's' key in the Taglist tab to toggle the order.
search for "Tlist_Sort_Type" in the link below for the official docs:
http://vim-taglist.sourceforge.net/manual.html
Upvotes: 0
Reputation: 1439
If you have lots and lots of functions in one file and you want do it automatically, then we can do it one more "Long" way. Again it depends on how the code is organized. Let say if code is always organized like:
<return Type>
FunctionName(Arguments)
{
/* Code */
}
i know this is not efficient way just giving one more way to do it :)
Upvotes: 2