1. Vincent Tsai
  2. colorschemes

Commits

Vincent Tsai  committed c6a4fb8

improve cursor color feature

  • Participants
  • Parent commits 917eb12
  • Branches default

Comments (0)

Files changed (2)

File diablo3.vim

View file
  • Ignore whitespace
 let s:color_insert = 'DarkGoldenrod1'
 let s:color_exit = 'azure4'
 if &term =~ 'xterm\|rxvt'
-  exe 'silent !echo -ne "\e]12;"' . s:color_normal . '"\007"'
+  exe 'silent !echo -ne "\e]12;"' . shellescape(s:color_normal, 1) . '"\007"'
   let &t_SI="\e]12;" . s:color_insert . "\007"
   let &t_EI="\e]12;" . s:color_normal . "\007"
-  exe 'autocmd VimLeave * :!echo -ne "\e]12;"' . s:color_exit . '"\007"'
+  exe 'autocmd VimLeave * :!echo -ne "\e]12;"' . shellescape(s:color_exit, 1) . '"\007"'
 elseif &term =~ "screen"
-  if exists('$TMUX')
-    exe 'silent !echo -ne "\033Ptmux;\033\e]12;"' . s:color_normal . '"\007\033\\"'
-    let &t_SI="\033Ptmux;\033\e]12;" . s:color_insert . "\007\033\\"
-    let &t_EI="\033Ptmux;\033\e]12;" . s:color_normal . "\007\033\\"
-    exe 'autocmd VimLeave * :!echo -ne "\033Ptmux;\033\e]12;"' . s:color_exit . '"\007\033\\"'
-  else
-    exe 'silent !echo -ne "\033P\e]12;"' . s:color_normal . '"\007\033\\"'
-    let &t_SI="\033P\e]12;" . s:color_insert . "\007\033\\"
-    let &t_EI="\033P\e]12;" . s:color_normal . "\007\033\\"
-    exe 'autocmd VimLeave * :!echo -ne "\033P\e]12;"' . s:color_exit . '"\007\033\\"'
+  if !exists('$SUDO_UID')
+    if exists('$TMUX')
+      exe 'silent !echo -ne "\033Ptmux;\033\e]12;"' . shellescape(s:color_normal, 1) . '"\007\033\\"'
+      let &t_SI="\033Ptmux;\033\e]12;" . s:color_insert . "\007\033\\"
+      let &t_EI="\033Ptmux;\033\e]12;" . s:color_normal . "\007\033\\"
+      exe 'autocmd VimLeave * :!echo -ne "\033Ptmux;\033\e]12;"' . shellescape(s:color_exit, 1) . '"\007\033\\"'
+    else
+      exe 'silent !echo -ne "\033P\e]12;"' . shellescape(s:color_normal, 1) . '"\007\033\\"'
+      let &t_SI="\033P\e]12;" . s:color_insert . "\007\033\\"
+      let &t_EI="\033P\e]12;" . s:color_normal . "\007\033\\"
+      exe 'autocmd VimLeave * :!echo -ne "\033P\e]12;"' . shellescape(s:color_exit, 1) . '"\007\033\\"'
+    endif
   endif
 endif
 unlet s:color_normal

File lemon256.vim

View file
  • Ignore whitespace
 let s:color_insert = 'DarkGoldenrod1'
 let s:color_exit = 'azure4'
 if &term =~ 'xterm\|rxvt'
-  exe 'silent !echo -ne "\e]12;"' . s:color_normal . '"\007"'
+  exe 'silent !echo -ne "\e]12;"' . shellescape(s:color_normal, 1) . '"\007"'
   let &t_SI="\e]12;" . s:color_insert . "\007"
   let &t_EI="\e]12;" . s:color_normal . "\007"
-  exe 'autocmd VimLeave * :!echo -ne "\e]12;"' . s:color_exit . '"\007"'
+  exe 'autocmd VimLeave * :!echo -ne "\e]12;"' . shellescape(s:color_exit, 1) . '"\007"'
 elseif &term =~ "screen"
-  if exists('$TMUX')
-    exe 'silent !echo -ne "\033Ptmux;\033\e]12;"' . s:color_normal . '"\007\033\\"'
-    let &t_SI="\033Ptmux;\033\e]12;" . s:color_insert . "\007\033\\"
-    let &t_EI="\033Ptmux;\033\e]12;" . s:color_normal . "\007\033\\"
-    exe 'autocmd VimLeave * :!echo -ne "\033Ptmux;\033\e]12;"' . s:color_exit . '"\007\033\\"'
-  else
-    exe 'silent !echo -ne "\033P\e]12;"' . s:color_normal . '"\007\033\\"'
-    let &t_SI="\033P\e]12;" . s:color_insert . "\007\033\\"
-    let &t_EI="\033P\e]12;" . s:color_normal . "\007\033\\"
-    exe 'autocmd VimLeave * :!echo -ne "\033P\e]12;"' . s:color_exit . '"\007\033\\"'
+  if !exists('$SUDO_UID')
+    if exists('$TMUX')
+      exe 'silent !echo -ne "\033Ptmux;\033\e]12;"' . shellescape(s:color_normal, 1) . '"\007\033\\"'
+      let &t_SI="\033Ptmux;\033\e]12;" . s:color_insert . "\007\033\\"
+      let &t_EI="\033Ptmux;\033\e]12;" . s:color_normal . "\007\033\\"
+      exe 'autocmd VimLeave * :!echo -ne "\033Ptmux;\033\e]12;"' . shellescape(s:color_exit, 1) . '"\007\033\\"'
+    else
+      exe 'silent !echo -ne "\033P\e]12;"' . shellescape(s:color_normal, 1) . '"\007\033\\"'
+      let &t_SI="\033P\e]12;" . s:color_insert . "\007\033\\"
+      let &t_EI="\033P\e]12;" . s:color_normal . "\007\033\\"
+      exe 'autocmd VimLeave * :!echo -ne "\033P\e]12;"' . shellescape(s:color_exit, 1) . '"\007\033\\"'
+    endif
   endif
 endif
 unlet s:color_normal