iTerm, vi with arrow movements

Discussion in 'Mac Apps and Mac App Store' started by acidity, Oct 8, 2007.

  1. acidity macrumors regular

    Joined:
    Sep 7, 2006
    #1
    Hi

    I login to my company server through SSH using iTerm. There when I start vim, I cannot move my cursor using arrow keys. I have to use h,j,k,l.

    Any idea why does this happen? I can use the arrow keys when I login from Konsole on my other other machine.
     
  2. danwestbrook macrumors regular

    danwestbrook

    Joined:
    Oct 11, 2007
    Location:
    Surrey, UK
    #2
    yes i fixed this issue on mine by doing the following

    1) sudo cp /etc/bashrc /etc/bashrc (backs up the file)
    2) sudo vi /etc/bashrc (used terminal not iterm)
    3) insert the following line "TERM=linux"
    4) save the file
    5) enjoy iterm and vi using the arrow keys :)
     
  3. Mumford macrumors regular

    Mumford

    Joined:
    Oct 8, 2006
    Location:
    Altadena, CA
    #3
    That doesn't back up any file. That overwrites the file with itself.

    You shouldn't edit the system bashrc for this. Just edit ~/.bashrc. Also, use 'export TERM=linux' so the environment variable gets passed on to sub-shells. Or use 'vi -T linux'.
     
  4. TemeculaMac macrumors regular

    Joined:
    Aug 8, 2007
    #4
    My suggestion...learn to use the h,j,k, and l keys. Once you force yourself into using these, it's 10x faster moving around. Look at this hurdle as a perfect opportunity to sharpen those vi skills. There's no way you can get me to use the arrow keys now....

    Good luck!
     
  5. abackstrom macrumors newbie

    Joined:
    May 4, 2010
    #5
    The arrow keys are used for more than just moving the cursor around. They're how you navigate history (ie. searches and commands) and they're also used for some plugin menus. So, not quite as simple as "sharpen those vi skills."

    I needed to fix this live within vim, so I cycled through each of <xUp>, <xDown>, <xRight>, and <xLeft> doing this:

    :set <xUp>=(ctrl-V)(up arrow)

    Which output this on the screen:

    :set <xUp>=^[[A

    The ^[[A (or more specifically, the ^[) is a single terminal sequence rather than the character ^ followed by the character [; the ctrl-V causes the up arrow to be written out as text rather than treated as an action by vim.
     

Share This Page