Vim and TypeScript

TypeScript has a rich type system that can be used by compilers and IDEs to infer things about method and object usage. If you write TypeScript in Visual Studio, then you get IntelliSense completion and hints as you work. Due to the design of the language, the hints can actually help you how to use and navigate around code.

Vim's Omni completion supports several languages, including C and JavaScript, but it can't do deeper IntelliSense-like completion and documentation.

The way people usually solve this is to run a "server" that can index your code, providing language-specific features that Vim doesn't support. Then a Vim script is used to send queries to the server. typescript-tools by Claus Reinke does exactly that, with its TypeScript server (tss).

Read More →

Script Roundup: textobj-delimited

textobj-delimited

textobj-delimited (GitHub: machakann / vim-textobj-delimited, License: NYSL) by Masaaki Nakamura makes textobjects work better with delimited strings. The default mappings are id, ad, iD, and aD. Visual mode is supported as well.

By passing a change command, like d for example, you can manipulate text based on the recognised separators. Given a string like foo_bar_baz, d3id would move the cursor to the last separator and delete the remaining text, resulting in foo_bar_.

Given the same string, vid would select the "inner" text between two separators. So in the case of foo_bar_baz, with the cursor on b, bar would be selected.

Read More →

Peer to Peer

Peer to Peer

Peer to Peer has launched! This is a service by Drew Neil of Vimcasts. The idea is that an expert demonstrates how they solve problems using their preferred tools, while they're filmed both in-person and on-screen.

The first episode is Counting Tree Nodes with Tom Stuart. Tom uses Vim, and you can see him using it to write a Ruby project that uses Cucumber, Rspec, and immutable data structure APIs.

Read More →

Flappyvird

Flappyvird

Flappyvird by Yasuhiro Matsumoto is a version of Flappy Bird for Vim. To play it, type :FlappyVird, and then press space to jump.

It's an exquisite work of ASCII art, complete with a Japanese-style emoticon for the bird.

Read More →

Script Roundup: glowshi-ft.vim, Clighter

glowshi-ft.vim

glowshi-ft.vim (GitHub: saihoooooooo / glowshi-ft.vim) by Shinya Saiho is a cool visualisation plugin for the f and t motions. When a line has multiple targets, it display highlights and allows you to jump between them.

There are settings for changing the mapping behaviour, case handling, and timeout length.

Clighter

Clighter (GitHub: bbchung / clighter) by BB Chung is a semantic source highlighting plugin based on Clang. It can do things like highlight occurrences of matching words under the cursor. It doesn't replace the built-in C syntax handling, but instead enhances it.

Read More →

So, You Just Got A Mechanical Keyboard...

There's definitely a correlation between Vim fans and mechanical keyboard users. The speed, accuracy, and feel of mechanical keyboards is great, and the choice of keyboards can even help you improve your Vim skills.

I have a tenkeyless keyboard with Topre switches and while it feels completely gorgeous, I had to change a few things to make it work really well. I set my Mac's key repeat speed to 'fast', and the delay to 'short':

Mac key repeat speed

Read More →

Neovim Progress

The second Neovim newsletter has been posted. The project has settled on the permissive Apache 2.0 license, and progress has been made on the RPC infrastructure. This allows scripting languages to be supported, and works differently to Vim where bindings have to be compiled into the Vim binary.

There are other improvements and refactoring as well, including changes to growable array, file function refactoring, and work to replace vim_strncpy with strlcpy.

I've been downloading Neovim from GitHub and running it from master on a Mac, so you should be able to build it if you have a compiler set up. Not everything works, but it's fun to try it out!

Read More →

Script Roundup: limelight.vim, Gist.vim

limelight.vim

limelight.vim is a WriteRoom-style plugin that has an additional feature: the active section or paragraph is highlighted. It dims paragraphs using colour calculations, and you can control this using some variables:

" Color name (:help cterm-colors) or ANSI code
let g:limelight_conceal_ctermfg = 'gray'
let g:limelight_conceal_ctermfg = 240

" Color name (:help gui-colors) or RGB color
let g:limelight_conceal_guifg = 'DarkGray'
let g:limelight_conceal_guifg = '#777777'

" Default: 0.5
let g:limelight_default_coefficient = 0.7

It also has support for Goyo.vim.

Gist.vim

I recently wrote about a Gist plugin, and Keith Smiley sent in his solution: Gist.vim. This one requires Python and has detailed documentation.

Read More →

Five Simple Lisp Tips Guaranteed to Boost Productivity

Even though I like to use Vim for pretty much everything, I can understand why Lisp programmers gravitate to Emacs. Five Simple Lisp Tips Guaranteed to Boost Your Productivity introduces some basic Lisp and then shows how to make Vim better at handling it.

For example, the first tip is improving highlighting for brackets by using Better Rainbow Parentheses. There's also some instructions on what motions to use with Lisp.

Another essential Lisp-related Vim script is fireplace.vim, which is like a REPL for Vim and Clojure. A REPL is really useful for beginners who are learning Clojure, because it allows you to interactively experiment with code until you understand it.

Read More →

Vim as a Language

Learning Vim in 2014: Vim as Language is one of a series of posts by Ben McCormick about learning "modern" Vim. It takes the approach of describing Vim in terms of grammar, which I think was nicely encapsulated by the famous You Don't Grok Vi comment on StackOverflow.

On motions, Ben writes:

If you're a grammar nerd or remember your 8th grade english classes, you can think of these as transitive verbs that need to act on a direct object. These "direct objects" come in 2 forms, motions and text objects. Motions are the motion commands that you can use at any time to move around Vim.

Read More →