This is my existing script for java imports. It gets around eclim not 
supporting inferring static imports by inserting them into the file before 
calling JavaImportOrganize. The problem is this creates two entries in my undo 
history. One for the static imports and one for the call to JavaImportOrganize. 
I'm trying to use undojoin but it doesn't seem to be working. The call to undo 
doesn't seem to be working either.

Can anyone suggest improvements? Thanks!

function! HandleImports()
  if (&ft == 'java' && eclim#EclimAvailable() && 
eclim#project#util#IsCurrentFileInProject())
    mark `
    call cursor(2, 0)
    normal Aimport static org.junit.Assert.*;
    normal Aimport static org.mockito.Matchers.*;
    normal Aimport static org.mockito.Mockito.*;
    normal O
    normal ``
    try
      " TODO: why doesn't undojoin work?
      undojoin | execute "JavaImportOrganize"
    catch
      " TODO: This doesn't work either.
      undo
    endtry
  endif
endfunction

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to