Vim

I’ve been away from Ubuntu for a while and just installed Xubuntu 9.10 on an Acer Aspire One.  While editing some of the files, I remembered that pressing the cursor keys in insert mode inserts characters.

This is because of vi compatible mode and is easily redressed by adding “set nocompatible” in “~/.vimrc”.  I understood from this page that this was the default but I might be misreading.  It seems to be a peculiarity of Ubuntu, I didn’t notice this in RHEL, Arch or Fedora (three distributions I use fairly regularly).

Is this an indicator that vim is not perhaps as popular in Ubuntu?  I notice that most times I see a guide online it will suggest using gedit, even if invoked from the terminal.  Perhaps, as I’m not au fait with Debian, our lineage prefers the compatible mode.

I’m sure its not important and we all have our preferences for editors but I do like vim and wish that this behavior was default.  One of the paradoxes with OSS, GNU/Linux in particular, is the freedom afforded allowing us to configure our environments in whatever fashion we prefer creates a diversity that is difficult to train new users, especially between distributions.

This entry was posted in Linux, Rant, Ubuntu and tagged , , . Bookmark the permalink.

18 Responses to Vim

  1. Rick Harding says:

    The default vim install in Ubuntu OOTB is vim-tiny. You have to install vim-full and such to get all the goodies. It’s partly due to space reasons on the default install disk I think.

    Like or Dislike: Thumb up 0 Thumb down 0

    • Dougie says:

      Cool but like I asked Mackenzie, why does this affect vi compatibility? Correct me if I’m wrong but the system wide vimrc is provided by the vim-common package, which is installed by default.

      As I understand it but am likely wrong, set nocompatible is the default vim-tiny behaviour, so what is changing this setting – when the common installed files set it?

      Like or Dislike: Thumb up 0 Thumb down 0

  2. Mackenzie says:

    Ubuntu doesn’t include vim. It used to include vim-tiny, which acts like vi (and does not support “set nocompatible”). Now it doesn’t even have that. Only nano is installed by default.

    Like or Dislike: Thumb up 0 Thumb down 0

    • Dougie says:

      vim-tiny is in Xubuntu. If it isn’t supported, why does it have the desired effect?

      Like or Dislike: Thumb up 0 Thumb down 0

      • Mackenzie says:

        My .vimrc includes “set nocompatible” but with vim-tiny it still acts like vi, not vim, so I’m pretty sure vim-tiny just plain doesn’t support using arrow keys.

        And again: vi, vim, vim-tiny…NONE of these are included in 9.10.

        Like or Dislike: Thumb up 0 Thumb down 0

        • Dougie says:

          Not disputing that they aren’t in Ubuntu, I installed Xubuntu though – where vim-tiny still has a home – it’s listed in Synaptic and this system has a default install.

          Like or Dislike: Thumb up 0 Thumb down 0

          • Mackenzie says:

            Ooooh I didn’t think that’d be something that’d vary by Xubuntu, Kubuntu, Ubuntu. I’m actually a Kubuntu user. I just assumed all 3 would include the same command line tools but just different graphical ones.

            Like or Dislike: Thumb up 0 Thumb down 0

          • Dougie says:

            I thought that was a little odd too, I think we generally tend to view the different flavours as only differing by interface but it seems not to be the case.

            Although I’ve used XFCE a lot, Xubuntu is fairly new to me having used Gnome until recently but I have noticed a lot of little differences.

            Like or Dislike: Thumb up 0 Thumb down 0

          • Tom Wright says:

            Just reinstalling Ubuntu at the moment and vim-tiny certainly is there (thank goodness). Makes sense that KUbuntu of all derivatives would be missing it in any case as (in my experience) KDE users just tend to use Kate anyway.

            Like or Dislike: Thumb up 0 Thumb down 0

    • Tom Wright says:

      What, no Vim?

      All-right, now I am angry…

      Like or Dislike: Thumb up 0 Thumb down 0

      • Dougie says:

        Its likely a product of the era that I cut my teeth on computers but I must admit to thinking of the GUI as a nicety.

        Both early Linux and even Windows 3.11, the GUI was something initiated from the terminal. Even if you detested terminal editing, you would have had to do it to write your xf86config file to have got the GUI up and running!

        Like or Dislike: Thumb up 0 Thumb down 0

        • Tom Wright says:

          Yes, I suppose now we have the best of both worlds; we have awesome editors but don’t need them just to get the computer to boot up.

          The one thing I worry about now though is whether I might be stranded on shared systems without Vim, a fate not worth thinking about (just having vim-tiny does not bother me too much).

          Like or Dislike: Thumb up 0 Thumb down 0

  3. Ryan says:

    This is one of the things that has always bugged be in Ubuntu–it’s been this way since I started using it way back with 5.10. However, I thought they corrected it in 9.04, because I installed a 9.04 server and it had a better vim installed from the get go. Might have just been a side effect of the install recommends defaults, though.

    Like or Dislike: Thumb up 0 Thumb down 0

  4. dominik says:

    I came from gentoo to debian and ubuntu and noticed the same: When running “vim”, the cursor keys aren’t recognized as move cursor but as char sequence. Only the good olde _hjkl_ keys work for moving the cursor. My first thought was “wth?! we’re almost in 2010 and my favourite editor is configured for not accepting the cursor keys…?”

    I quickly noticed, that there actually isn’t vim installed but vim-tiny. I think this default sucks. IMHO there are many users who are familiar with vim (+ use the cursor keys instead of hjkl), but aren’t aware that the command “vim” actually runs a very stripped down clone of vi. A simple apt-get install vim solves this issue, but for “experienced” users it might look odd when using the freshly installed system. (Yes, I know that vim(full) takes several MB diskspace and vim-tiny is….well, tiny)

    Like or Dislike: Thumb up 0 Thumb down 0

    • Tom Wright says:

      Actually the command vim does not do anything by default, the vi command acts like the old Vi editor though.

      Like or Dislike: Thumb up 0 Thumb down 0

  5. dominiko says:

    > I remembered that pressing the cursor keys in
    > insert mode inserts characters.

    This is because by default, Vim runs in compatible mode
    which means that ‘esckeys’ is off, among other things.

    Cursor keys can be made to work in insert mode by doing
    “:set esckeys”. You can also make them work with
    “:set nocompatible” since this involves switching on
    ‘esckeys’.

    You can read about it in “:help ‘esckeys’”.

    I’m a bit disappointed to hear that vim-tiny is not
    installed by default in Ubuntu. It’s a small package
    and Linux is not Linux without Vi.

    Anyway, any serious Vim user will install vim-full
    or compile the latest Vim from sources since vim packages
    are always lagging behind many patches.

    Like or Dislike: Thumb up 0 Thumb down 0

    • Dougie says:

      I mentioned compatible mode in the second paragraph!

      Like or Dislike: Thumb up 0 Thumb down 0

    • dominik says:

      >I’m a bit disappointed to hear that vim-tiny is not
      >installed by default in Ubuntu.

      Uhm, you meant vim(full), right? On my fresh install there was
      vim-tiny installed (ubuntu and debian)

      Like or Dislike: Thumb up 0 Thumb down 0

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>