Leaning towards #Vim

I’ve now pretty much set up my Cubietruck successfully. Apache was running out of the box. Setting up a mail server was more problematical. I’m using Dovecot and Postfix. I had previously documented the configuration process fairly well, so I got a large part of the way there. There were enough gotchas, as I decided to use authentication. I wanted separate passwords for mail and user login to increase security. That meant disabling authentication against PAM and fiddling with the configuration files. It also meant figuring out how to reconfigure my Claws email client to authenticate using TLS. I’m a huge fan of Claws-mail, BTW, and if you’re in the market for a (free) email client, I urge you to check it out. It feels very lightweight and fast, works on both Linux and Windows, and renders non-textual emails very well. I like to think of it as a “cholestoral free Thunderbird”.

Since my Cubietruck is all shiny and new, with a fresh Linux install, the question arises as to what to use as a text editor. I don’t now remember if vim came as default, but I know emacs doesn’t. I’ve always been a fan of emacs over vim, but the Cubietruck has let me to reassess my editor. Emacs is great in a GUI, but is sucky in a terminal. Menus become a pain to use, as the mouse wont work. That means you either have to go through the painful and slow-to-use menu system using F10, or else learn the commands.

This is what led me to try an experiment with vim. So far, so good. With the added advantage that vim is faster. Emacs can be rather a slowcoach on weaker hardware. One really neat thing is when you write code. Often your compilations will fail. How do you navigate to the error line in your editor. Suppose it’s at line 666. In emacs, what I generally do is scroll down until I get to the right line. You could use M-x goto-line 666, but that’s hardly quick. On vim, it’s terrific: 666G . Just what the doctor ordered. Here’s my .vimrc file so far:

 

:set mouse=r
" display row and column header
set ruler
" get backspace delete key working on cygwin
set bs=2
syntax on
let &t_ti.="\e[1 q"
let &t_SI.="\e[1 q"
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"

The last four lines are a bit weird, but they set your cursor to be a block, rather than a line. I find that greatly helps me figure out where the cursor is. Setting bs=2 gets my backspace button working with cygwin, although why that isn’t configured by default is a mystery. I also like to be able to see the row and column I’m on, so the ruler is a must, in my opinion.

I’ve also turned on syntax highlighting. There’s a couple of problems: the brace-matching often makes it difficult to see where the cursor is, and there’s poor contrast between commented sections and a black background. Those are two things that I am keen on getting sorted. Another thing that I would like to figure out is how to get vim to remember the cursor position from session to session on a file.

I’ll tell you something else strange: I think vim makes you a better typist. Using a GUI version of emacs, you often move your hand from keyboard to mouse. You are therefore highly likely to “cheat” with the way that your fingers are positioned when returning to the keyboard. That also happens when you’re not using the mouse, as the complex key chord presses mean that people break proper touch-typing positioning in order to invoke functions. Vim is modal, so requires much less in the way of key chording. This means that your fingers are much more likely to stay in their proper touch-typing position, and maintain the discipline of using your fingers correctly.

About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

2 Responses to Leaning towards #Vim

  1. RickyFlips says:

    ” Return to last edit position when opening files
    autocmd BufReadPost *
    \ if line(“‘\””) > 0 && line(“‘\””) <= line("$") |
    \ exe "normal! g`\"" |
    \ endif

    I would also recommend the solarized colorscheme.

    http://www.vim.org/scripts/script.php?script_id=3520
    Enjoy!

Leave a reply to mcturra2000 Cancel reply