Skip to content

Instantly share code, notes, and snippets.

@tribou
Created September 17, 2017 22:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tribou/53b508b65b390183e4b23678e5b0816f to your computer and use it in GitHub Desktop.
Save tribou/53b508b65b390183e4b23678e5b0816f to your computer and use it in GitHub Desktop.
Customize Atom tab titles to display folder and file name
# Add folder and filename to tab title
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
editor.emitter.emit "did-change-title", editor.getTitle()
atom.workspace.onDidOpen (event) ->
for item in event.pane.items
if item.emitter?
item.emitter.emit "did-change-title", item.getTitle()
@iliojunior
Copy link

Thanks saved my life!

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