The Vim Sensor collects data regarding developer activities using the Vim editor. The Vim sensor represents this data using the Activity sensor data type, documented in Section 25.2, “Activity”. Currently, the most important Activity event recorded by the Vim sensor is the "state change" event, which is used to generate the Active Time abstraction.
The Vim sensor consists of a Vim plugin (called VIMsensor.vim) that runs at startup and performs initializations, including the invocation of a separate stand-alone Java process (sensor.vim.jar). This Java process, once invoked, monitors a temporary file written out periodically by the Vim sensor that specifies the file you are working on, its size, and a timestamp. When you exit Vim, this temporary file is deleted by the Vim sensor. The next time the Java process checks for this temporary file and finds it is no longer available, it will also exit.
![]() | Important |
|---|---|
The VIM plugin architecture does not support timer-based subprocesses. This limitation requires a non-standard approach to gathering state change events. Instead of having a process wake up every HACKYSTAT_STATE_CHANGE_INTERVAL and check for changes to the active buffer, the VIM sensor binds a special action to the carriage return key, which writes out a file indicating the current buffer and its size, which is then polled regularly by a separate Java process. There are several important implications of this design.
We continue to search for better solutions to Activity data recording for the Vim sensor, and welcome your suggestions. | |
The Vim sensor requires Vim 6.3 or later and Java 1.5.0 or later. It must be possible to invoke this version of Java at the command line using 'java'. At this time, only Vim on Unix is supported.
Follow the instructions in Chapter 2, Client-side configuration: Tool sensor installation to set your Hackystat host and user key.
In the HackyInstaller main window, select the Vim sensor and press "Configure Selected Sensor". Figure 26.57, “ Vim sensor installer configuration window ” shows what the configuration window should look like after the various sensor settings have been set and Applied and the sensor has been installed.
This sensor supports the following properties and paths:
Enable Vim Sensor: This property controls whether the sensor is active or not. If not checked, the sensor will not collect or send data even if installed.
Vim Swap Update interval (milliseconds): 250 is a reasonable default value.
Vim Swap Character interval: Ensures that the swap file is updated after a certain number of characters edited. 4 is reasonable.
Vim data file directory: The location for the vim data file, such as /usr/home/dport/.hackystat/vim
To simplify Vim testing, go to the HackyInstaller main page, and change the Common Setting for automatic background sending of Hackystat data to 1 minute.
Invoke Vim on a sample file for editing. When Vim comes up, you should see the messsage "Hackystat Sensor Active" appear at the bottom of the window, as illustrated in Figure 26.58, “ Vim displaying Hackystat startup message ”.
Once you confirm the Hackystat startup message, edit your sample file for at least one minute. Be sure that you insert at least one carriage return into the file you are editing, so that the VIM sensor can detect your editing activities.
Once you are done editing the file, login to your account on your Hackystat server, and use the "List Sensor Data" command on the Extras page to verify that Activity data for today's date was received by the server for the Vim tool, as illustrated in Figure 26.59, “ List Sensor Data with Vim data ”.
If the List Sensor Data command verifies that you are receiving data at the server, then the final check is to use the Daily Diary command to verify that state change events are being sent and abstracted into the Most Active File, as illustrated in Figure 26.60, “ Daily Diary with Vim data ”.
Once you have successfully edited a file, verified that it was sent to the server, and found it listed as the Most Active File in the Daily Diary, you can feel confident that the Vim sensor was installed correctly.
The first step in troubleshooting your sensor installation is to verify that your Hackystat host and key settings are valid and that you can contact the Hackystat server, as described in Section 2.4, “HackyInstaller GUI: Setting and verifying the Hackystat host and user key”
If client-server connections check out, the next most commonly reported problem results from the use of a version of Vim prior to Vim 6.3 or later. To check your version invoke 'vim -version'.
The Vim sensor writes out a file called vim.0.log to the .hackystat/logs directory that can be useful in debugging your installation. Under normal conditions, this file should look similar to Figure 26.61, “ Log file for Vim sensor ”.
If none of the above troubleshooting activities solves your problem, then you should send an email to your Hackystat Administrator to request help. Please include in your email the following information:
The output from 'java -version'.
The output from 'vim --version'.
The output from 'java -jar sensorshell.jar -verify'.
The contents of your sensor.properties file.
The contents of the vim.0.log file.
A description of the problem you are having.