The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Vim-tab-a-licious

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Britt

Posts: 1319
Nickname: jamesbritt
Registered: Apr, 2003

James Britt is a principal in 30 Second Rule, and runs ruby-doc.org and rubyxml.com
Vim-tab-a-licious Posted: Jun 27, 2007 12:29 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by James Britt.
Original Post: Vim-tab-a-licious
Feed Title: James Britt: Ruby Development
Feed URL: http://feeds.feedburner.com/JamesBritt-Home
Feed Description: James Britt: Playing with better toys
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by James Britt
Latest Posts From James Britt: Ruby Development

Advertisement

I’ve tried using the built-in IDE for DrScheme but my fingers want to viminate the code.

To do the vim thing (gvim, actually), I first wanted to know how to call my scheme code from the command line.

A short Google, and presto:

     $ mzscheme -r   foobar.scm 

Next, because shifting from editor to terminal is suspiciously like work, I looked around for a nice way to map this to a keyboard command.

My first poke was something like this:

      map ss <ESC>:! mzscheme -r    %<CR>

That worked, but it wasn’t really making my day. I would prefer to have the results in a new buffer. I then found this on vim.org:

function! TabMessage(cmd)
  redir => message
  silent execute a:cmd
  redir END
  tabnew
  silent put=message
  set nomodified
endfunction
command! -nargs=+ -complete=command TabMessage call TabMessage(<q-args>) 

I combined that with the previous mapping to create this:

      map ss   <ESC>:TabMessage !  mzscheme -r  % <CR><ESC>:  % s/\r//g<CR>

(I needed that last part because I was seeing ^M in the results.)

Very cool. However, while vim7 has tabs, I’ve not gotten used to using them. I tend to just have many instances of gvim floating around. I think that’s because I’m used to navigating tabs a certain way in Firefox. And my vim habits started with vim5.

Given the “bang output in a tab” macro, I decide to go figure out the proper tab navigation commands and just make myself learn them. But, no need: Kim Schulz wrote up mappings to do Firefox-style tab-nav in vim:

" tab navigation like firefox
:nmap <C-S-tab> :tabprevious<cr>
:nmap <C-tab> :tabnext<cr>
:map <C-S-tab> :tabprevious<cr>
:map <C-tab> :tabnext<cr>
:imap <C-S-tab> <ESC>:tabprevious<cr>i
:imap <C-tab> <ESC>:tabnext<cr>i
:nmap <C-t> :tabnew<cr>
:imap <C-t> <ESC>:tabnew<cr> 

Quite the slickness.

Read: Vim-tab-a-licious

Topic: Tonight at AgileRTP: Lining Up Agile with Higher Level Business Goals Previous Topic   Next Topic Topic: include Spring

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use