Ex Mode

Apparently, NeoVim may be removing Ex mode. The NeoVim developers have found supporting Ex mode adds extra code that they'd like to remove.

Why would you care about Ex mode (:help Ex-mode)? It's basically a mode that allows you to enter several : commands, with some slight caveats. To leave Ex mode you have to type :visual. To enter it, you type Q, which some people hit accidentally and consider an annoyance.

Scripts sometimes use Ex mode, and plugin authors occasionally use it to try out snippets of Vim script. Many people use Vim for years without using it at all, and some even remap Q.

Read More →

Writing to External Commands

I like to use Vim as a general place to manipulate text. Sometimes that means I paste text into an unsaved buffer, pipe it through a Unix command, and then further manipulate the buffer in Vim before finally yanking it and pasting it to another program.

One tool that makes this process easier is :w !cmd, where cmd, is a Unix command. For example, :w !wc will pipe the current buffer to the standard input of wc, giving me a neat character, word, and line count.

This works with unsaved buffers, which is perfect for quickly editing pasted text from a document or web page.

Read More →

Script Roundup: rogue.vim

rogue.vim

Rogue.vim

Sometimes in life a hobgoblin hits you, but then it's OK because you defeat it and find a green potion. I've getting back into Rogue, thanks to rogue.vim (GitHub: katono / rogue.vim, License: MIT) by Kato Noriaki. This is a Vim implementation of Rogue. It requires Lua-enabled Vim, which I installed with brew install vim --with-lua.

If you don't already know, Rogue uses hjkl for movement, so it's a great excuse to play a game while practising essential Vim skills. This version includes lots of useful stuff, like the Rogue man page, guide, and also documentation for rogue.vim itself.

Read More →

Learn Vim with No Settings

Most people end up with huge .vimrc files and lots of configuration options. That can make using a standard installation of Vim tricky. So just how much vanilla Vim do you remember?

First, start Vim like this:

vim -u NONE

The -u option lets you change the .vimrc that Vim loads, so in this case no file will be used. Now when you start Vim it'll behave more like vi.

Read More →

Neovim Update for September

I'm still following Neovim's progress, and there's just been an update for September. The project now has 1,000 issues and pull requests. The contributors have been working on removing dead code for legacy systems, unit tests, and the RPC implementation.

One of the cool things about Neovim is it uses libuv, and a Neovim contributor has actually been sending pull requests to the libuv project:

@Hinidu, one of Neovim's contributors, sent a pull request to libuv to add a new function, uv_fs_mkdtemp. The changes (now part of libuv version 0.11.27) are being used by Neovim to provide temporary file/directory creation and the changes work across platforms.

Read More →

Script Roundup: Browserlink

Browserlink

Browserlink (GitHub: jaxbot / browserlink.vim, License: MIT) by Jonathan Warner is a plugin to show a live preview of a Vim buffer in a browser. You can also evaluate selections of JavaScript, and the author demonstrates this with something that looks like a HTML5 game.

Browserlink is very simple. The plugin itself hooks autocommands for file changes (and other things) to the provided functions. The functions connect through HTTP to a node.js backend, which your webpage connects also to. The entire process happens extremely fast.

The source for the Node server is here: brolink.js. It uses WebSockets to perform realtime updates, and it looks like it should run on Windows as well.

Read More →

CI for Vim

With all the Vim forks and reinventions of Vim, I thought readers might find it interesting to learn about vim-ci, created by the vim-jp community.

This repository includes a fork of Vim as a submodule and includes a build script so a continuous integration server like Travis can easily handle the output. The build script triggers ./configure with make && make test so it's easy to run the tests.

I found this through a thread on vim dev where Marslo Jiao was asking about how to adapt Vim to help maintain a Windows Vim build.

Read More →

Emacs Evil Mode and SLIME

I've recently seen people using Vim plugins in just about every editor: Visual Studio, WebStorm, Atom, Sublime, and Emacs. Emacs seem to appeal to a particular type of programmer: experimenters who try out lots of languages only to find Lisp strangely rewarding.

Lisp programmers like Emacs because of SLIME. This is basically an editor mode dedicated to developing Lisp applications. You can quickly evaluate selections of code or the whole file, inspect values, skip to files based on stacktraces, and restart programs. It really gives you a feeling of being able to accurately work with parts of large, complex programs without treating them as impenetrable monoliths.

For an introduction to SLIME, take a look at the SLIME chapter in Lisp: Outside the Box.

Read More →

Script Roundup: C64.vim, autorepeat.vim

C64.vim

C64.vim

C64.vim is a colour scheme that uses the 16 preset colours available on a Commodore 64. Of course, you'll need to run this through a CRT display to really appreciate it, but at least you don't have to load it from a cassette tape.

autorepeat.vim

autorepeat.vim (GitHub: daisuzu / autorepeat.vim) by Daisuke Suzuki is a plugin to repeatedly execute a command until a key is pressed.

Read More →

Italic Fonts in iTerm and Vim

In Enabling italic fonts in iTerm2, tmux, and vim, Alex Pearce explains the steps required to get italic fonts working in console Vim on a Mac. You'll need a font that supports italics, like Consolas, and some configuration for iTerm, tmux, and Vim.

I really like having comments in italic. It differentiates them one step more from the surrounding code, and it makes sense semantically too, as a comment is treated very differently from anything else in the source.

Because Alex's solution changes the value of $TERM, you might see errors when sshing to remote servers. He explains how to extract the termcap values, but you could alias ssh to TERM=xterm-256color ssh.

Read More →