-
-
Save iliojunior/455434a87b6bc08bc4049292f1b2cab0 to your computer and use it in GitHub Desktop.
Customize Atom tab titles to display folder and file name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just create 'init.coffee' in your .atom directory | |
# Add folder and filename to tab title | |
# Suggested when using many 'index.js' | |
# When the file name is 'index.js' it uses the last two paths | |
# EX: src/components/pages/Domain/SubDomain/index.js -> Domain/SubDomain | |
atom.workspace.observeTextEditors (editor) -> | |
if editor.getTitle() isnt "untitled" | |
pathNames = editor.getPath().split('/') | |
length = pathNames.length | |
title = pathNames[length - 1] | |
if pathNames[length - 1] == 'index.js' | |
title = pathNames[length - 3...length - 1].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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment