Tuesday, 11 March 2025

This Blog has moved

I recently rediscovered this blog while writing a post for my new website. The post I'm writing there is based on a Blog Challenge series, one of the questions was, have you blogged on other platforms before? And it turns out, one of them was still active! I plan on reviewing if any of these posts are worth moving over to my new website, after that I'll close this blog (it's saved on https://web.archive.org/web/20250311162026/https://rubenverweij.blogspot.com/). If you'd like, visit my new website at https://en.kedara.nl. The post I mentioned is not published yet, but will be soon.

Saturday, 14 May 2016

Building Vim 7.4 from source on Fedora 23

Recently, I switched from Ubuntu 16.04 to Fedora 23, because Ubuntu dropped support for the fglrx driver which I needed to have a functional dual monitor setup with my laptop. I use a moderately customized version of (g)Vim for my text editing and programming needs and I always build the latest version from source. Building Vim from source on Fedora 23 was somewhat more difficult compared to the process on Ubuntu, but here is how to do it. This is based on the excellent tutorial from the YouCompleteMe wiki which I had to modify somewhat for Fedora.

First, we need to install all the dependencies for building Vim from source:
Then, we need to create a symlink (as per the instruction from the YouCompleteMe wiki):

Next, clone the Vim source code and change to the directory containing the source code:

Now we can issue the configure command:

The CFLAGS=-fPIC and --with-tlib=ncurses are to prevent the following "no terminal library found" error (source):

The CFLAGS=-O is to prevent the following "_FORTIFY_SOURCE" warning:

The CFLAGS=-Wformat is to prevent the following "-Wformat-security" error:

Note that you should adjust this command to your needs. I have enabled (amongst others) Python support and gVim. After configuring we can use make to compile:

Now install Vim system-wide:

And set it as the default editor:

I hope this will be useful to you. Enjoy your custom built Vim!

Wednesday, 30 March 2016

Add action to Thunar context menu "Open gVim Here" on Xubuntu

I will show you a quick tip on how to add a custom action to the file browser (Thunar) context menu on Xubuntu to open gVim with the current directory set as the working directory, similar to the "Open Terminal Here" shortcut.

To create the action, open Thunar and go to "Edit -> Configure custom actions...". Click on the "+" icon to create a new action.



Type in a name, and use the following command to do the magic:
vim -g -c "execute 'cd' . %f"
You can now select an icon by clicking on the button next to "Icon" and searching for gVim. Next, switch to the "Appearance Conditions" tab and select only "Directories". Now your all set! To confirm if it works, issue a :pwd after gVim has started.
 

Tuesday, 15 March 2016

Quick Vim tip: convert piped table to pandoc/RST/Emacs grid table

Inspired by a snippet by Conner McDaniel, I added a little snippet to my .vimrc that can convert a piped table to a grid table used by pandoc/RST/Emacs.

It goes from this:

 Fruit | Price | Advantages         
 Bananas | $1.34 | - built-in wrapper     
 Oranges | $2.10 | - cures scurvy           
To this:
+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
+---------------+---------------+--------------------+
Add this to your .vimrc file:
Now, make a visual selection and type :TablePandoc. It uses tabular.vim to align the pipe characters. Example:


If you have additional tips for using Pandoc from Vim, please let me know in the comments.

Saturday, 12 March 2016

Quick Vim tips to make Vim more efficient

Here are some small Vim tweaks I discovered in the past few weeks that makes working with Vim much more efficient. Many of these tips can already be found elsewhere, but these are the ones I found most worthwhile.

Move vertically by visual line

This way, when a line is wrapped, you don't unexpectedly jump over it when navigating your file.

Highlight 81st column when needed

Credits go to Damien Conway (http://radar.oreilly.com/2013/10/more-instantly-better-vim.html)

Open/create folds with the spacebar

This is a really handy setting. You can create folds using a visual selection and spacebar, and toggle them using the spacebar in normal mode.

Use Ag over grep or Ack

Because Ag is awesome and much faster. Let CtrlP use Ag without caching for up to date results, and define an :Ag command that is mapped to backward slash.

Syntastic: show only icons in the gutter

I found it really annoying that everytime there was a small style error in a script, Syntastic opened the location list with the error. Here is how to hide the location list by default and have Syntastic show only an appropriate icon in the gutter.

Copy from Vim to clipboard

This lets you use Ctrl+y to copy text from Vim to your clipboard.

Switch CapsLock and Escape

setxkbmap -option caps:swapescape
In Vim, you have to use the Escape key a lot, but it is awkwardly positioned on the keyboard. With this command, you can change the functionality of the CapsLock and Escape keys. This is much better because CapsLock is next to your home row. I tried two other mappings for a time: jk and kj (because jk does occur quite often in Dutch words). However, I found that hitting CapsLock is much faster.

And of course I use a couple of plugins. My full vimrc file can be found here. If you have any cool vim tips to share, please let me know in the comments.

Monday, 12 October 2015

Pyramidenkogel

Playground

I visited the Pyramidenkogel in Maria Wörth in Austria this summer. It is the tallest wooden observation tower in the world at a height of 100 metres. The photo above was made from the top with my Pentax KX with a 135mm f3.5 on Fuji Superia 200.

The cool thing about this tower is that there is an embedded 66 metre long slide in it, making the tower not only the largest wooden observation tower in the world, but it also has the longest slide in Europe!


Pyramidenkogel

This picture was also made with the KX on Fuji Superia 200, with my 28mm f2.8 lens. The KX is a joy to use and the Pentax M lenses give really good results. Looking through a lens made the heights a bit less intimidating. But the wonderful view is really worth the long climb. If you're near the Wörthersee, pay the Pyramidenkogel a visit!

Zur Rutsche

Friday, 23 January 2015

Plotting graphs using python-igraph

First we include igraph and numpy:
Next, we create a graph by specifying the vertices and edge pairs:
Now we can apply styling to better visualize the data. We can, for example, scale the vertices based on their (out)degree, and color them accordingly:
We can also add the calculated (out)degree to the label of the vertex: Furthermore, we can set the edge weights based on the communities detected with community detection:
To make the graph look somewhat nicer, apply a little bit more styling:
Finally, plot the graph:
The final diagram now looks like this: The full code can be found here, more examples can be found here.