Local Settings

If you're like me then you have a centralised repository for Vim's settings. There are situations, however, where local settings are required. For example, I may want subtly different settings when working on files on a server, but still want to load my preferred .vimrc as well.

One way to solve this that I've seen used in dotfiles on GitHub is to source a "local" settings file:

if filereadable('~/.vim/local.vim')
  so ~/.vim/local.vim
endif

This snippet can be placed in your centralised .vimrc, and then machines or accounts that require tailoring can be supported by creating a suitable ~/.vim/local.vim file. In the other cases where this isn't required, filereadable is used to prevent loading a non-existent file.

Read More →

Script Roundup: Fanf,ingTastic;, Taboo

Send in your Vim scripts for review through our contact form or @vimnews.

Fanf,ingTastic;

Fanf,ingTastic; (License: Vim) by Barry Arthur provides several ways to enhance Ff,Tt and ;. Once installed, the default settings allow the supported motion commands to wrap lines, and there are additional options for ignoring case and aliasing keys:

  • 'fanfingtastic_all_inclusive': Makes backward movements inclusive
  • 'fanfingtastic_fix_t': Fixes the behavior of tT,;
  • 'fanfingtastic_ignorecase': Provides case insensitive fFtT;
  • 'fanfingtastic_use_jumplist'Adds the movementsments of fFtT; to the jumplist

Taboo

Taboo (GitHub: gcmt / taboo.vim, License: MIT) by Giacomo Comitti is a small tab management plugin. It provides easy shortcuts for renaming tabs, and opening tabs with a prompt for the tab name. The naming scheme for unnamed tabs can also be changed by setting g:taboo_format.

Read More →

Vim 101: Virtual Editing

Visual mode and Blockwise Visual mode have several associated settings. In this article, we're going to look at virtualedit, which is definitely something to consider adding to your .vimrc.

To get up to speed with Visual mode, take a look at these previous Vim 101 articles:

The virtualedit setting basically allows block selections to operate across lines regardless of the underlying text. In this screenshot, I've pressed CTRL-V and selected a block. Notice how the block is limited to the characters in the file:

Read More →

Review: VimTouch for Android

VimTouch

VimTouch (GitHub: momodalo / vimtouch, License: Apache 2.0) by David Tao is an open source port of Vim to Android devices. I currently have Gingerbread and Jelly Bean devices, and it runs on all of them.

The app launches with a menu of commonly used shortcuts, and the standard Android icons for saving files and a popup menu. A ~/.vimrc file is supported, and so are tabs and windows. Tapping windows and tabs works as expected, as does Vim's standard file management and navigation commands. Coloured syntax highlighting is enabled by default.

Read More →

Script Roundup: Another Vim Addon Manager, layoutManager

Send in your Vim scripts for review through our contact form or @vimnews.

Another Vim Addon Manager

another-vim-addon-manager by Evsyukov Denis uses Ruby and Rake as a way to install Vim scripts. It uses a file called plugins.yaml to define the required repository URLs:

---
- https://github.com/tpope/vim-pathogen
- https://github.com/scrooloose/nerdtree
- https://github.com/vim-scripts/L9
- https://github.com/mileszs/ack.vim

By default, a YAML file is created that includes Pathogen -- this is the default way plugins are managed. In that sense, this addon manager is a wrapper around Pathogen.

layoutManager

layoutManager by Alexandre Viau allows tabs, templates, and windows to be named and manipulated in a similar way to panels in a GUI IDE. Text can be sent to specific named windows -- one window could contain compiler output, another could display the code, while a further window displays a text-based menu of build operations.

Read More →

Vim 101: Working with Brackets

I don't know how much nontechnical writers care about brackets -- there probably aren't that many brackets in the average novel, fiction or non. Programming is another matter. Every language seems to make use of all brackets, including curly and square.

Vim has a few standard ways to deal with brackets, and standard Vim distributions also come bundled with bracket-related plugins.

Movement and Selection

Moving the cursor over a bracket and pressing % will cause the cursor to jump to the corresponding bracket. This is useful for unravelling nested and mixed brackets -- repeatedly pressing % provides a clear visual indication.

Read More →

Script Roundup: GrepTasks, easybuffer.vim

Send in your Vim scripts for review through our contact form or @vimnews.

GrepTasks

GrepTasks (GitHub: vim-scripts / GrepTasks) by Ingo Karkat helps search for FIXME, TODO, and other markers. The current buffer can be searched, and also all files in the argument-list.

The plugin's readme file also mentions TaskMotions.vim which adds movement commands for markers.

easybuffer.vim

easybuffer.vim (GitHub: troydm / easybuffer.vim, License: Vim) by Dmitry Geurkov displays buffers in a table-like view with shortcut keys for quickly switching between them. The keyboard shortcuts for switching buffers are defined in g:easybuffer_chars.

Read More →

Vim 101: External Help

Vim has a built in way to look up help for keywords -- the K command. Moving the cursor over a word then typing K will attempt to load a man page by running the man command in the terminal.

Many programming languages have manual systems that work in a similar way -- Ruby's ri and Go's godoc spring to mind -- Vim can support these languages by setting a custom command with keywordprg.

For example, the file that integrates Ruby's ri command (ftplugin/ruby.vim) uses setlocal to make ri the default keyword program:

Read More →

Vim Cheat Sheet Poster

Vim Poster

It took over 120 total hours to research, plan, design and create this cheat-sheet. It is meant to be a collection of Vim's "biggest bang for your buck" features: the stuff that will provide the most usefulness to the most people.

The Vim Cheat Sheet Poster by Max Cantor is a carefully created movie-sized poster for key Vim editing commands and concepts. It was started as a Kickstarter project, and was fully-funded by 467 backers.

Read More →