LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   cursor in vim / urxvt (https://www.linuxquestions.org/questions/linux-general-1/cursor-in-vim-urxvt-4175422804/)

sycamorex 08-18-2012 02:30 PM

cursor in vim / urxvt
 
I'm playing with my .vimrc


I'd like to change the shape of the cursor in vim (urxvt). I've found the following:

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

And changing the cursor shape.

Code:

if &term =~ '^xterm'
  " solid underscore
  let &t_SI .= "\<Esc>[4 q"
  " solid block
  let &t_EI .= "\<Esc>[2 q"
  " 1 or 0 -> blinking block
  " 3 -> blinking underscore
endif

It works fine for xterm, but I can't get it work in urxvt. I've changed the following:
Code:

if &term =~ "xterm\\|rxvt"
to "urxvt", "Urxvt", "^urxvt", "rxvt", "rxvt-unicode" but have no luck.

That's my .Xresources

Code:

XTerm*faceName: Inconsolata
XTerm*faceSize: 13
XTerm*cursorBlink: true
XTerm*cursorUnderLine: true
XTerm*saveLines:  32768
XTerm*locale: true
XTerm*utf8: 1
XTerm*termName: xterm-256color
XTerm*autoWrap: true

Xft.dpi: 96
Xft.antialias: 1
Xft.hinting: 1
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
Xft.autohint: 0

URxvt.font: xft:Inconsolata:pixelsize=17
URxvt.saveLines: 65535
URxvt.scrollBar: false
URxvt.depth: 32
URxvt*cursorUnderline: true
URxvt*termName: rxvt-unicode-256color
URxvt.perl-ext-common:  default,matcher
URxvt*urlLauncher:      /usr/bin/firefox
URxvt.matcher.button:  1
URxvt.internalBorder: 0
Rxvt*cursorBlink: true
Rxvt*visualBell: true


# Enabling Ctrl/Alt + arro keys for vim
URxvt.keysym.M-Up:      \033[1;3A
URxvt.keysym.M-Down:    \033[1;3B
URxvt.keysym.M-Right:  \033[1;3C
URxvt.keysym.M-Left:    \033[1;3D
URxvt.keysym.M-Prior:  \033[5;3~
URxvt.keysym.M-Next:    \033[6;3~
URxvt.keysym.M-End:    \033[1;3F
URxvt.keysym.M-Home:    \033[1;3H

URxvt.keysym.C-Up:      \033[1;5A
URxvt.keysym.C-Down:    \033[1;5B
URxvt.keysym.C-Right:  \033[1;5C
URxvt.keysym.C-Left:    \033[1;5D
URxvt.keysym.C-Prior:  \033[5;5~
URxvt.keysym.C-Next:    \033[6;5~
URxvt.keysym.C-End:    \033[1;5F
URxvt.keysym.C-Home:    \033[1;5H




Thank you.

catkin 08-21-2012 04:44 AM

Replying because nobody else has ...

Perhaps the &t_* settings do not work with urxvt. Perhaps &term is none of the values tried so far.

The &t_* settings could be tested with urxvt by removing the conditional test -- either by removing the if and endif lines or by adding an else.

Alternatively it should (TM) be possible to make vim display the value of &term. Could it be the value set by URxvt*termName: rxvt-unicode-256color ?

All of this would be trivial to investigate with a knowledge of the scripting language vim uses in .vimrc but my attempts to find a reference for it have found only bewilderingly complex examples of using it and nothing about the language itself.

sycamorex 08-21-2012 05:02 AM

Thanks. I'm at work now but I'll check it in the evening. Why didn't I think about it before? It makes sense:

1. It doesn't have to be a conditional statement.
2. I didn't see the correlation between the name set in .Xresources and the script.

I'll check it later.

sycamorex 08-21-2012 03:11 PM

It seems urxvt does not support vim's &t_* settings. I changed the name to the one mentioned in .Xresources with no luck. Then I removed the conditional bits and it works with xterm and sakura but still has no effect on urxvt. Interestingly enough it works in rxvt. How different are rxvt and rxvt-unicode?

catkin 08-24-2012 03:56 AM

AFAIK urxvt is very similar to rxvt apart from the Unicode extensions.

The best place to ask the current question might be the urxvt mailing list. Subscription is via http://lists.schmorp.de/mailman/listinfo/rxvt-unicode. In case it has been answered before it would be worth searching the mailing list archive at http://lists.schmorp.de/pipermail/rxvt-unicode/

sycamorex 08-25-2012 09:14 AM

Quote:

Originally Posted by catkin (Post 4762931)
AFAIK urxvt is very similar to rxvt apart from the Unicode extensions.

The best place to ask the current question might be the urxvt mailing list. Subscription is via http://lists.schmorp.de/mailman/listinfo/rxvt-unicode. In case it has been answered before it would be worth searching the mailing list archive at http://lists.schmorp.de/pipermail/rxvt-unicode/


Thanks catkin. I've already tried to subscribe to their mailing list twice. I have been waiting for any kind of confirmation for 2 days. A couple of hours ago I /joined their irc channel. I'm still the only person there.

Having said that, I've found a solution. Since rxvt and urxvt differ only in the unicode bit, it must have been something in my config that stopped urxvt from executing the script. I've done what I should've done in the first place, ie. comment out the urxvt entries in .Xresources. As one can guess, the culprit was:

Code:

URxvt*cursorUnderline: true
Cheers

sycamorex

catkin 09-08-2012 04:51 AM

Glad you found the solution :)
Quote:

Originally Posted by sycamorex (Post 4763930)
Thanks catkin. I've already tried to subscribe to their mailing list twice. I have been waiting for any kind of confirmation for 2 days.

Sorry -- I can't remember how the procedure went but do not recall any trouble. Maybe there was no confirmation; have you tried posting to the mailing list? I am happy to try to help if you like; contact via this thread or LQ PM.

sycamorex 09-08-2012 08:50 AM

Thanks catkin. The confirmation was delayed by afair 3 days. In the end I received 2 confirmation emails.


All times are GMT -5. The time now is 02:43 AM.