]> gitweb.fluxo.info Git - metadot.git/commitdiff
Fix terminal title after leaving vim when running forked
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 9 Mar 2013 17:49:34 +0000 (14:49 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 9 Mar 2013 17:49:34 +0000 (14:49 -0300)
modules/vim/vimrc.dot.link

index 3490924fdb6ca63a12b24c8ee0212d51a23ff170..99b99db8cabebf75f6da5fd352f4efb518b56629 100644 (file)
@@ -18,6 +18,27 @@ set title
 set titleold="terminal"
 set titlestring=vim:\ %F
 
+" See http://vim.wikia.com/wiki/Automatically_set_screen_title
+"autocmd BufLeave    *        !xtitle mutt
+"autocmd VimLeavePre *        let &titlestring="mutt"
+"autocmd VimLeavePre *        !xtitle mutt
+"autocmd VimLeavePre *        !xtitle mutt
+"autocmd VimLeavePre *mutt*   let &titlestring="mutt"
+"autocmd VimLeavePre *remind* let &titlestring="wyrd"
+
+" 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 " a:title
+endfunction
+
+au VimLeave *mutt/*   silent call ResetTitle("mutt")
+au VimLeave *remind/* silent call ResetTitle("wyrd")
+
 " Folding
 set foldmethod=syntax
 let php_folding = 1
@@ -31,7 +52,7 @@ au BufNewFile,BufRead *.mdwn set ft=ikiwiki
 au BufNewFile,BufRead *.rem set ft=remind
 
 augroup mkd
- autocmd BufRead *.mkd  set ai formatoptions=tcroqn2 comments=n:>
+ autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:>
 augroup END
 
 if has("autocmd")