pathterminuspages/blog/aboutcontactabout me

Joining the editorwar

09-03-2018

Don't say atom.

OK. So I have finally decided to join the editor war. And I have chosen side.

When I first switched to Linux, I used gedit. It's a fairly expressible editor. I then mostly did JS, html and PHP. When I started studying computer science, I had to learn F#. And for that I actually needed indent guides, not only for the cool hacker look they provide, but also because F#, like Python, and some other languages, are sensitive regarding indentation. We were more than recommended Emacs, but trying to adapt to it's interface gave me a headache. After some research I found Geany. People in my class recommended Visual Studio Code, the internet recommended Atom, so I tried these three simultaneously ending up using Geany. The two others are simply to slow and bloated for me. Geany however does not have native support for F#. So I had to configure a custom highlighter using a C lexer. It worked OK. The mayor problem was that id's beginning with capital letters in F# are types/classes. My latest approach is to add F# start and end comments, (*, *), //, to the Haskell lexer and recompile Geany. This has worked OK. Geany is a very good editor, it's an ide, it's extremely fast and my flow of programming with it was good. The only problem with Geany is that it's user base, and hence plugin-writers, isn't as big as that of Emacs and Vim. So now I have decided it is time to move on.

At my institute (KU) the war is of course ongoing. The first two editors were Vim and Emacs, and since these two entered the stage, geeks have been divided into two groups: those who use Vim, and those who use Emacs. Vim-people have always been for Vim because it is fast, both for humans and computer, you can almost code without moving you fingers from the letter-part of the keyboard. Vim is in most Linux-distros loaded into the terminal, so it starts instantly. Those in favor Emacs argue that this particular editor is extensible in measures beyond you imagination. Now so long have gone and the war is still on while the actual differences between the two editors have diminished, you can write the plugins you want for Vim, and you can extend Emacs to act like Vim interface-wise. But when in war, people tend to ignore such banalities.

Since I still have a bit of the headache from Emacs, I have decided to go with Vim. Vim is a command line tool. But it has a GUI called gvim. Using linux this is simply installed by:

sudo apt install vim-gtk sudo apt install vim-gnome

The first command should suffice. However, running Linux Mint or Ubuntu the gnome version should work. Try both. The next step is actually restarting the computer. For some reason this is necessary to get the shortcut placed under menu. After restart you have to configure the editor. It is usable, but with a white background which can make you sore inside when programming for many hours. Under "edit" there is a set of themes, find a suitable one, and let's start vimming!

When restarting Vim, the theme changes back. To globally set a theme, and for several other reasons, one needs to create a .vimrc file. This file is the Vim version of autoexec.bat. Put in another way: the file can contain commands which are executed at Vim startup. This is pretty smart. When Vim is started by clicking on the icon in menu, the command side of Vim is located in the home dir. On linux this is the same as ~. So type :tabe .vimrc to open a new tab with this file in it. Then type :w and then enter to save the file. To change the theme in Vim type :colorscheme desert. Now to do this on each startup add the line colorscheme desert to .vimrc. To show line numbers, add !set nu. Now we are talking!

Now Vim looks nice. If it doesn't, find an alternative theme. Maybe one online. But Vim still hasn't support for F#. And there is other behavior I wan't to transfer from Geany. For this we need a plugin manager like pathogen. Then the Fsharp plugin. Lastly Indent guides.

Vim requires some getting used to. Especially because I'm not used to differ between command mode and edit mode. One very cool thing about Vim is that it's somewhat a terminal in command mode. This means that commands like !firefox % can be executed to start firefox with the current html page. You can customize everything in Vim, beginning at the .vimrc file. And it should support git without any trouble simply because of it's integration of the linux terminal. Vim is even faster than Geany. And it has a large user base. So I'm looking forward to doing things in Vim. Yes I am.

CommentsGuest Name:Comment: