Tag: vim

  • The Legacy of Bram Moolenaar

    The Legacy of Bram Moolenaar

    This weekend we learned that Bram Moolenaar had passed away at the age of 62. And this news affected me more than I expected.

    Like so many: I did not know Bram personally. But I’ve been using a tool made by Bram for more than half my life — at least weekly, sometimes daily.

    That tool is a text editor. The best one there is: Vim.

    Bram Moolenaar (source: Wikipedia)

    Vim

    For those wondering: a text editor, what’s so special about that?

    Vim is not like any other piece of software. Vim is a special piece of software. The most apt description I could find is this one:

    Vim is a masterpiece, the gleaming precise machining tool from which so much of modernity was crafted.

    This description is not a hyperbole.

    Vim is the tool that was there when software took over the world. When modernity was created — i.e. everything we owe to computers — Vim was there.

    An essential tool to all of it.

    Like a power-drill, hammer or screwdriver, Vim is also a tool. A means, not an end. And a specific tool you must learn to use.

    And undoubtedly, various alternatives exist, yet Vim sets itself apart as a true precision instrument that, in the hands of adept users, has the power to craft exquisite and practical creations while eliciting immense pleasure and fulfillment in the process. Much like a skilled carpenter or watchmaker equipped with an array of specialized tools, Vim caters to those who engage earnestly with computers. Its seamless functionality and versatility provide a deeply gratifying experience, granting users the ability to shape their digital work with finesse and artistry.

    Another way to describe Vim is that Vim is a programmable editor. It’s the editor that you give commands — i.e. that you programas you program.

    When you learn Vim, when you use Vim, when you create with Vim; it becomes an extension of you. It’s a way of working, but more importantly: a way of thinking. Being sufficient in Vim is being able to almost work at the speed of thought. In a way, Vim is the closest thing to a neuralink we have.

    But this post is not about Vim (I highly recommend this video if you want to learn more), this post is about Bram.

    Bram

    Bram worked on Vim almost daily for over 30 years. Constantly tightening and improving it. An almost unprecedented achievement. A true labor of love.

    And you notice this when you use Vim. Everything works smoothly, it is fast and rock-solid. I can’t remember a single time in over 20 years when Vim froze or crashed.

    Vim, like many successful innovations, owes its origins to the contributions of those who came before. It stands on the shoulders of giants. It began as an imitation, derived from a port of a clone based on an idea by Bill Joy. However, Bram Moolenaar emerges as the true architect of Vim’s triumph and the evolution of vi-like editors. Bram is the giant on which they stand.

    Through Bram’s skillful craftsmanship, Vim has become an unparalleled piece of software that brings immense joy and satisfaction to its users. I vividly recall a moment 22 years ago when I had to ask someone how to close the editor, and the memory of that initial blush of shame has not faded entirely. And, even today, I find myself continuously discovering new features and capabilities in Vim, a testament to its rich and ever-expanding potential.

    Bram gave the world something very rich and powerful.

    And, Bram never asked for a penny for this. What Bram asked (at most) was to donate something, anything, to his foundation: ICCF Holland. In previous Vim versions, you would sometimes also see this friendly request when you started Vim.

    Vim’s code is open and free in the traditional sense, and Vim can be considered charity-ware, with its own license (which is compatible with GPL and more).

    And what all these little facts tell you is maybe all you need to know about Bram.

    And everything I’ve read over the past few days — herehereherehere and here  (and many more places) — about Bram confirms this image.

    The image of a hyperintelligent, dedicated, and selfless human-being.

    Someone who has made a major impact on the world of computer science.

    A Mensch.

    Someone who liked to share.

    (When I think of Bram I always think of his personal site where he shared his photos.)

    Sad

    Perhaps all these things add up to why it hit me when I read the news that Bram had passed away. In the message, his family made it clear that Bram was ill (‘a medical condition that progressed quickly over the last few weeks‘). This was unknown to most people and made the news all the more surprising.

    And it made me even sadder when someone pointed out Bram’s recent GitHub activity.

    Source

    The activity slowly fades away. It’s like a bright light went out and no one noticed.

    Bram’s legacy

    Vim is so intertwined with everything I do that I never doubted for a second that I can continue to use Vim. But when you see the GitHub activity, you can’t escape the thought that Vim was Bram and Bram was Vim. And Bram was of course the Vim BDFL for a reason.

    When someone like Ian Murdock passed away, there were clear structures in place that never put Debian in jeopardy. And when Linus Torvalds dies, I expect it to be the same.

    But is that also the case with Vim – Bram’s life work? I read on the mailing list that a number of longtime contributors will continue Vim. Of course. But what strikes me is that even those people — who were so close to the project — did not know about Bram’s medical condition. That must have been Bram’s deliberate choice and let’s respect that. But it does raise questions about the future of Vim.

    Time will tell what happens next. But one thing is certain. Vim is not going away. And Bram’s legacy is not a GitHub activity chart. Bram and Vim’s spirit are everywhere. Whether it is in new emerging editors or in the letters j and k that you show up in all kinds of unexpected places. Vim, the way of working, the way of thinking — the programmable editor — is an extremely powerful and valuable idea. One that’s been perfected by Bram and captured in the form of an almost perfect piece of software honed over 30 years. And even if Vim were to disappear, which I don’t expect, that idea is certainly not going to disappear. And that is Bram’s legacy.

    If you want to: please contribute and donate what you can in memory of Bram Moolenaar.

  • Auto insert date when starting Vim

    I have a file where I keep notes & ideas. And I try to have as less friction as possible to add ideas to this file. To achieve this I made it so that when I am at my terminal

    • I type one letter;
    • The file opens in insert mode;
    • the current date and time are inserted;
    • and Vim starts a new line with a space indentation so I can start typing, right away.

    I edited just two files to achieve this.

    .bashrc

    An alias in .bashrc to type just one letter and start the file in Vim in insert mode:

    ~/.bashrc
    alias i="vim -c 'startinsert' /home/jan/notes/ideas.txt"
    

    .vimrc

    I added two lines to my .vimrc.

    The first inserts the date: 2021-11-05 21:40:50 (conform ISO 8601).
    The second start a fresh new line with four spaces.

    ~/.vimrc
    autocmd VimEnter ideas.txt $pu=strftime('%Y-%m-%d %H:%M:%S')
    autocmd VimEnter ideas.txt $pu='    '
  • My Vim setup

    The following lines are in my .vimrc file and make working with Vim all the better!

    I keep it pretty basic, so I don’t use the very popular fugitive.vim or NERDTree plugin.
    Put these lines in ~/.vimrc or /etc/vim/vimrc (depending on your distro, sometimes they are already there but need to be uncommented), and you’re good to go.

    As for a font, I like the Liberation Mono font (11pt).

    My .vimrc file

    Explanation

    :command W w
    :command Wq wq
    :command WQ wq

    I mapped these key combinations so when I type too fast and make mistakes; Vim still does what I want it to do (save or save & quit).

    syntax on

    Some people don’t like syntax highlighting, I do.

    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

    This is the most complicated line in the config, but probably also most useful! When you re-open a file your cursor will be where you left of. Indispensable.

    set fileencodings=utf-8

    UTF-8 all the things, yes please.

    filetype plugin indent on

    This is the only (non-default) plugin I use. It is actually a combination of commands, but most importantly it will try to recognize filetypes and apply file specific settings (e.g. syntax highlighting)

    set expandtab
    set tabstop=4
    set shiftwidth=4

    Ok, now we’re entering dangerous territory. I actually like tabs, but spaces are more file friendly/portable. So why not ‘map’ the tab to four spaces? With these three settings, I can use tabs, but Vim will enter 4 spaces and everbody wins.

    set t_ti= t_te=

    Normally when you exit Vim, the screen will clear, and you will be back to the prompt as if nothing happened. I don’t like this, I want to see whatever it was that I was working on. With this setting I return to the prompt and see the Vim screen above.

    set showmatch " Show matching brackets.

    You want this. Especially with bracket hungry languages like PHP. Stop searching for a brackets/parentheses, Vim will highlight the matching pairs.

    set ignorecase " Do case insensitive matching

    Insensitive matching is the best, I don’t have to worry how something was spelled when searching for words.

    set incsearch " Incremental search

    When searching through a file (/) the cursor will move while typing. For some this may be disorienting, but you will find what you’re looking for with less typing.

    colorscheme molokai

    Vim comes with some preinstalled colorschemes, I tend to like molokai. It is clean, crisp, non-intrusive even on a xterm-256 terminal emulator. When I switched servers, I switched the color scheme back to default. But molokai is still pretty nice.