Skip to content

Instantly share code, notes, and snippets.

@dhbradshaw
Last active September 24, 2021 08:06
Show Gist options
  • Save dhbradshaw/fcd67df6564eae64a0a5 to your computer and use it in GitHub Desktop.
Save dhbradshaw/fcd67df6564eae64a0a5 to your computer and use it in GitHub Desktop.
Customize tab titles in atom text editor.
# place this snippet into init.coffee in ~/.atom directory
atom.workspace.observeTextEditors (editor) ->
if editor.getTitle() isnt "untitled"
sp = editor.getPath().split('/')
title = sp.slice(sp.length-2).join('/')
editor.getTitle = -> title
editor.getLongTitle = -> title
for item in atom.workspace.getPaneItems()
if item.emitter?
item.emitter.emit "did-change-title", item.getTitle()
@sebilasse
Copy link

Please note if anyone needs it just because of multiple 'index.…' tabs, a CSS solution is possible too
[in Atom -> Stylesheet add:]

.tab-bar .tab .title[data-name^="index"] {
letter-spacing: -1px;
direction: rtl;
text-align: left;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment