Giter VIP home page Giter VIP logo

urlscheme_vim_in_iterm's Introduction

Vim in iTerm

A small app to open special "viminiterm://" urls in a new iTerm tab in vim.

Better Errors is a RubyGem that provides, well, better errors in Rails applications during development. One feature it provides is the ability to open the files, at the offending line, in the stacktrace in your editor of choice. It does this by creating links to specially crafted URLs using custom schemes (ie. "txmt", "subl", "mvim"). I prefer to use standard CLI vim in iTerm.

To make this work, I've written a small AppleScript based application that registers a URLSchemes of "viminiterm", then activates iTerm, opens a new default session, and starts vim loading the file and line. Note that the application execs vim in the shell so once you quit vim, that iTerm session will close.

Getting Started

  1. Download the ZIP and unzip it.
  2. Copy the 'Vim in Iterm' application to your Applications folder.
  3. Double click it to open it. The application needs to be run normally, just once, in order to register the URLScheme with the OS.
  4. You can click here to trigger the registration or manually insert the following snippet into the browser: viminiterm://open?url=file:///etc/bashrc&line=3

Integrate with Better Errors

Create 'config/initializers/better_errors.rb' with the following contents and restart your Rails application.

if defined? BetterErrors
    BetterErrors.editor = proc { |file, line| "viminiterm://open?url=file://#{file}&line=#{line}" }
end

Example

An error is raised in the Rails application. Clicking the filename will open the 'viminiterm://' link.

image

The first time this happens your browser may prompt you to confirm you want to do it. Set your preferences and continue.

image

The application runs, and a new iTerm session is opened, opening vim with that file and line.

image

urlscheme_vim_in_iterm's People

Contributors

phallstrom avatar

Stargazers

 avatar Kento Nagata avatar Chris Scharf avatar Adrien avatar Marlon Andrade avatar Radosław Woźniak avatar roma avatar Nobuyuki Honda avatar Ryosuke Iwanaga avatar Andy Hartford avatar Jun Lin avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

ivar mralexgray ngtk

urlscheme_vim_in_iterm's Issues

How to edit source ?

Sorry if I'm missing something (I'm new to Applescript) but I'm trying to find the source of this script -- it appears that the relevant components are only in binary form.

I have a minor tweak that I'd like to make so that your cool script plays nicer with my zsh.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.