def ReplaceChunks(chunks):
 chunks_by_file = _SortChunksByFile(chunks)
 sorted_file_list = sorted(iterkeys(chunks_by_file))
 num_files_to_open = _GetNumNonVisibleFiles(sorted_file_list)
 if (num_files_to_open > 0):
  if (not Confirm(FIXIT_OPENING_BUFFERS_MESSAGE_FORMAT.format(num_files_to_open))):
   return
 locations = []
 for filepath in sorted_file_list:
  (buffer_num, close_window) = _OpenFileInSplitIfNeeded(filepath)
  ReplaceChunksInBuffer(chunks_by_file[filepath], vim.buffers[buffer_num], locations)
  if close_window:
   vim.command(u'lclose')
   vim.command(u'hide')
 if locations:
  SetQuickFixList(locations)
 PostVimMessage(u'Applied {0} changes'.format(len(chunks)), warning=False)

def ReplaceChunks ( chunks ) : chunks_by_file = _SortChunksByFile ( chunks ) sorted_file_list = sorted ( iterkeys ( chunks_by_file ) ) num_files_to_open = _GetNumNonVisibleFiles ( sorted_file_list ) if ( num_files_to_open > 0 ) : if ( not Confirm ( FIXIT_OPENING_BUFFERS_MESSAGE_FORMAT . format ( num_files_to_open ) ) ) : return locations = [ ] for filepath in sorted_file_list : ( buffer_num , close_window ) = _OpenFileInSplitIfNeeded ( filepath ) ReplaceChunksInBuffer ( chunks_by_file [ filepath ] , vim . buffers [ buffer_num ] , locations ) if close_window : vim . command ( u'lclose' ) vim . command ( u'hide' ) if locations : SetQuickFixList ( locations ) PostVimMessage ( u'Applied {0} changes' . format ( len ( chunks ) ) , warning = False )
apply the source file deltas supplied in |chunks| to arbitrary files .