aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin/window_title.vim
blob: af0ce01e4b3642896e8634be77c671ef9d9020b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
" window_title.vim - Window title handling {{{
"
" Author: Silvio Rhatto <rhatto@riseup.net>

" Basic settings {{{
set title
set titleold="terminal"
set titlestring=vim:\ %F
" }}}

" Handling titles when vim is embedded in specific programs {{{
augroup vimleave
  autocmd!
  au VimLeave *mutt/*   silent call ResetTitle("mutt")
  au VimLeave *remind/* silent call ResetTitle("calendar")
augroup END
" }}}

" Reset window titles {{{
"
" Thanks to http://stackoverflow.com/questions/1673649/vimrc-action-onclose
function! ResetTitle(title)
  " disable vim's ability to set the title
  exec "set title t_ts='' t_fs=''"

  " and restore it
  "exec ":!echo -e '\033kbash\033\\'\<CR>"
  exec ":!xtitle -q " a:title
endfunction
" }}}