How to show full path in atom title


#1

How to show full path of current editting file in atom title like sublime text ?

thanks !


How to change/customize atom Title Bar?
#2

:+1:

I’m aware I could probably put a little code in my init script to watch for changing of the tab and use document.title = filePath (or atom.workspaceView.setTitle(filePath)), but first off I’d have to try to find out if there is such an event as well as find out how to get the current editor’s file’s path.

Either way, it’d be great if this was built-in functionality and available in the settings pane.


#3

To have the full path in the title would be really nice. How can this not be the standard setting?


#4

The full title can be seen by hovering over the tab to get a tool tip.

The Tab text is got using either getTitle or getLongTitle. If there are 2 files open with the same name then getLongTitle is used to give a project root relative path, other wise getTitle just gives the filename.


#5

yes, it is useful when you edit files in a ruby on rails project, you may need to know which file you’re editing.

it’s in the status bar now, i don’t know how it was before. but its ok for me now.


#6

I have a package that can do this: https://atom.io/packages/custom-title

It uses an underscore.js template to generate the title. Here’s an example that copies the default title, but with the full path instead of filename:

<%= filePath %><% if (projectPath) { %> - <%= projectPath %><% } %>


#7

I was trying to get this to work as well. It seems like a pretty standard feature to be able to display the full pathname of the file in the Titlebar.

I tried to install postcasio’s package but got several errors:


npm http 200 https://registry.npmjs.org/title-case-minors/-/title-case-minors-0.0.2.tgz
npm ERR! notarget No compatible version found: map@'ianstormtaylor/map#0.1.1’
npm ERR! notarget Valid install targets:
npm ERR! notarget [“0.0.0”,“0.0.1”,“0.0.2”,“0.0.3”]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn’t exist.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command “d:\Program Files (x86)\Atom\resources\app\apm\node_modules\atom-package-manager\bin\\node.exe” “d:\Program Files (x86)\Atom\resources\app\apm\node_modules\atom-package-manager\node_modules\npm\bin\npm-cli.js” “–globalconfig” “d:\Program Files (x86)\Atom\resources\app\apm\node_modules\atom-package-manager\.apmrc” “–userconfig” “C:\Users\Doug\.atom\.apmrc” “install” “C:\Users\Doug\AppData\Local\Temp\d-1141025-11220-y7jffl\package.tgz” “–target=0.18.0” “–arch=ia32” "–msvs_version=2013"
npm ERR! cwd C:\Users\Doug\AppData\Local\Temp\apm-install-dir-1141025-11220-bfkjap
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.4
npm ERR! code ETARGET

Sorry I’m not used to npm, so I’m not sure what the problem is.


#8

Were you using npm or apm, @Ziflin?


#9

Maybe that’s the problem. I just downloaded the Windows file (a zip), and was running it, so I may need to install something else. As far as how I tried to install the package I just did it from Settings/Packages and search for it and clicked Install. And it gave me those errors.


#10

Ok, you were using apm then … which is built on top of npm, which is why you got those errors mentioning npm. Have you been able to install any Atom packages successfully?


#11

I just installed Zren’s “Open Recent” package and that worked fine.


#12

Maybe @postcasio will have some ideas then.


#13

Not sure what’s happening there. As far as I know none of the dependencies of custom-title include title-case-minors or map as dependencies, at least I can’t find them anywhere in my installed copy.

It looks like npm is looking in the wrong place for the module, too. It’s grabbing https://www.npmjs.org/package/map instead of the module on github.

Can you post the full log from npm?


#14

Here’s all the output I get when trying to install the package:

npm http GET https://registry.npmjs.org/event-kit
npm http GET https://registry.npmjs.org/loophole
npm http GET https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/loophole
npm http 200 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/event-kit
npm http GET https://registry.npmjs.org/grim
npm http 304 https://registry.npmjs.org/grim
npm http GET https://registry.npmjs.org/underscore-plus
npm http GET https://registry.npmjs.org/emissary
npm http 304 https://registry.npmjs.org/underscore-plus
npm http 304 https://registry.npmjs.org/emissary
npm http GET https://registry.npmjs.org/property-accessors
npm http GET https://registry.npmjs.org/mixto
npm ERR! not found: git
npm ERR! 
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "d:\\Program Files (x86)\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\bin\\\\node.exe" "d:\\Program Files (x86)\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "d:\\Program Files (x86)\\Atom\\resources\\app\\apm\\node_modules\\atom-package-manager\\.apmrc" "--userconfig" "C:\\Users\\Doug\\.atom\\.apmrc" "install" "C:\\Users\\Doug\\.atom\\.node-gyp\\.atom\\.apm\\custom-title\\0.6.4\\package.tgz" "--target=0.18.0" "--arch=ia32" "--msvs_version=2013"
npm ERR! cwd C:\Users\Doug\AppData\Local\Temp\apm-install-dir-1141025-6808-bvpkvt
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.4
npm ERR! code ENOGIT
npm http 304 https://registry.npmjs.org/property-accessors
npm http 304 https://registry.npmjs.org/mixto
npm

#15

It appears you don’t have git installed or not in your path. What happens if you type git on the command line?


#16

Oddly I noticed that the first time, but the second time I got the 1st set of errors. Not sure why it’s showing two sets of errors.

I’m using SourceTree for git with its embedded git, so it’s not in the path. I didn’t know that git was required for plugin packages to work?

(Also, thanks for all the quick responses. Y’all have been very helpful!)


#17

I’m not sure why it was required. I just saw it in the error message.

Try: http://git-scm.com/download/win


#18

Yes I noticed it as well, it’s perfect like this.


#19

Good stuff. Your custom-title package plus <%= filePath %><% if (projectPath) { %> - <%= projectPath %><% } %> worked like a charm @postcasio


#20

Google took me here when I was really looking to customize the tab titles rather than the entire project title. I ended up writing a snippet shows how to customize them.

# 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('/') # gives name of containing folder along with filename
        editor.getTitle = -> title
        editor.getLongTitle = -> title

for item in atom.workspace.getPaneItems()
    if item.emitter?
        item.emitter.emit "did-change-title", item.getTitle()