4

:set title enable the prompt of the title of the file in the window title.

How can I change the content of this title? For example, I want to give My pattern before the filename every time it is edited. How to modify or change the pattern of title through vim commands?

9

As stated in :h title:

When on, the title of the window will be set to the value of 'titlestring' (if it is not empty), or to:

filename [+=-] (path) - VIM

Where:

  filename    the name of the file being edited
  -       indicates the file cannot be modified, 'ma' off
  +       indicates the file was modified
  =       indicates the file is read-only
  =+      indicates the file is read-only and modified
  (path)      is the path of the file being edited
  - VIM       the server name |v:servername| or "VIM"

So you'll want to modify the content of titlestring.

See :h 'titlestring' for examples and explanations.

| improve this answer | |
  • Everytime, i closed vim, i got a message like 'thanks for using vim'. I wanted to change this. I tried with :au VimLeave * set title titlestring=Mytext as well as :au BufLeave * set title titlestring=Mytext. But when I close vim, Mytext is not set as the title. Why? – SibiCoder Apr 28 '16 at 8:35
  • But that is not what you described in your question, is it? And I have never seen such a message when leaving Vim... You should edit your question with a clear description of your problem, a screenshot of this message and also a description of how you installed Vim because I have never heard of a version which prompted such a message – statox Apr 28 '16 at 8:53
  • Thanks statox. My question is different. I read the help and tried. That works. I just wanted to know whether its possible to change when closing a file – SibiCoder Apr 28 '16 at 8:58
  • 3
    Regarding your 'thanks for using vim' message, I suggest you read :h titleold. Other wise, the comments should not be used to ask new question (but rather add details/ask for precisions on existing question). If you have another issue, please ask another question. – nobe4 Apr 28 '16 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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