On Oct 10, 10:19 am, sinbad <[email protected]> wrote: > On Oct 9, 8:28 am, Christian Brabandt <[email protected]> wrote: > > > > > > > > > > > Hi sinbad! > > > On Sa, 08 Okt 2011, sinbad wrote: > > > > does it matter how these entries are created (lgrep, lexpr)...? > > > For filling location lists, the script i am using uses 'lexpr' to > > > populate the location-list entries, the files are C source file. > > > I believe you might have used lgrep or someother command, > > > if you happen to work C code, can you try the same thing works > > > for Cscope results on quickfix or location lists. Clearly It didn't > > > work for me. > > > > thanks for checking out for me. > > > Can you give us a reproducible example how you created the location list > > and what you did to test it? Oh and what version are you using? > > > regards, > > Christian > > As an example i am using vim 7.3 source code. I am listing all the > references > of the ResetRedobuff() function using Gtags plugin of "Gnu Global" > tool. > > Location List: the list is filled using the following Gtags command > > :Gtags -r ResetRedobuff > :lopen > > edit.c|404| ResetRedobuff(); > edit.c|6436| ResetRedobuff(); > misc2.c|1176| ResetRedobuff(); > misc2.c|1177| ResetRedobuff(); > normal.c|1506| ResetRedobuff(); > normal.c|3626| ResetRedobuff(); > normal.c|7380| ResetRedobuff(); > spell.c|10317| ResetRedobuff(); > > " Fill the variable 'x' with current location lsit details > :let x = getloclist(0) > :echo x > > [{'lnum': 404, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, > 'type': '', 'pattern': '', 'text': ' ResetRedobuff();'}, > {'lnum': 6436, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': > 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' > ResetRedobuff();'}, {'lnum': 1176, 'bufnr': 3, 'col': 0, 'valid': 1, > 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' > ResetRedobuff();'}, {'lnum': 1177, 'bufnr': 3, 'col': 0, > 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': > ' ResetRedobuff();'}, {'lnum': 1506, 'bufnr': 4, 'col' > : 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', > 'text': ' ResetRedobuff();'}, {'lnum': 3626, > 'bufnr': 4, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': > '', 'pattern': '', 'text': ' ResetRedobuff();'}, {'lnum': > 7380, 'bufnr': 4, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': > '', 'pattern': '', 'text': ' ResetRedobuff();'}, {'lnum': 10317, > 'bufnr': 5, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': > > -1, 'type': '', 'pattern': '', 'text': ' > ResetRedobuff();'}] > > " set the location list with contents from 'x' > :call setloclist(0,x) > > :lopen > New Location List: observe that the filenames are missing, all the > following are dead links. > > |404| ResetRedobuff(); > |6436| ResetRedobuff(); > |1176| ResetRedobuff(); > |1177| ResetRedobuff(); > |1506| ResetRedobuff(); > |3626| ResetRedobuff(); > |7380| ResetRedobuff(); > |10317| ResetRedobuff(); > > :echo getloclist(0) " observe that 'valid' field is '0' > > [{'lnum': 404, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, > 'type': '', 'pattern': '', 'text': ' ResetRedobuff();'}, > {'lnum': 6436, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': > 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' > ResetRedobuff();'}, {'lnum': 1176, 'bufnr': 0, 'col': 0, 'valid': 0, > 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' > ResetRedobuff();'}, {'lnum': 1177, 'bufnr': 0, 'col': 0, > 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': > ' ResetRedobuff();'}, {'lnum': 1506, 'bufnr': 0, 'col' > : 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', > 'text': ' ResetRedobuff();'}, {'lnum': 3626, > 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': > '', 'pattern': '', 'text': ' ResetRedobuff();'}, {'lnum': > 7380, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': > '', 'pattern': '', 'text': ' ResetRedobuff();'}, {'lnum': 10317, > 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': > > -1, 'type': '', 'pattern': '', 'text': ' > ResetRedobuff();'}] > > For reference i am pasting the Gtags plugin code. > > " File: gtags.vim > " Author: Tama Communications Corporation > " Version: 0.5 > " Last Modified: June 27, 2011 > " > " Copyright and licence > " --------------------- > " Copyright (c) 2004, 2008, 2010, 2011 Tama Communications Corporation > " > " This file is part of GNU GLOBAL. > " > " This program is free software: you can redistribute it and/or modify > " it under the terms of the GNU General Public License as published by > " the Free Software Foundation, either version 3 of the License, or > " (at your option) any later version. > " > " This program is distributed in the hope that it will be useful, > " but WITHOUT ANY WARRANTY; without even the implied warranty of > " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > " GNU General Public License for more details. > " > " You should have received a copy of the GNU General Public License > " along with this program. If not, see <http://www.gnu.org/licenses/>. > > " > " Overview > " -------- > " The gtags.vim plug-in script integrates the GNU GLOBAL source code > tag system > " with Vim. About the details, seehttp://www.gnu.org/software/global/. > " > " Installation > " ------------ > " Drop the file in your plug-in directory or source it from your > vimrc. > " To use this script, you need the GNU GLOBAL-5.7 or later installed > " in your machine. > " > " Usage > " ----- > " First of all, you must execute gtags(1) at the root of source > directory > " to make tag files. Assuming that your source directory is '/var/ > src', > " it is necessary to execute the following commands. > " > " $ cd /var/src > " $ gtags > " > " And you will find four tag files in the directory. > " > " General form of Gtags command is as follows: > " > " :Gtags [option] pattern > " > " To go to func, you can say > " > " :Gtags func > " > " Input completion is available. If you forgot function name but > recall > " only some characters of the head, please input them and press <TAB> > key. > " > " :Gtags fu<TAB> > " :Gtags func <- Vim will append 'nc'. > " > " If you omitted argument, vim ask it like this: > " > " Gtags for pattern: <current token> > " > " Vim execute `global -x main', parse the output, list located > " objects in quickfix window and load the first entry. The quickfix > " windows is like this: > " > " gozilla/gozilla.c|200| main(int argc, char **argv) > " gtags-cscope/gtags-cscope.c|124| main(int argc, char **argv) > " gtags-parser/asm_scan.c|2056| int main() > " gtags-parser/gctags.c|157| main(int argc, char **argv) > " gtags-parser/php.c|2116| int main() > " gtags/gtags.c|152| main(int argc, char **argv) > " [Quickfix List] > " > " You can go to any entry using quickfix command. > " > " :cn' > " go to the next entry. > " > " :cp' > " go to the previous entry. > " > " :ccN' > " go to the Nth entry. > " > " :cl' > " list all entries. > " > " You can see the help of quickfix like this: > " > " :h quickfix > " > " Suggested map: > " map <C-n> :cn<CR> > " map <C-p> :cp<CR> > " > " You can use POSIX regular expression too. It requires more execution > time though. > " > " :Gtags ^[sg]et_ > " > " It will match to both of 'set_value' and 'get_value'. > " > " To go to the referenced point of func, add -r option. > " > " :Gtags -r func > " > " To go to any symbols which are not defined in GTAGS, try this. > " > " :Gtags -s func > " > " To go to any string other than symbol, try this. > " > " :Gtags -g ^[sg]et_ > " > " This command accomplishes the same function as grep(1) but is more > convenient > " because it retrieves the entire directory structure. > " > " To get list of objects in a file 'main.c', use -f command. > " > " :Gtags -f main.c > " > " If you are editing `main.c' itself, you can use '%' instead. > " > " :Gtags -f % > " > " You can browse project files whose path includes specified pattern. > " For example: > " > " :Gtags -P /vm/ <- all files under 'vm' directory. > " :Gtags -P \.h$ <- all include files. > " :Gtags -P init <- all paths includes 'init' > " > " If you omitted the argument and input only <ENTER> key to the > prompt, > " vim shows list of all files in your project. > " > " You can use all options of global(1) except for the -c, -p, -u and > " all long name options. They are sent to global(1) as is. > " For example, if you want to ignore case distinctions in pattern. > " > " :Gtags -gi paTtern > " > " It will match to both of 'PATTERN' and 'pattern'. > " > " If you want to search a pattern which starts with a hyphen like '-C' > " then you can use the -e option like grep(1). > " > " :Gtags -ge -C > " > " By default, Gtags command search only in source files. If you want > to > " search in both source files and text files, or only in text files > then > " > " :Gtags -go pattern # both source and text > " :Gtags -gO pattern # only text file > " > " See global(1) for other options. > " > " The GtagsCursor command brings you to the definition or reference of > " the current token. > " > " :GtagsCursor > " > " Suggested map: > " map <C-\>^] :GtagsCursor<CR> > " > " If you have the hypertext generated by htags(1) then you can display > " the same place on mozilla browser. Let's load mozilla and try this: > " > " :Gozilla > " > " Suggested map: > " map <C-g> :Gozilla<CR> > " > " If you want to load vim with all main()s then following command line > is useful. > " > " % vim '+Gtags main' > " > " Also see the chapter of 'vim editor' of the on-line manual of > GLOBAL. > " > " % info global > " > if exists("g:loaded_gtags") || &cp > finish > endif > let g:loaded_gtags = 1 > > " Open the Gtags output window. Set this variable to zero, to not > open > " the Gtags output window by default. You can open it manually by > using > " the :cwindow command. > " (This code was drived from 'grep.vim'.) > if !exists("g:Gtags_OpenQuickfixWindow") > let g:Gtags_OpenQuickfixWindow = 1 > endif > > " Character to use to quote ... > > read more »
btw, i have seen this issue in bot vim 7.0 and vim 7.3 thanks -- 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
