02 May '12, 3pm

How to extract an intention-revealing name using Vim

May 2, 2012 Tagged: vim golf refactoring Comments (View) How to extract an intention-revealing name using Vim This method has a magic number : def wait_time @env[QUEUE_WAIT_HEADER].to_i / 1000 end Let’s extract that to an intention-revealing name . We’ll type: /1000<Enter> # Find the number we want to extract cwmilliseconds_per_second<Esc> # Replace the number with a variable name O<Ctrl+A> = <Esc>p # Assign the replaced number to the variable The result: def wait_time milliseconds_per_second = 1000 @env[QUEUE_WAIT_HEADER].to_i / milliseconds_per_second end Under the covers: <Ctrl+A> inserts the last text you typed in insert mode, so the variable name is available after replacing the number Replacing or deleting text in Vim will place that text in your default buffer, so the number is available to put at the end Assuming your cursor is at the value you want to extract, thi...

Full article: http://robots.thoughtbot.com/post/22258289125/how-to-extr...

Tweets

Use ctags for instantaneous tab completion in vim:

robots.thoughtbot.com 06 May '12, 11pm

April 8, 2009 Tagged: ack copy grep integration linux osx paste search vim Comments (View) Integrating vim into your life ...

How to Promote Your Local Biz Using Social, Local and Mobile

How to Promote Your Local Biz Using Social, Loc...

searchenginejournal.com 03 May '12, 6pm

The Web changes quickly. Only a couple of years ago, most people googled a restaurant at home before going out for dinner,...