D'Alfonso & Co. > Toolbox  > Vim Setup

Vim Setup

Vi is the well known editor in Linux, and its Vim (Vi Improved) version is a friend of all professionals using Linux for daily tasks.

What makes vi so good is the availability of a large number of plugins that make it incredibly useful, mainly for software development.

Better, there are bundles of configurations available on github that give all what you need and something more.

My choice was for the well known amix/vmrc available on github.

Vi customization, again, can become an hobby, but we are looking to something to fulfill a production environment, so feel free to experiment, but this is not the goal.

Ubuntu comes with vi tiny, so we need to remove it and get vi

sudo apt-get remove vim-tiny

sudo apt-get install vim

Get prerequisites for plugins:

sudo apt-get install vim-addon-mw-utils

Getting the latest version of amix/vmrc

git clone https://github.com/amix/vimrc.git ~/.vim_runtime

Setup vim to use the downloaded bundle

sh ~/.vim_runtime/install_awesome_vimrc.sh

The main use in our case is for snippets of code to be be inserted while developing something.

Changing the default syntax to nasm

sudo vi /usr/share/vim/vim74/filetype.vim

” if b:asmsyntax still isn’t set, default to asmsyntax or NASM (was GNU)
if b:asmsyntax == “”
if exists(“g:asmsyntax”)
let b:asmsyntax = g:asmsyntax
let b:asmsyntax = “nasm”  (was “asm”)

Look for “asm” and change to “nasm”

This could be done in a local configuration, and it should be done there, as the file could be overwrittten in some future update during the long 5 years maintenance period. I actually have to make only this change so if some day the syntax is wrong, it is clear what’s happening. Simply make again the change.

Setting snippets

The vim snipmate plugin, included in the amix/vmrc will get snippets configuration from any folder named “snippets”  in the runtime path, so the simplest place is to make a folder called snippets in


Any group of snippets is in a file with “syntax”.snippets, this is relevant because for nasm is nasm.snippets not asm.snippets.

Snippets are inserted entering the snippet name (here head) followed by TAB.

This is an example for NASM

# File Head
snippet head
; *
; *
; * FILE: `expand(‘%:t’)`
; *
; * DATE: `system(“date +%Y‐%m‐%d”)`
; *
; *
; * Copyright (c) 2016 by D’Alfonso & Co.
; *
; *

and this for C++

# File Head
snippet head
// *
// *
// * FILE: `expand(‘%:t’)`
// *
// * MODULE:
// *
// * Copyright (c) 2016 by D’Alfonso & Co.
// *
// *
// *************************************************************************

No Comments

Leave a reply

My Agile Privacy
This website uses technical and profiling cookies. Clicking on "Accept" authorises all profiling cookies. Clicking on "Refuse" or the X will refuse all profiling cookies. By clicking on "Customise" you can select which profiling cookies to activate.
Warning: some page functionalities could not work due to your privacy choices