[ Back | warped.org ]

CDE And Vim -- Getting Color, and the PageUp PageDown keys

Brief

I am forced to use CDE on a Sun Machine that I need to use for my classes. I like Vim, It is good. But I couldn't get the page up and page down to work, and the crappy version of xterm that is installed by default does not have color for syntax highlighting. The PageUP and PageDOWN are mapped to control the ever useless scroll bar.

HOWTO - DTTERM

  1. Use DTTERM ("Terminal") which supports color
    • There are three terminal programs in CDE : "Xterm" which executes xterm, "Terminal" which executes dtterm and "Console" which executes 'dtterm -c'
    • Open any of theses
    • Execute dtterm -bg black -fg white +sb -vb -xrm *menuBar:false
      The +sb gets rid of scroll bars
      The -vb turns off the bell.
      The xrm bit turns off the menu bar.
    • Make a little shell script to open a term window with your favorite settings. mine is :
      #!/bin/sh
      
      HOSTNAME=`hostname`
      dtterm +sb -bg black -fg white -vb -title $HOSTNAME -xrm *menuBar:false -geometry 115x50 & 
      
      (all one line)
  2. Modify the .Xdefaults to change the default keymap that is set for the PageUp and PageDown settings.
    • add this one line to your ~/.Xdefaults :

      *DtTerm*Translations: #override\n<Key>osfPageUp: vt-edit-key(prior)\n <Key>osfPageDown: vt-edit-key(next)

    • Run this command to use the file you just ran :

      xrdb -merge $HOME/.Xdefaults

    • Re Open dtterm and enjoy
  3. To Override the location of the VIM syntax and Help files :
    Add this to your ~/.vimrc at the VERY top
    helpfile=/usr/local/share/vim/vim57/doc/help.txt
    syn on
  4. To swap Control + Caps Lock and Alt and Meta (make the sun keyboard act like a PC keyboard ) :
    • File: .xmodmap
      ! Swap Cap_lock and Control 
      !remove Lock = Caps_Lock
      !remove Control = Control_L
      !keysym Control_L = Caps_Lock
      !keysym Caps_Lock = Control_L
      !add Lock = Caps_Lock
      !add Control = Control_L
      !
      ! Make Cap_Lock control as well as control 
      ! For some reason you have to clear the control keys
      ! before doing this, and then readd them.   
      !
      clear control 
      clear lock
      keysym Caps_Lock = Control_R
      add control = Control_L Control_R
      !
      ! Swap Alt and diamond 
      !remove mod1 = Alt_L 
      !remove mod4 = Meta_L
      !keysym Alt_L = Meta_L
      !keysym Meta_L = Alt_L 
      !add mod1 = Alt_L 
      !add mod4 = Meta_L
      !
      ! Make Diamond alt
      remove mod4 = Meta_L
      add mod1 = Meta_L
      
    • Run xmodmap ~/.xmodmap
  5. Make sure you invoke vim not vi (the OLD version that ships with solaris)
  6. To get things to start up automatically in CDE :
    • ~/.dt/sessions/sessionetc
      Make this file executable (chmod +x sessionetc)
      #!/bin/sh
      
      HOSTNAME=`hostname`
      xmodmap $HOME/.xmodmap
      xrdb -all -merge $HOME/.Xdefaults
      dtterm -bg black -fg white -sb -vb -geometry 100x40 -C -title $HOSTNAME -xrm *menuBar:false &
      

HOWTO - XTERM

SanJeev K gave me this information as well for doing the same thing w/ Xterm:

Add this line to your .Xdefaults and run xrdb like above:

XTerm.VT100.Translations: #override\<Key>osfPageUp: string(prior)\n\ <Key>osfPageDown: string(next)

links

  • Vim - The best text editor there is.
E-mail if this does you any good.

If this information helped you, consider exiting through your right. ©2000-2013 Max Baker
Sun Apr 27 22:32:16 2008 PST