How to go to the current file?
Posted: 22.08.2022 06:36
One of the advantages of Cudatext is project management. It really can manage work by project and switch project is very easy and fast too, much quicker than vscode. But I have a question: How to go to the current file? or How to Locate the current file in the project tree?. When this is done, the folder tree on the project pannel is unfolded and the current file is focused in the tree.
There is not a shortcut or command to do so. I tried recording a macro including the following steps:
1. copy <filename> of the current file
2. go to <file name>
3. paste the copied <file name> in the dialog
4. press enter
step 1 and 2 in the macro works as expected.
But step 3 and 4 does not work automatically, I have to use mouse click, pressing Ctrl + V, then Enter.
I think three must be some better way to accomplish the last two steps, can anyone help?
Another requirement:
Perhaps the current project has not been opened when the macro is executed. If so, the cudatext should switch to the corresponding project before it can locate current file. This is possible because that Cudatext knows all the recent projects, and it can compare the current file's path with all the path stored in project settings. The correct path should be decided without difficulty.
This is what I know theoretically, but I don't know how to work out the code. Thanks in advance for anyone who do the work.
There is not a shortcut or command to do so. I tried recording a macro including the following steps:
1. copy <filename> of the current file
2. go to <file name>
3. paste the copied <file name> in the dialog
4. press enter
step 1 and 2 in the macro works as expected.
Code: Select all
# locate-current-file [Ctrl+J]
ed.cmd(cmds.cmd_CopyFilenameName)
app.app_proc(app.PROC_EXEC_PLUGIN, 'cuda_project_man,menu_goto,')
I think three must be some better way to accomplish the last two steps, can anyone help?
Another requirement:
Perhaps the current project has not been opened when the macro is executed. If so, the cudatext should switch to the corresponding project before it can locate current file. This is possible because that Cudatext knows all the recent projects, and it can compare the current file's path with all the path stored in project settings. The correct path should be decided without difficulty.
This is what I know theoretically, but I don't know how to work out the code. Thanks in advance for anyone who do the work.