Last Updated: March 07, 2016
·
1.317K
· jodosha

Click on stack trace to open a file with NeoVim

Here's what you'll get

open-with-neovim.gif

During your work day you're looking at some stack trace in your terminal. Maybe it's an exception or just a failing test.
How cool would be to click on a line and jump straight to the point?

That is easily achievable with iTerm2's "Semantic History". With a Cmd+click It's able to open applications like XCode, Atom, TextMate.. But what about (Neo)Vim users?

You'll need just one setting and a Vim plugin.

iterm2-semantic-history-settings.png

Open iTerm2. From the menu Preferences -> Profiles -> Advanced.
Find Semantic History, choose Run coprocess... and type echo nvim \1:\2.

On Cmd+click, iTerm2 will run that command. For instance nvim path/to/file.rb:23.

But wait, (Neo)Vim isn't able to open a file at line, with the colon syntax

Right.. Install file-line.


For other tricks about Tmux, (Neo)Vim, check out my blog or dotfiles.