Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am editing multiple files located in the same folder, in multiple tabs, on a single terminal.

pwd(directory in which I am currently working) is displayed on the top of the heading of the terminal, but not the name of the file I am editing. It gets confusing when working with multiple files in the same directory.

How to display the name of the current file on the top of the terminal in addition to the pwd.

I am running vim in a bash shell in gnome-terminal, on 12.04 LTS.

share|improve this question
1  
Editing using what editor? In which shell? Which terminal emulator? –  terdon Mar 24 at 6:24
    
@terdon - Editing using Vim,bash Shell, xterm emulator –  malhar Mar 24 at 6:29
2  
Please edit your question to add extra info, it is hard to read and easy to miss in the comments. You can then ping the user who asked for the information by leaving a comment and including a @ before their username. For example, to ping me: @terdon. –  terdon Mar 24 at 6:31
    
xterm has no tabs. Are you sure this is xterm? echo $TERM usually does not return the name of your terminal emulator if that's what you did. –  terdon Mar 24 at 6:36
    
@terdon Yes, I did use echo$TERM. it outputs "xterm". I am using 64 bit ubuntu 12.04 LTS default terminal. Are there any other ways to check details of emulator. –  malhar Mar 24 at 6:43

2 Answers 2

up vote 10 down vote accepted

You must to have/create a file named .vimrc in your home directory with the following code inside:

let &titlestring = $USER . "@" . hostname() . " " . $PWD . "/" . expand("%:t")
if &term == "screen"
  set t_ts=^[k
  set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
  set title
endif

enter image description here

Source: gnome-terminal does not allow changing the title

share|improve this answer

You can append the name of the file you are editing in a tab in the following manner:

  1. go to the Menu on top of the terminal. Terminal-> Set Title-> Here you append the name of the file you are currently editing

e.g. when you open the terminal , the heading of the terminal shows only "~". pwd shows /home/xxx/

Suppose at this location, you are editing a file ABC.cpp, you can set title of the tab to "~/ABC.cpp" by appending "/ABC.cpp" in Set Title field.

Similarly, you can repeat this for other tabs too.

share|improve this answer
2  
And you will do these changes every time when you edit another file? Sounds painful... –  Radu Rădeanu Mar 24 at 7:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.