fold-navigator package for Atom text editor
It helps you navigate your code folding points within Atom. It takes the lines where the folding points are and lists them with their indentation to give you an overview of your code.
It serves a similar purpose to the minimap package but with a different approach.
I was missing Netbeans code navigator so much I had to come up with something which helps me navigate through my code in Atom.
You could use this if you only wanted to see, let's say a list of methods in a class. In which case you might not care what is at indentation level 5. This is a screen shot where max indentation is set to 1. This (and all settings btw) can be grammar specific.
A list of commands available to you to navigate within the folds.
- previousFold (ctrl-alt-cmd-up)
- nextFold (ctrl-alt-cmd-down)
- moveLevelUp (ctrl-alt-cmd-left)
- moveLevelDown (ctrl-alt-cmd-right)
- nextFoldAtCurrentLevel
- previousFoldAtCurrentLevel
I now use fold-navigator this way and I don't use the navigation panel at all. ctrl + alt + cmd + shift opens the fuzzy search where I find my fold point and hit enter. This will open the fold and close all other folds.
You can toggle the folding at a specific level. It might be helpful when you are reading someone else's code and you want to get a quick overview of what is going on at the different indentation levels.
Typically Atom will only unfold the very fold you have clicked on and not the folds under it. This command will toggle all sub folds within a fold. Currently it is assigned to ctrl-alt-cmd-/ and yes it would be nicer if I could override the double click Atom opens fold with but I don't yet know how to do that. So maybe in the future.
All the options can be defined per language (grammar) bases but for now it only supports one language per editor. So it will not support mixed content like html + javascript.
Language specific settings are in your config.cson which you have to edit manually. You will find most of what you need here http://flight-manual.atom.io/using-atom/sections/basic-customization/
- It only works if your code is indented and well formatted. I use https://atom.io/packages/atom-beautify to achieve this.
- You must open the fold navigator panel at least once after you have started Atom to be able to use this package. This is because fold-navigator does not start/activate when Atom starts. Use ctrl-alt-cmd-[ to open the fold navigator panel. If you find this to be a pain you can work around it as mentioned here: turigeza#8
- Skype on a Mac uses one of the shortcuts (ctrl-alt-cmd-up) globally. So if you find your shortcuts don't work it's most likely because of Skype. If you find a way around this please let me know.
Try it and see. Feel free to suggest and let me know if you have any issues/bugs.
Happy coding! : )