I need a vim shortcut to display all non-duplicate struct
names in the file being edited. I have made this C program which does this, however I have to leave the editor and execute the program in bash
and return back to editing.
Lets say the file being edited is linux/drivers/net/ethernet/smsc/smsc911x.c
. The output should be like following:
0. smsc911x_data
1. smsc911x_ops
2. smsc911x_platform_config
3. phy_device
4. mii_bus
5. net_device
6. napi_struct
7. regulator_bulk_data
8. clk
9. platform_device
10. sk_buff
11. net_device_stats
12. netdev_hw_addr
13. sockaddr
14. ethtool_drvinfo
15. ethtool_eeprom
16. ethtool_ops
17. net_device_ops
18. resource
19. device_node
20. dev_pm_ops
21. of_device_id
22. platform_driver
EDIT: The Parse()
vim routine defined in the answer posted below doesn't prints all the struct names. It's output:
0. clk
1. device_node
2. ethtool_drvinfo
3. ethtool_eeprom
4. mii_bus
5. napi_struct
6. net_device
7. netdev_hw_addr
8. phy_device
9. regulator_bulk_data
10. resource
11. sk_buff
12. smsc911x_data
13. smsc911x_platform_config
14. sockaddr
I guess its because it is not able to handle cases like struct { ... } name;
:!./find_structs %
?