Using Vim and Ctags to Manage Large Projects
The usual workflow in developing an HPC application is to develop the code in local machines and then run the completed application in an HPC machine. There is no scenario where the entire application is directly developed on an HPC machine.
One problem I have encountered is that when you scale an application in an HPC machine, there may arise issues that were not encountered in the local machine. So you will have to make tweaks to your application in the HPC machine. This is a problem as the development tools you have used in the local machine may not be available in the HPC machine. For instance, I use VSCode to manage all my C/C++ projects as it makes it easy to peek into function definitions (and much more). While VSCode has a remote option to access the remote HPC machine, it is not as smooth as using it locally.
Ctags are one way you can manage large projects. While this is not an alternative to advanced code editors, this can enhance your Vim usage. You can install Ctags using the following:
sudo apt-get update && sudo apt-get install -y exuberant-ctags
Then tun the command
from your root project directory, to generate tags. If you want to exclude some directories from the tag generation you can use the --exclude flag to specify these directories.
ctags --recurse=yes --exclude=.git --exclude=./build
If these directories apply to all your projects you can specify them in the ~/.ctags file. Where the .ctags file will have the entries
--recurse=yes --exclude=.git --exclude=./build
Now if you want to open a file with that has the definition of the function print_task(), you can do that using
vim -t print_task
Now if you want to open a file that has the definition of the function print_task(), you can do that using
find_task(); print_task(); execute_task();
and you want to go to the file that has the function definition of print_task() then you use the vim command
This will take you to the file that has the definition of the function print_task(). If you just want to preview and not go to the file that has the definition of find_task() you can use the command
and the preview window can be closed using