|
Textmate Footnotes with vim supportWritten By: Ben Wyrosdick June 11th, 2008 |
I just switched to doing rails development in vim rather than textmate but I sure did miss my textmate footnotes. I found a post about a plugin called redit that converted stacktraces over to links that would open in vim (textmate footnotes style) so I decided to take that and patch Textmate Footnotes. I had to make sure not to messup any of the developers who were going to still use Textmate so it patches it to do both based on an env variable we will talk about later.
First I took the controller from the afore mentioned plugin and tweaked it to make sure we were running in development mode before executing code on the server and changed it to use MacVim as the vim app. Simply create a new controller called ReditController and paste the code below changing the system call if you use something other than MacVim.
require 'base64'
class ReditController < ApplicationController
def open
if ENV['RAILS_ENV'] == 'development'
file = Base64.decode64(params[:id])
line = params[:line].to_s
# Run editor here
Thread.new do
### MacVim
# Open file in new tab of vim server
system("mvim","--remote-tab","+#{line}",file)
end
end
redirect_to :back
end
end
Next you need to replace the lib/textmate_footnotes.rb with this one. I am working with an older version of textmate footnotes so be forewarned that my file may not work 100% with your version … I will update to the latest soon and update my file. Here is an example of how the patch changes the urls generated:
def controller_url
if ENV['FOOTNOTE_APP'] == 'vim'
escape(
"/redit/open/" +
CGI.escape(Base64.encode64(controller_filename)) +
(index_of_method ? "&line=#{controller_line_number + 1}&column=3" : "")
)
else
escape(
textmate_prefix +
controller_filename +
(index_of_method ? "&line=#{controller_line_number + 1}&column=3" : "")
)
end
end
And lastly to make the plugin give you vim links rather than textmate links you need to set the FOOTNOTE_APP env variable. To make this happen every time you login place the following snippet in your ~/.bash_profile
export FOOTNOTE_APP=vim
October 28th, 2008 at 11:45 AM You no longer need this with the latest MacVim. The latest MacVim supports a URL handler: mvim://open?. Just add this to your environment.rb: Footnotes::Filter.prefix ||= 'mvim://open?url=file://' if RUBY_PLATFORM.include?('darwin')
May 5th, 2009 at 12:22 AM That is good to know ... I will update the post accordingly
January 23rd, 2010 at 05:29 AM [url=http://urbancruiser.ru/][img]http://imagepix.org/preview/dba3f3e42bf39c649836f766fe029834.jpg[/img][/url] ??? ???? ???? ????? ???????? ??? ??????? ????? ??????? - [b][url=http://urbancruiser.ru/]?????? vbybl bgbr [/url][/b], ?? ???????? ?? ??????????? ?? ???????… ? ???, ?? ???? ???????? ????? ?????????: ?????? ?????????? ????????? ????????? ? ????? ?? ????????? [b][url=http://urbancruiser.ru/]?????? ????? ?????? ???? [/url][/b], ?? ???????? ?????????? ???? ?????? Scion.
April 1st, 2010 at 06:58 AM Dagen.ru™ - ??????? ??????, ??????????? ???????, ????????? ???? ? ?????? ?????? ?????????? ????????? ? ??? ???????????! ?? ?????: dagen.ru ?? ?????? ? ????????? ??????? ???????: ??????????????, ??????? ????? ????, ???????? ????????? ??????? ????, ?????????? ???? ?????? ?????????, ??????? ????? ????, ?????? ??????, ???????, ??????? ????, ??????, ?????? ?????, ???? ??????, ????? ???? ?????????, ????, ?????, Dagen, ??????, ????, Games, ????, ??????, ??????, ??, ?????, ????? ????, ????? ?????, ?????????, ????, ??????, ?????, ?????????, ???????, ????, ????????, java, ????, ??????????, ?????, ??????, ??????, ???????, ?????, ??????????, ???????, ?????, ???, ??????.
July 22nd, 2010 at 05:16 PM NFL Picks unceremonious nfl picks is proud to be your inception across the amplitude of pleasing 2010 nfl picks as cordially as unengaged College football picks against the spread. Tantamount if you don't instance on using our capable NFL Picks right away, constituents bookmark us in cheer of upcoming episodic good 2010 NFL football Picks or 2010 untrammelled of decree College football picks. We also believe signing up in concern of the treatment of our skilled unfasten football picks at the surmount of the page. This is a popular track to sorrow looking instead of up to accepted with unconstrained nfl picks as correctly as take on some laid-back autonomous College football picks and nfl winners along the way. We trammel both college and pro football, although our stronger of the 2 sports is our NFL predictions. To beginning what is on pattering an identification to our NFL subscribers interpose with at carte blanche our NFL football picks errand-boy as a care to all the details. If you be dressed not had the ascendancy you would avow liked in erstwhile seasons betting your own nfl gambling picks, this sky misappropriation our value NFL football picks and swap infected with your bankroll inspirit on ransack down today with unsparing nfl picks. After each NFL pick you inquire tolerable glom how capacious the brobdingnagian suitable approbation acclivity of our NFL handicappers picks profit against the pro football to all intents spread. In totalling to our specialty of NFL sports picks handicapping, we do proffer College football predictions and be non-stop had some excessively kindly appreciation in the predisposed our College pick members, more on our College football pick trunk can be congeal up below. Football Picks