Rename the TAB, not the file.
I am a StreamServe developer.
I have a lot of services that I am monitoring manually.
StreamServe projects run over multiple services at our company.
Every service has a logfile that is named: “log.txt”
Very creative off cause, but it means that I have many tabs open that are all named the same.
I would like to be able to distinct between the tabs by, for instance, renaming that tab.
Currently…there is a way to rename the tab, but only on unsaved files.
If I rename a tab of a saves file, the the file itself is also renamed and then everything breaks in my case.
It the a way to rename a tab and leave the filename unchanged?
It the a way to rename a tab and leave the filename unchanged
Nope. For a tab with a file, rather than unsaved contents, the tab’s name is the file’s name.
You have five colors you can apply to tabs, which can help distinguish them. However, with the numbers of similarly-named files you are implying, five colors probably isn’t enough for you.
So I don’t think the feature you want currently exists.
@Rens-Duijsens As PeterJones noted, at present there is nothing baked into Notepad++ that allows you to rename the tabs.
I have a couple of thoughts:
You can create symbolic links to your log files that have unique names and open those in Notepad++. Here is an example of how to do it from a command prompt:
rem Create a set of 99 log file directories md c:\Logs for /l %i in (1,1,9) do @md c:\Logs\0%i for /l %i in (10,1,99) do @md c:\Logs\%i rem Create a set of 99 log files, all named log.txt for /l %i in (1,1,9) do @>c:\Logs\0%i\log.txt echo 0%i for /l %i in (10,1,99) do @>c:\Logs\%i\log.txt echo %i rem This part needs to be done from an administrative command prompt. rem Create a set of 99 uniquely named symbolic links to our log.txt files for /l %i in (1,1,9) do @mklink c:\Logs\0%i.txt c:\Logs\0%i\log.txt for /l %i in (10,1,99) do @mklink c:\Logs\%i.txt c:\Logs\%i\log.txt rem Open the 99 uniquely named symbolic links to our log.txt files np c:\Logs\??.txt
When doing this I discovered that mklink needs to be run from an administrative command prompt. Hopefully is an option for you. It seems odd as creating a symbolic link itself is not something that needs administrative rights.
In the last line I opened the 99 log files using
np c:\Logs\??.txt. np.bat is my own shortcut to Notepad++. You likely have your own way of starting Notepad++.
Another option is to create a batch file than opens the desired log file. For example, in my example I have 99 logs numbered from 01 to 99. I could create a batch file named olog.bat and use it like
olog 1… to
olog 99. The batch file would add the leading 0 if needed, generate the correct path to the log.txt file I want to open, and then would open that file using Notepad++. This would allow me to jump to the desired log.txt tab in Notepad++. It would not solve the underlying issue of 99 tabs named log.txt but I can at least quickly get to a specific log file.
Finally, from within Notepad++ you could use the window picker thing from the menus at
Window / Window.... The window picker shows the full path to each file/tab.
@Rens-Duijsens - Earlier I wrote about using
One minor change to what I posted earlier is to use
mklink /Hinstead of a plain
/Hversion creates a hard link. Hard links only work for files (not directories) and only work within the same drive. A hard link on C: only works for files on C: for example.
The benefits are that you don’t need to create them from an administrative command prompt and they are quite efficient within the Windows file system. They even look like normal files regardless of how you use them. Hard links increment the reference count for the data. There is no “parent” file when using hard links. All of the files reference the same data object on the disk.
use mklink /H instead of a plain mklink
Yes, this is a good approach to meeting the OP’s desire.
However, what it needs is a little bit of a script wrapper (to prompt for the new “name”) and a tab-right-click-context menu customization that will run the script.
At that point, it really IS possible to rename the tab.
The mklink /H solution is what I’d call a Notepad++ “pro tip”. :-)
use mklink /H instead of a plain mklink
However, what it needs is a little bit of a script wrapper …
It’s possible that the project names or whatever it is then generates the log files don’t change often. In that case, a one time setup from the command prompt, without bothering with scripting it, will do.
It’s also possible the log files live on different servers and the OP is accessing them via drive shares. In that case,
mklink /Hwon’t work. However, the
mklinkversion without the
/Hwill work but also requires extra steps. If the OP is in this situation then Google for mklink, the error message, maybe “drive share” will lead to forums where solutions get guessed at.
As I am trying to keep this as a Notepad++ oriented post. I guess I can say that a colorful Notepad++ flew by my office window but then we’d get distracted discussing its size, arrangement of feathers, etc…
Something else is that when you hover the mouse on a tab in Notepad++ the hover-tip has the full path.
On my machine file://c:/some-path gets underlined in Notepad++ and can be double-clicked to open the file. I have some projects that include sets of related text files. I have been in the habit of adding an
Also seesection at the tops of the files that contain links to all of the files in the project. That allows me to Ctrl-Home to the top of a file and then to double-click the
Also seelink for the file I want to view. If the file is not open then Notepad++ opens it. If it’s already open then Notepad++ jumps to that tab. It still means the tabs would say “log.txt” but I at least can reliably get to the one I’m seeking with a little effort. I put the
Also seeon the same line in each file and they have the same layout meaning the screen instantly jumps to the desired file and I can easily jump around between the files as the text in the area of the the mouse is not changing.
Web browsers do not offer the ability to rename tabs but each site offers an icon file that the browsers include with each tab. We look at the bower tabs and get used to using the icons to know which tab is the one we are seeking. That concept may be an interesting and potentially useful add-on to Notepad++. It would be a mapping table that translates a file path into the icon, color styling, and text to display on that tab for that file path.