sag47 |
09-03-2012 02:44 PM |
I usually use vim. Here's a couple of navigation tips.
Here are some good shortcuts. HINT: ^W means CTRL+W keyboard shortcut.
vim Terminology
buffer - a file loaded into memory (not always displayed in the current window)
key sequence - mode invoked - description - gf - normal "command" - when cursor is over a file name it will follow and open the file. It subsequently adds that file to your list of buffers to be accessed.
- :ls - normal "command" - show a list of buffers
- :b N - normal "command" - where N is an integer. Replaces the current window with the contents of the buffer. List buffers using :ls.
- ^W n - normal "command" - open a blank window. You can load other buffers into the blank window.
- ^W [hjkl] - normal "command" - navigates to other windows when screen is split. Use only one letter of the list [hjkl].
- ^W f - split window and edit file name under the cursor
To learn more about vim and it's many uses run the following command to learn it.
To learn more about the commands I listed above see the following help documentation within vim. For the help documentation when you see ^W you literally type ^W. - :help ^W
- :help sp
- :help :ls
- :help gf
- :help :b
- :help :sb
- :help gt
- :help gT
It's pretty useful for navigating any document which links other files due to its ability to follow linked files relative to the path of the working directory. In C programs, it correctly follows headers to their source files.
Lastly, find and grep are great utilities for figuring out where a function shows up in a source tree when paired with other files. Here's an example where I'm looking for which files contain the function tree() but don't necessarily care how many times the function is referenced (just which files it shows up in).
Code:
cd /path/to/src/code/
grep -ir 'tree(' * | cut -d: -f1 | sort -u
That is almost invaluable when reverse engineering code.
SAM
|