back to article Old-school editor Vim hits version 9 with faster scripting language

Old-school editor fans, rejoice: some two and a half years after version 8.2, Vim 9 is here, and with a much faster scripting language. Vim 9 has only a single big new feature: a new scripting language, Vim9script. The goal is to "drastically" improve the performance of Vim scripts, while also bringing the scripting language …

  1. Nate Amsden

    never knew

    Been using vi since early 90s not sure when I switched to vim assuming ~20 years ago for the most part. Certainly not an expert with it though I use it daily(am mostly comfortable with regular vim too). Never knew it had a scripting language. Unsure as to the purpose, I browsed the linked man page for vim 9 which talks about the scripting language but no indication as to what the purpose of it is. Searching for the text "why" on the manual page indicates perhaps the scripting language may be used for vim plugins? (am unsure if I use any, don't know what might be a plugin vs built in I don't use anything but the defaults). Curious if anyone else can clarify, is it just for plugins or something else too.

    On that note want to mention how much I hate the newer vim mouse interfaces, first encountered for me on Ubuntu 20 (which has vim 8), not sure if it is just new to vim 8 or perhaps older, but to disable that crap I always have to put ":set mouse-=a" in my ~/.vimrc (which is the first time I can recall ever using ~/.vimrc). Those new things were driving me insane before I figured out how to turn them off.

    1. Yet Another Anonymous coward Silver badge

      Re: never knew

      The new scripting language just starts up Emacs in the background

    2. yetanotheraoc Silver badge

      Re: never knew

      "Unsure as to the purpose"

      There are many. https://developer.ibm.com/tutorials/l-vim-script-5/ (Also 1..4).

      I use vimscript to mkfifo when opening a certain filetype, and another vimscript to append the current line to the named pipe whenever the line selection changes. An external script reads the fifo, overwrites the html in a local file, and executes xdotool F5. So I have a dependent Firefox window that follows the current line and shows the same information in graphical form. It takes all of an hour to set up something like this.

      I take no credit -- it's just using Unix tools the way they were intended. Glue this bit to that bit and the other bit, et voilà! A working customized file viewer with vi-power editing capability.

      1. Joe W Silver badge

        Re: never knew

        Much syntax highlighting, bracket closing, auto-indenting stuff is implemented using scripts. If you ever edited the .vimrc file you actually did use that stuff. Do you need to able to write it? Hell, no! Having the script being complied and not just evaluated at runtime will speed stuff up (if you use lots of extensions). Otherwise it will be a "meh" change for you. I like it, I'm looking forward to it landing in Debian (I guess... in 2030 or so, I have patience).

    3. Clausewitz4.0 Bronze badge
      Devil

      Re: never knew

      Agree. Also a hater of the mouse interface enabled by default.

  2. Primus Secundus Tertius

    Others preferred

    Personally, I prefer Geany or Scite, which resemble word processors rather than traditional programmers' editors.

    1. Yet Another Anonymous coward Silver badge

      Re: Others preferred

      If you have a totally borked machine you know vi will still run.

      Otherwise I use VS code like everyone else.

      Although it does confuse the younglings when you fire up vi to edit a config file

      1. Adrian 4

        Re: Others preferred

        'like everyone else.'

        Really ? I don't think so.

      2. nematoad Silver badge
        Thumb Up

        Re: Others preferred

        It's a strange thing, but mc is widely used and is the first thing I install when doing a rebuild, but not many people seem to know about mcedit.

        I took a Redhat course and the instructor was greatly surprised when I told him that the editor I use for .config scripts was mcedit. He had never heard of it and he was the instructor!

        It's simple and it works, oh and the key bindings are of course the same as the mc ones.

        1. jake Silver badge

          Re: Others preferred

          For you Slackware users out there, mc and mcedit are both included in the default installation.

          For those of you who don't know, mc is Midnight Commander, a clone of the old MS-DOS utility Norton Commander that has been tweaked for the *nix environment. It's a useful tool, and a lot more powerful than it looks at first glance. I use it near daily. Recommended.

          Free hint: Be extremely careful if you choose to run mc as root ... it will do exactly what you tell it to do. Don't say I didn't warn you.

        2. CrazyOldCatMan Silver badge

          Re: Others preferred

          but mc is widely used

          Indeed. And I can clearly remember it's great grand-daddy Norton Commander..

          From the days when Norton was actually a decent company that produced decent toolsets!

          1. jake Silver badge

            Re: Others preferred

            "it's great grand-daddy"

            Cousins, perhaps. They share no code, and were contemporaries for several years.

            Interestingly, NC only lasted 12 years ('84 to '96), whereas mc has been around since '94, 28 years and counting (last update 27th of March).

            One of the beautiful things about FOSS is that it will be with us until the heat death of the Universe, whereas corporations (and corporate code) is ephemeral.

      3. yetanotheraoc Silver badge

        Re: Others preferred

        "If you have a totally borked machine you know vi will still run."

        Supposed to be ed for that. Annoyingly, my current Linux distro does not install ed by default. (No, I will not be writing any emails about it.) So the fallback is ex, which turns out to be a symlink to vim.

        1. Yet Another Anonymous coward Silver badge

          Re: Others preferred

          ed is normally vi in ed mode

          1. jake Silver badge

            Re: Others preferred

            ed is a small, stand-alone line editor and has nothing to do with vi. Handy when scripting. I think the last time I used ed to manually edit something was back in 1983ish (over a modem at around 2,400, fixed a b0rKen Sun 2/170).

            1. stiine Silver badge
              Happy

              Re: Others preferred

              Wow! You had a 2400 baud modem in 83ish? We still had a rack full of 1200baud modems when I left the college at the end of 93. Of course, a dumb not-quite-Wyse terminal and 1200 baud modem taught me to touch type much more quickly than my highschool course. Of course I found out the hard way, by dropping DTR that my terminal/modem connection wasn't configured for xon-xoff...

              1. jake Silver badge

                Re: Others preferred

                You're right. It was probably only 1200. Was a pair of Hayes Smartmodems. The 2400s (and v.22bis) came around a year or so later. One thing I do remember is that it was a Pilot build Sun 2/170, making this roughly late 1983.

            2. Yet Another Anonymous coward Silver badge

              Re: Others preferred

              Yes sorry got ed and ex mixed up. When I first saw it I thought it was very clever that you could have a program change behaviour if it was run from a symlink with a different name

              1. jtaylor

                Re: Others preferred

                very clever that you could have a program change behaviour if it was run from a symlink with a different name

                Yes, a marvellous use of reading in the first word of a command line as an argument (arg0) to the command itself.

        2. jake Silver badge

          Re: Others preferred

          These days, ex is usually a symlink to vim. In the old days, vi was built on top of ex.

    2. ElReg!comments!Pierre

      Re: Others preferred

      "Personally, I prefer Geany or Scite, which resemble word processors rather than traditional programmers' editors."

      I do use vim as my editor of choice on my desktop machines but I am open to discussion on that matter. The thing I like most about vim is being able to ssh to a remote server and get directory parsing, coloured syntax, advanced search, scripting, the whole lot. It helps tons when debugging undocumented legacy software. Try running Geany over ssh and tell me how it went ;)

      1. Michael Wojcik Silver badge

        Re: Others preferred

        vim is my editor for all text-based files on all the platforms I work on that support it. (IBM mysteriously have not yet added vim to ISPF yet.)

        I've been a professional software developer since '88, and had to use a lot of editors and IDEs before and since. I'm not saying I'd recommend anything in the vi family to anyone, but I've used vi, then vim (and gvim on Windows, due to some sort of occasional issue with running Windows vim under Cygwin bash that I can't be bothered to sort out) for too long to be inclined to switch to anything else.

        Also, I hate every IDE I've ever used; none of them come close to the power of shell + my editor of choice + my debugger of choice + POSIX text tools + a decent build system and so forth. I really do not see the appeal of having a lot of not-really-very-good tools baked into the build system, when much better ones are available right there on the command line, and are trivially scriptable.

  3. OhForF' Silver badge
    Trollface

    Old school editor fans, rejoice

    Old school editor fans already complained when vim first arrived and changed vi - why would they rejoice with yet another new version of it messing up their time proven original vi?

    1. karlkarl Silver badge

      Re: Old school editor fans, rejoice

      I thought NeoVim was a great solution to people "tinkering" with the tried and tested Vim. All the weird broken stuff could go in that project, leaving Vim alone!

      Luckily we still have (n)vi. I personally find Vim's over-flexibility an issue; it makes it a little fussy and fragile. Plus couple (n)vi with tmux (and a few ratty scripts) or simple job control and you have something remarkably usable, even by todays "standards".

    2. Denarius Silver badge

      Re: Old school editor fans, rejoice

      Yeah, wot about using ed scripting? It is useful when borked machine is barely running and very short of ram

  4. JessicaRabbit

    If only Vi could be relied upon to be installed. Most Debian based systems these days seem to come with nano installed but not Vim :(

    1. karlkarl Silver badge

      Really? I find the opposite.

      Plus Vi is part of POSIX so that is unlikely to change.

      It is usually the vim-tiny package which means the command is indeed vi rather than vim.

      1. Androgynous Cupboard Silver badge

        A pox on vim-tiny. "apt install zsh vim" is the first thing I type on a new install

        (in case any old-timers are reading - it's for the multiple undo buffers, nothing heretical)

        1. karlkarl Silver badge

          If you only need "full fat Vim" for multiple undo buffers I *think* you might be able to get away with the default vim-tiny.

          Just make sure that your .vimrc has "set nocompatible" in there. This will disable the Vi compatibility and give you a more complete Vim experience. This I believe has the multiple delete buffers if I recall.

        2. stiine Silver badge

          Who wants that?

          What I want is the ability to hit undo repeatedly after returning from the fridge/toilette/bar and be able to see what I changed last blink to my keypresses...and then try to figure out why...

          1. Kabukiwookie
            Happy

            Re: Who wants that?

            and then try to figure out why...

            Ah. I see you're coding Perl.

            1. stiine Silver badge

              Re: Who wants that?

              Alas, I don't code in Perl, only bash.

    2. mIVQU#~(p,

      This is a pet hate of mine too.

  5. jake Silver badge

    What's Vi?

    $ Vi

    bash: Vi: command not found

    $ which Vi

    which: no Vi in (/usr/local/bin:/bin:/usr/bin)

    $

    With that said, I usually use elvis ... but I also have nvi, stevie and Vim installed JIC. I also have Nano and various other editors (yes, I use Midnight Commander where appropriate). It's not like you are limited to one, and only one, text editor. Most are small and take virtually no disk space in modern terms, so install and try all of 'em!

    Except EMACS, of course ... but that's hardly just a text editor ... but then, neither is today's Vim.

    1. Joe W Silver badge
      Pint

      Re: What's Vi?

      I see your mistake, after all proper operating systems are case sensitive (not all proper programming languages are, because I still like FORTRAN, yes, I am weird, and maybe I'm old as well... THAT IS NOT THE POINT! geez... anyway...)

      It should be

      $ which vi

      /usr/bin/vi

      kids today...

      1. jake Silver badge

        Re: What's Vi?

        "I see your mistake"

        My mistake?

        1. Liam Proven (Written by Reg staff) Silver badge
          Trollface

          Re: What's Vi?

          [*Distant auctorial mirth*]

          1. jake Silver badge

            Re: What's Vi?

            Just trolling? You should be ashamed of yourself.

            I'd have blamed ed. [Over my dead body. —ed]

      2. Clausewitz4.0 Bronze badge
        Devil

        Re: What's Vi?

        ..Vim is the standard version of the classic vi text editor on most Linux distros, and if there is one xNix editor that every xNix user should know, it's Vi."

        I believe jake is making fun of the writer for not addressing vim in the correct case-sensitive manner.

    2. chroot

      Re: What's Vi?

      You forgot or missed nvim (neovim) in that list.

  6. ElReg!comments!Pierre
    Trollface

    Vigor

    I'll be leavig now

    1. Gerhard den Hollander

      Re: Vigor

      Sadly not even vim9 includes vigor

      1. jake Silver badge

        Re: Vigor

        vimgor exists, but is badly in need of updating.

        https://vim.sourceforge.io/vimgor/

        Maybe if I get a free minute ...

        1. Liam Proven (Written by Reg staff) Silver badge

          Re: Vigor

          [Author here]

          Oh, gods, I'd managed to blank that from my memory. Inspired. One might even say...

          evil.

          No, seriously, the thing I'd like to see updated is Cream:

          http://cream.sourceforge.net/

  7. stiine Silver badge

    new features? who cares?

    As long as they don't break the at&t unix System V compatibility mode, I don't care.

  8. Irony Deficient

    Vim 9 has only a single big new feature: a new scripting language, Vim9script.

    I guess that version 9 still lacks true bidirectional support — even the emulation of Unicode directional formatting characters, to allow the graceful display of e.g. Yiddish letters in left-to-right order by preceding them with the LRI character (U+2066) and following them with the PDI character (U+2069), would have been welcome.

  9. chroot

    Yet Another Vim Scripting Language

    Why? Because we can? There aren't enough scripting languages to choose from?

  10. Jay 2

    There can be only one. Probably.

    Once upon a time (back when I was being taught sys admin on NCR UNIX) it was drilled into me that vi would be available when you'd installed a new server, but not necessarily other editors. This was back in the day when you had to work out what you wanted to install and size partitions accordingly etc. So since then I've just used vi(m). I'm sure at one point I did briefly use Emacs, but it obviously never stuck.

    Meanwhile, can't say I knew vim had a scripting language!

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like