Signify plugin for Vim

If you use version control systems like Git or Mercurial and you use Vim to edit your source files, then you might find the Signify plugin very useful. When you edit a version controlled file, Signify shows which lines are changed using signs (or markers) in the gutter on the left side.

  • Signify can be installed using your favorite plugin manager from: https://github.com/mhinz/vim-signify

  • By default, Signify works with a large number of version controls systems. If you only use one or a few of those, then you can speed up Signify a bit by informing it to only check those VCS. For example, I only use Git and Mercurial, so I add this line to my vimrc:

let g:signify_vcs_list = [ 'git', 'hg' ]
  • You can also override the default marker characters it uses for its signs. For example, to change its delete character:
let g:signify_sign_delete = "-"

Tried with: Vim 7.4 and Ubuntu 16.04

Advertisements

How to add NoScrollBar to LightLine

LightLine is a lightweight statusline plugin for Vim. By default, it shows the location of current line relative to the entire file as a percent at the left of the statusbar.

However, I like to the NoScrollBar plugin to get a general sense of the current line in the file. So, I replaced the percent display with the output of NoScrollBar using a tiny function.

I added these lines in Vim to achieve this:

" Replace percent component of Lightline statusline
let g:lightline = {
      \ 'component_function': {
      \   'percent': 'NoScrollbarForLightline'
      \ }
      \ }

" Instead of % show NoScrollbar horizontal scrollbar
function! NoScrollbarForLightline()
    return noscrollbar#statusline()
endfunction

Tried with: Vim 7.4 and Ubuntu 16.04

How to show full file path in LightLine

LightLine is a lightweight statusline plugin for Vim. By default, it shows only the filename on the left side of the statusbar. I like to have the full file path displayed instead. It turns out that is easy to do.

The statusline has many components, and the component that shows the filename is called filename. We override this in LightLine with a tiny function that uses the expand function in Vim to get the full file path.

I added these lines in Vim to achieve this:

" Replace filename component of Lightline statusline
let g:lightline = {
      \ 'component_function': {
      \   'filename': 'FilenameForLightline'
      \ }
      \ }

" Show full path of filename
function! FilenameForLightline()
    return expand('%')
endfunction

Tried with: Vim 7.4 and Ubuntu 16.04

AdvancedSorters plugin for Vim

Vim has an inbuilt :sort function that can be used to sort lines. However, I recently had to sort words in a line. I could have broken the line and put each word on one line, sort them and put the results back as a line. Thankfully, I found the AdvancedSorters plugin for Vim that does this job easily in one command.

Tried with: Vim 7.4 and Ubuntu 16.04

Sensible plugin for Vim

Sensible is a super simple plugin for Vim by Tim Pope. It is nothing but a set of sensible settings for your vimrc. It is a great way to start off on a new system where you do not have access to your fully featured vimrc. I only wish he explained some of the choices he made for the options in this file.

If I have a local account on the remote or new computer, I find it far easier to just replicate my vimrc, and other dot files, using GNU Stow.

Orage Panel Clock

Since all the displays are widescreen now, I like to utilize all the available vertical space for my apps. So, I keep the XFCE Panel on the left side in a vertical orientation. This worked great for everything, except the panel clock. The width of the Panel was too less for the clock to show time in digital mode. And in analog mode, the hour hand of the clock is quite confusing to read.

I was wallowing in this situation until I discovered the Orage Panel Clock. This XFCE Panel plugin can be added just like any other Panel plugin.

Installing Orage is easy:

$ sudo apt install orage

After this it will appear in the Panel plugins list, so can be added just like any other plugin.

Features I love about the Orage plugin clock:

  • The digital display can be rotated 90 degrees clockwise or anti-clockwise. This is perfect if your Panel is vertical.
  • The foreground and background colors and font and font size of the display can be configured.
  • Multiple lines of clock display can be configured. For example, Line 1 can be the hour and Line 2 can be the minutes.
  • Tooltip when mouse is hovered over clock can be configured to show anything you want.
  • Clicking the clock shows the Orage calendar.

