Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set terminal title to current file name and path with Vim

I would like Vim to send the name of the currently open file to macOS Terminal.

It is possible to tell the macOS terminal the filename of a currently open document by sending the escape sequence \e]6;FILENAME\a. This can be seen be executing the command printf "\e]6;FileName.txt\a"

I would like Vim to send the filename of the currently open document to Terminal. It seems like this should be easy, but :echo "\e]6;FileName.txt\007" will turn the escape sequences into printable characters and add some color to them, so it instead outputs ^[]6;FileName.txt^G which is not recognized by Terminal.

How can I configure :echo not to mangle my escape sequences?

like image 964
Pat Hawks Avatar asked Mar 20 '18 03:03

Pat Hawks


1 Answers

Thank you @romainl; this was as simple as adding set title to my ~/.vimrc file.

like image 68
Pat Hawks Avatar answered Nov 10 '22 21:11

Pat Hawks