VIM: Invisible Cursor
cursor background colors
I am on Lubuntu 14.04 using VIM - Vi IMproved 7.4 through xterm.
I would like to see my cursor in both "morning" and "shiny" color themes. Unfortunately by default both the background and foreground color are the same as the background, thus making it impossible to see where the cursor is.
The following attempts are solutions I found online.
_____________________________________________
Attempt 01:
http://alvinalexander.com/linux/vi-v...-scheme-syntax
I tried the 4 examples below:
Code:
highlight Comment ctermbg=DarkGray
highlight Constant ctermbg=Blue
highlight Normal ctermbg=Black
highlight Special ctermbg=DarkMagenta
The above commands successfully change the color for "comment, constant, Normal and Special" groups. However, the following just aren't the same:
Code:
highlight NonText ctermbg=Black
highlight Cursor ctermbg=Green
Both of the above two commands have no effect!
I try other background and foreground colors, but nothing works.
_____________________________________________
Attempt 02:
http://andrewradev.com/2011/08/06/ma...custom-colors/
I made sure the following was already in my /usr/share/vim/vim74/colors/am.vim colorscheme file:
Code:
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
:let g:colors_am = 'colorscheme_am'
Now when I execute :colors Cursor ctermbg=Black I get:
Code:
E185: Cannot find color scheme 'cursor ctermbg=Black'
E185: Cannot find color scheme 'Cursor ctermbg=Black'
So Andrew Radev's tutorial didn't work for me either.
_____________________________________________
Attempt 03:
https://unix.stackexchange.com/quest...ursor-in-vimrc Evan Teitelman
The only main answer talks about pasting commands in your ~/.Xdefaults or .Xresources file. I found an .Xresources in my ~ directory. But there is only the following line of content:
Code:
xterm*font: *-fixed-*-*-*-18-*
What part of this file should I paste this? Pasting it naturally to the end (2nd line) for the contents:
Code:
xterm*font: *-fixed-*-*-*-18-*
XTerm*cursorColor: #000000
URxvt.cursorColor: Black
I then saved, reopened vim, and I still can't see my cursor.
_____________________________________________
Attempt 04
https://unix.stackexchange.com/quest...ursor-in-vimrc Stephane Chazelas
Luckily, one of my favorites Stephane Chazelas had posted a solution, which I then typed into vim command mode, but the command
Code:
:printf '\033]12;#f50\7'
produces the following error message:
Code:
E492: Not an editor command: printf '\033]12;#f50\7'
I even tried pasting it into .Xresources:
Code:
xterm*font: *-fixed-*-*-*-18-*
printf '\033]12;#f50\7'
{fail}
_____________________________________________
Attempt 05:
http://vim.wikia.com/wiki/Configuring_the_cursor
I try pasting the following into my colorscheme (am.vim) file:
Code:
if &term =~ "xterm\\|rxvt"
" use an orange cursor in insert mode
let &t_SI = "\<Esc>]12;orange\x7"
" use a red cursor otherwise
let &t_EI = "\<Esc>]12;red\x7"
silent !echo -ne "\033]12;red\007"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\033]112\007"
" use \003]12;gray\007 for gnome-terminal
endif
Presto! I can now see my cursor(Normal: Red; Insert: Orange). But how to change to another color?
I am currently learning unix shellscripting, and even though the
Code:
echo -ne "\033]12;red\007"
looks really familiar from some earlier Prompt 1-4 tutorial I read before (as a reference):
Code:
Black Background bash prompt ANSI COLOR CODES bakblk='\e[40m'
Black Bold bash prompt ANSI COLOR CODES bldblk='\e[1;30m'
Black Regular bash prompt ANSI COLOR CODES txtblk='\e[0;30m'
Black Underline bash prompt ANSI COLOR CODES unkblk='\e[4;30m'
hicolor bash prompt ANSI COLOR CODES HC="\[\033[1m\]"
inverse background and foreground bash prompt ANSI COLOR CODES INV="\[\033[7m\]"
reboot bash prompt ANSI COLOR CODES UL="\[\033[4m\]"
Red Background bash prompt ANSI COLOR CODES bakred='\e[41m'
Red Bold bash prompt ANSI COLOR CODES bldred='\e[1;31m'
Red Regular bash prompt ANSI COLOR CODES txtred='\e[0;31m'
Red Underline bash prompt ANSI COLOR CODES undred='\e[4;31m'
reset bash prompt ANSI COLOR CODES RS="\[\033[0m\]"
Text Reset bash prompt ANSI COLOR CODES txtrst='\e[0m'
However, the rest is quite incomprehensible, thus I don't know how to change from "Red" for Normal mode and Orange for Insert mode to other colors for Normal/Insert modes.
Does anyone know how to change the cursor and NonText colors? My preferred colors for cursor background is black and for foreground is white?