Category Archives: VIM

Some shortcuts with vim

Many of you know that i like VI/VIM and when i say editor it must be VIM. Often i hear at customer sites or from my colleagues, that they can’t work with vi, that shortcuts are hard to remember or even they can’t save their changes.

When you remember some short commands, you can work very fast and you can edit files through all connections (ssh, x-forward) to a server.

I created a mindmap as preparation for a speedgeeking session, the session wasn’t accepted, but the file is already done. So you can download a cheat-mindmap with a collection of shortcuts.

Navigate in files

Shortcuts in command mode:

  • gg – top of file
  • G – end of file
  • :## – ##=number go to line number
  • 0 – beginning of line
  • $ – end of line

Save and undo

  • :w – save file
  • :wq – save and close
  • :q! – close and do not safe
  • u – Undo

Some additional things

When i need to change Connections URLs within LotusConnections-config.xml after adding the webserver to my ISC, i can do this with one line.

Changing Connections URLs

Checkout LotusConnections-config.xml and edit with vim. You will find several links to your application server hostname with WebSphere ports (e.g. When you use a large deployment you have about 15 application servers with http and https links, so you need to change 30 different urls.

With vim we can use regular expressions to change the urls. Lets change to

Open LotusConnections-config.xml with vim and stay in command mode. Type



  • :%s is search and replace,
  • first part within / / is text which will be replaced
  • [0-9]* any count of a number
  • g global replace (multiple search text in one line)


Comment out some lines in httpd.conf

I often test things in my IBM HTTP Server Configuration and when i want to comment out some lines or remove the comment signs there is a easy way with vim.

Open httpd.conf and hit Ctrl+V (enters Visual Block mode),


now you can mark some characters with j (moves cursor down) or arrow keys:


Now type a capital i -> Shift+i, the cursor jumps back to the first character you marked and you can add text (e.g. “# “):


finish the commands with ESC:


Remove characters in multiple lines

You can remove the comments with nearly the same command.

Open the file, change to visual block mode (ctrl+v), mark the characters with arrow keys and remove with d.