Project Specific Settings with Vim

When I started using Vim for my day job -- beyond server config editing and quick text file notes -- one thing I struggled with was the project management side of things. Visualising projects and quickly navigating files seemed more painful than some of the IDEs that I'd grown used to, so I was constantly trying different project management plugins in Vim.

If you work on several projects at any one time, then it can be nice to have project-specific settings. This might be something as simple as different code formatting styles, but it could be more complex build system configuration as well.

In Project Specific Settings with Vim, Adrien Giboire writes about using .exrc files. You have to set exrc to make this work, and it comes with caveats -- if someone commits an .exrc with malicious commands then you could be in trouble. Adrien explains all of this and also how he uses it with real projects.

Read More →

Script Roundup: vim-line-jump


I like plugins for plugins, and I noticed something interesting in vim-line-jump (GitHub: rargo / vim-line-jump) -- you can specify mappings based on the current buffer with an autocmd. That means you can add NERDTree-specific mappings with something like this:

autocmd BufEnter NERD_tree_\d\+ nnoremap <buffer> <nowait> <silent> f <ESC>:silent! call LineJumpSelectForward()<cr>

The rest of the examples are for NERDTree and Tagbar so you can navigate between files more easily.

Read More →

Design by Typing

I got asked about my three preferred web development tools, and I really wanted to answer with simply "Vim". The reason I like Vim for HTML is things like cit ("change inner tag"), ci" (change inner quote), and the visual selection and manipulation possibilities created by these motions.

Coincidentally I ran into Design by Typing, a site dedicated to screencasts for Vim and modern web development. It includes examples for things like responsive layouts, SVG, and publishing with npm.

The responsive photo grid example shows the author navigating and editing HTML with motions that you might find useful if you find the idea of working with HTML in Vim difficult.

Read More →

Get the Vim Stack Exchange Started

There's an Area 51 proposal to get a vi/Vim Stack Exchange site going. The way this works is enough people have to commit to use it. Right now it's 45% complete with 91 people who are committed.

I read a discussion about whether Vim questions belong elsewhere, but due to the volume of Vim questions across Stack Overflow I think it's a reasonable proposal.

People already find a huge wealth of Vim advice on Stack Overflow -- I still find discussions about the "you don't grok vi" post, so a more vi/Vim focused community would be very interesting.

Read More →

Script Roundup: vim-lambdify


Some languages make heavy use of lambdas to the point that you may like to fold them. vim-lambdify (GitHub: calebsmith / vim-lambdify) by Caleb Smith is a plugin that conceals lambdas and inline functions with a lambda character.

It supports Python, JavaScript, and Scheme. It works by replace text for display, but not when the file is saved:

Plugins such as vim-haskellConceal and vim-cute-python use this to replace many different things with more pithy/mathy symbols. The approach taken here is to replace only lambdas, but to do so for many different languages to avoid having to use many plugins for a single feature.

Read More →

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



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 →