Tried with: Orage 4.12.1 and Ubuntu 14.04

Clipman

Clipman is a clipboard manager for XFCE. There is also a plugin for it that can be used to integrate it into the XFCE Panel.

To install Clipman and its panel plugin:

$ sudo apt install xfce4-clipman-plugin

I like to have Clipman plugin always around in my Panel. To do this, right-click on the Panel, choose Panel -> Add New Items and add Clipman.

Some of its settings that I configure:

  • Increase the number of copied items in history
  • Enable sync selections. This connects clipman to the default X11 clipboard. If not, only stuff you explicitly copy can be explicitly pasted. Middle-click to paste will not work as expected.
  • Choose to paste instantly on Shift + Insert. This means that when I click on an item in history list, it is directly pasted into my last focused application.

Tried with: Clipman 1.2.5-1 and Ubuntu 14.04

Absolute minimal plugins required by Audacious

Audacious is a minimal audio player, but even it ships with lots of plugins. And most of these are enabled out of the box, especially on older versions of Audacious! I like to run it with the absolute minimal plugins.

The only plugins I require in Audacious 3.6.2:

  • Input
    • MPG123 Plugin: Required to decode and playback MP3 files.
  • Playlist
    • Audacious Playlists (audpl): Required to maintain the files you added as a playlist inside Audacious.

The only plugins I require in Audacious 3.4.3:

  • Transport
    • File IO Plugin: Required to open and read audio files.
  • Playlist
    • Audacious Playlists (audpl): Required to maintain the files you added as a playlist inside Audacious.
  • Input
    • MPG123 Plugin: Required to decode and playback MP3 files.

Tried with: Ubuntu 14.04

Enhanced syntax highlighting for C++ using Vim Syntax Extra

Vim ships with the syntax highlighting rules for C and C++. This is a curse in disguise, because those rules are extremely old and they only highlight the keywords. This means that any C or C++ source file looks pretty much like plain text, no matter which color scheme you apply.

Vim Syntax Extra is a plugin that fixes this by adding more syntax rules for C and C++. There is a visible difference only in the syntax highlighting once this plugin is installed. Add its Github URL using any of your favorite Vim plugin manager and restart Vim to enjoy it 🙂

Tried with: Vim 7.4 and Ubuntu 14.04

How to use CPPCheck with Eclipse CDT

The biggest problem of C++ code is bugs. Bugs can slip through even when compiling code with all warnings turned on. A useful tool in the arsenal of a C++ programmer is CPPCheck, a static analysis tool. You are in luck if you are using Eclipse CDT because the CPPChEclipse plugin makes using CPPCheck with your C++ project very easy.

  • First install CPPCheck:
$ sudo apt install cppcheck
  • Install CPPChEclipse in Eclipse CDT by adding the URL http://cppcheclipse.eclipselabs.org.codespot.com/svn/update/ to Help -> Install New Software. Your Eclipse will restart after the installation.

  • Go to Window -> Preferences -> C/C++ -> CPPChEclipse. First, set the path of CPPCheck to /usr/bin/cppcheck. In the Problems subsection, choose the types of problems you want to be reported about (warnings, errors, style problems). In the Settings subsection, choose the C and C++ standard versions you want to be applied. You can also indicate the CPPCheck use the include paths used by your project (this is very useful).

  • To run CPPCheck on a project, right-click on its name in the Project Explorer and choose CPPCheck -> Run CPPCheck. The default keyboard shortcut for this is Shift + Ctrl + C. After CPPCheck runs, you can view the problems it has reported in the Problems view at the bottom of Eclipse.

Tried with: CPPCheck 1.61, CPPChEclipse 1.0.0, Eclipse 4.4.2 and Ubuntu 14.04