usevim

Vim links, plugins, screenshots, tutorials, and themes

Integrating Vim and GPG

by Alex Young

gpg, encryption, security

In Integrating Vim and GPG by Andrew Cowie, the author describes a GPG-based workflow for encrypting notes.

He discovered vim-gnupg (GitHub: jamessan / vim-gnupg, License: GPL2) by James McCoy, which provides a transparent means of editing GPG encrypted text files. When opening a file with a recognised extension (.gpg, .pgp., .asc) it'll encrypt and decrypt the file as required.

It works using the gpg binary, so you'll need to install that to use it.

Read More →

Script Roundup: dragee.vim, BufNameComplete

by Alex Young

plugins, completion, configuration
Send in your Vim scripts for review through our contact form or @vimnews.

dragee.vim

dragee.vim by "emma-dev" is a Vim distribution that aims to improve the default settings, and make it easier to share Vim dotfiles. It uses a few Vim scripts and VAM to manage both settings and plugins.

Plugins are defined in the .vim/addon/rc file using a tree structure, core settings are stored in .vim/core and "patch" settings are kept in .vim/patch. Core settings are probably what you usually dump in your .vimrc file, while patch settings are plugin-specific settings. The example Emma uses is patch/endwise+double-tap.vim.

BufNameComplete

BufNameComplete by Ingo Karkat is a filename completion plugin that only matches filenames in the current buffer list. This is based on i_CTRL-X_CTRL-F (used in Insert mode) which displays matches for files in the current directory. For a bit of background on this plugin, see the following StackOverflow post: Vim Completion Based on Buffer Name.

Read More →

Vim 101: Local Options

by Alex Young

vim101, options

Last week I talked about managing options in Vim. If it surprised you that something as innocuous as :set has several different usages and options, then that's worth remembering when it comes to mastering Vim: even seemingly simple commands can have a lot of depth.

There's also another dimension to options that I didn't cover last week: local options (:help local-options). These options are applied to the current window or buffer -- imagine that each window or buffer has an internal list of options. This might sound overcomplicated, but it makes sense when working with files of different formats. Splitting a window causes the new window to receive copies of the current local options. Editing a new buffer, however, causes the options to be freshly initialized.

Using :set, therefore, will change the setting for both local and global options. To set a local option, use :setlocal (abbreviation: :setl) -- typing :setl by itself will list the local options. Much like :set all, :setl all will display all options rather than just the options that differ from their defaults.

Read More →

Hermes

by Alex Young

ruby, javascript

When I was at the Vim London meetup, one of the talks announced Hermes (GitHub: New-Bamboo / Hermes). This is a Vim, tmux, iTerm 2 environment for writing Ruby and JavaScript. The developers behind the project work for New-Bamboo, which is a company that specialises in Ruby web development.

Hermes is basically an installer based around manifest files, which are lists of either Homebrew dependencies or the dotfiles used by the project. The installer backs up existing dotfiles that would otherwise be overwritten.

As an example of the bundled dotfiles, the Hermes tmux.conf file has Vim mappings configured:

Read More →

Script Roundup: multichange.vim, vim-detailed

by Alex Young

plugins, substitution, themes
Send in your Vim scripts for review through our contact form or @vimnews.

multichange.vim

Don't be shy about renaming things as you work.

-- From Organizing Go code

multichange.vim (GitHub: AndrewRadev / multichange.vim) by Andrew Radev is a plugin that makes renaming things a lot easier. By typing :Multichange, the plugin enters a mode that causes word changes to propagate through the current buffer.

Read More →

Vim 101: Managing Options

by Alex Young

vim101, options

We've all been there: bursting with creativity, ready to roll, but held back by a configuration option. So we search: over to Stack Overflow, the Vim Tips wiki, and various forums and mailing lists. Then the answer is discovered: :set this-or-that, and it's added to our vimrc and forgotten about.

