Vim Tips Wiki
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 3: Line 3:
 
|previous=1638
 
|previous=1638
 
|next=1640
 
|next=1640
|created=2009
+
|created=November 26, 2009
 
|complexity=basic
 
|complexity=basic
 
|author=EUEU
 
|author=EUEU
Line 14: Line 14:
   
 
==Script==
 
==Script==
Create file <code>~/.vim/plugin/quickfix.vim</code> (Unix) or <code>$HOME/vimfiles/plugin/quickfix.vim</code> (Windows) containing the script below, then restart Vim. After a quickfix command such as <code>:grep</code> is run, the script will automatically be invoked by the <code>QuickfixCmdPost</code> event, and the quickfix list will be sorted by file name and line number, and duplicates will be removed.
+
Create file <tt>~/.vim/plugin/quickfix.vim</tt> (Unix) or <tt>$HOME/vimfiles/plugin/quickfix.vim</tt> (Windows) containing the script below, then restart Vim. After a quickfix command such as <tt>:grep</tt> is run, the script will automatically be invoked by the <tt>QuickfixCmdPost</tt> event, and the quickfix list will be sorted by file name and line number, and duplicates will be removed.
 
<pre>
 
<pre>
 
function! s:CompareQuickfixEntries(i1, i2)
 
function! s:CompareQuickfixEntries(i1, i2)
Line 43: Line 43:
 
{{todo}}
 
{{todo}}
 
*Following is the original code. I am fairly confident that the version shown above is equivalent, but I'm keeping the original code for a while in the hope it will get more checking.
 
*Following is the original code. I am fairly confident that the version shown above is equivalent, but I'm keeping the original code for a while in the hope it will get more checking.
*I do not undertand how two buffers could have the same '''name''' while having different buffer '''numbers''' (buffer names seem to be unique). I would therefore think that '<code>bufname()</code>' could be omitted so the tests simply check buffer numbers, rather than buffer names. [[User:JohnBeckett|JohnBeckett]] 12:07, May 13, 2010 (UTC)
+
*I do not undertand how two buffers could have the same '''name''' while having different buffer '''numbers''' (buffer names seem to be unique). I would therefore think that '<tt>bufname()</tt>' could be omitted so the tests simply check buffer numbers, rather than buffer names. [[User:JohnBeckett|JohnBeckett]] 12:07, May 13, 2010 (UTC)
 
:As far as I can remember I had problems with duplicated entries in my quickfix list because on Ms Windows some file would appear with both 8.3 short names and long name in wy quickfix list as a result of a CScope command. This is why I did that but I am not sure whether this is really required.[[User:EUEU|EUEU]] 16:06, May 18, 2010 (UTC)
 
:As far as I can remember I had problems with duplicated entries in my quickfix list because on Ms Windows some file would appear with both 8.3 short names and long name in wy quickfix list as a result of a CScope command. This is why I did that but I am not sure whether this is really required.[[User:EUEU|EUEU]] 16:06, May 18, 2010 (UTC)
   
Line 77: Line 77:
   
 
==Comments==
 
==Comments==
Possibly <code>bufname()</code> could be omitted from each expression like <code>bufname(a:i1.bufnr)</code> because buffer names are unique, except that more than one buffer can have an empty name. Also should contemplate Windows systems where buffer names (like file names) are not case sensitive. Using <code>==</code> to compare two names is either case sensitive or not, depending on the setting of <code>'ignorecase'</code>. [[User:JohnBeckett|JohnBeckett]] 05:01, May 15, 2010 (UTC)
+
Possibly <tt>bufname()</tt> could be omitted from each expression like <tt>bufname(a:i1.bufnr)</tt> because buffer names are unique, except that more than one buffer can have an empty name. Also should contemplate Windows systems where buffer names (like file names) are not case sensitive. Using <tt>==</tt> to compare two names is either case sensitive or not, depending on the setting of <tt>'ignorecase'</tt>. [[User:JohnBeckett|JohnBeckett]] 05:01, May 15, 2010 (UTC)
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)