Like most things in Vim, you can get by this way for a certain amount of time, but there comes a point when you need to properly understand how to use this innocuous command. Everything I'm going to discuss here can be found in :help :set, so if you forget something in the future that's the easiest way to find an answer.

Options in Vim can be one of three types: boolean, number, or string. They work slightly differently, so it's a good idea to pay attention to the type of a given option. To check the type of an option, type :help 'option', and you'll see it displayed in the documentation. In general, options change Vim's behaviour. It's important to distinguish between options and variables, which are set with :let. If you're using a plugin, it's likely to be configured with :let rather than :set.

Read More →

Repeatability

by Alex Young

macros

As I noted in my review of Practical Vim, one of Drew Neil's most interesting tips for mastering Vim is to use repeatable commands. What isn't repeatable? Well, Drew's main example was using the mouse -- Vim's macros are based around text sequences, so it's impossible to record movements and selections made with the mouse.

Much like forcing yourself to learn hjkl, disabling the mouse and using console Vim may help you learn to exploit Vim's repeatable commands. Also, it's worth being aware of the range of commands that are repeatable. Although . can be used to repeat the last change, @: can repeat the last command-line, and ; will repeat the last f and t command. When searching, n will move to the next match, and substitutions with :s can be repeated with &. I covered this in Vim 101: Repeating Commands and Vim 101: Repeating Motions.

Repeating commands isn't just a clever trick, it's the basis of macros. What we call macros are called "complex repeats" in Vim: typing q causes Vim to record typed characters into a register, and then pressing q again stops recording. I wrote a brief introduction to this in Vim 101: A Gentle Introduction to Macros.

Read More →

Script Roundup: eunuch.vim, mozilla.vim

by Alex Young

plugins, web, unix
Send in your Vim scripts for review through our contact form or @vimnews.

eunuch.vim

The wittily-named eunuch.vim (GitHub: tpope / vim-eunuch, License: Vim) by Tim Pope just reached version 1.0. It provides a set of wrappers around Unix commands to optimise them for a Vim-oriented workflow. For example: :Chmod changes the permissions on the current file, and :SudoWrite will write a file using sudo.

mozilla.vim

mozilla.vim is a collection of scripts related to working on Mozilla's various projects, put together by Fabien Cazenave. It includes C++ additions for Gecko components and macros, an updated syntax file with CSS3 and HTML5 support, and the author is currently looking for a JavaScript syntax file and other tools for working with ES6 and the latest DOM APIs.

Read More →

Vim 101: Version Information

by Alex Young

vim101

Reading this article will teach you the following:

  • How to understand Vim's version information
  • How to check if a given build of Vim meets the requirements of a Vim script
  • How this relates to Vim's build process

Vim can be built in many different ways, so it's sometimes necessary to check how a particular build was compiled. Most of us install Vim through our operating system's package manager, so querying version information can be useful. To do this, type :version (alias: :ve), or run vim --version. A lot of text will be displayed, and I'll break it down below.

Let's say you've discovered a new Vim script that you want to try out, and the documentation says it requires Python support. Typing :ve in Vim will show either +python or -python. In my case I see +python, which means I can run plugins that use Python. There are also a lot of Ruby plugins out there, and my build shows +ruby.

Read More →

Book Review: Practical Vim

by Alex Young

books, reviews

spacer

There aren't a lot of great books about Vim. Learning the vi and Vim Editorsspacer published by O'Reilly is the most popular book, and while it's fairly detailed I've always felt it loses focus by including too much coverage of vi clones. The content is dry, feeling more like a standard manual than an affable educational guide.

In contrast, Practical Vim: Edit Text at the Speed of Thought (Amazonspacer ) by Drew Neil draws on the personality and experience of the author -- and this is a good thing. There was a lot of excitement around this book, as the author is behind the popular Vimcasts site. Drew has done a lot to make Vim accessible to more popular, and he's distilled all of this in Practical Vim.

Read More →

12345678910111213Next
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.