autocomplete on the command line from words in buffers
Hello All, I did ask this question on comp.editors and didn't get an answer that was satisfactory. I want to develop a plugin just using vim scripts for the verilog language. In the plugin I have functions that require arguments that are words used in the current open buffers. On the command line, I want to autocomplete these words that are arguments to functions. For example: :call function1("last_","first_") In open buffers, the words called last_buffer_value and first_buffer_value are used. So when I hit I want that word to be completed so the result would be :call function1("last_buffer_value","first_buffer_value") Is there a way to do this? Thanks in advance, Dan Fabrizio
FW: autocomplete on the command line from words in buffers
Hello All, I want to develop a plugin just using vim scripts for the verilog language. In the plugin I have functions that require arguments that are words used in the current open buffers. On the command line, I want to autocomplete these words that are arguments to functions. For example: :call function1("last_","first_") In open buffers, the words called last_buffer_value and first_buffer_value are used. So when I hit I want that word to be completed so the result would be :call function1("last_buffer_value","first_buffer_value") Is there a way to do this? Thanks in advance, Dan Fabrizio
RE: autocomplete on the command line from words in buffers
Hi David, Ok, this looks like it could be helpful. I haven't worked with user commands before so I would think with getCmdLine() and a user defined function I could get this done. I'm just starting with vim scripts so a simplified code example would really would be good if that is possible. Also how do you debug vim scripts? Thanks, -Original Message- From: Larson, David [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 1:11 PM To: Dan Fabrizio; vim@vim.org Subject: RE: autocomplete on the command line from words in buffers Hello Dan, I suggest wrapping these functions into vim commands and then leverage the command completion feature. See: :help :command-completion HTH, David -Original Message----- From: Dan Fabrizio [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 5:27 AM To: vim@vim.org Subject: FW: autocomplete on the command line from words in buffers Hello All, I want to develop a plugin just using vim scripts for the verilog language. In the plugin I have functions that require arguments that are words used in the current open buffers. On the command line, I want to autocomplete these words that are arguments to functions. For example: :call function1("last_","first_") In open buffers, the words called last_buffer_value and first_buffer_value are used. So when I hit I want that word to be completed so the result would be :call function1("last_buffer_value","first_buffer_value") Is there a way to do this? Thanks in advance, Dan Fabrizio
RE: autocomplete on the command line from words in buffers
Does Vim keep a Dict or list of names from all the open buffers that I can use? It sounds like there might be a way using command-completion as mentioned below and also using the getLineCmd() function? Thanks. -Original Message- From: Andy Wokula [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 6:28 PM To: Dan Fabrizio Cc: Larson, David; vim@vim.org Subject: Re: autocomplete on the command line from words in buffers Larson, David schrieb: > Hello Dan, > > I suggest wrapping these functions into vim commands and then leverage > the command completion feature. See: > > :help :command-completion > > HTH, > David > > -----Original Message- > From: Dan Fabrizio [mailto:[EMAIL PROTECTED] > Sent: Monday, May 07, 2007 5:27 AM > To: vim@vim.org > Subject: FW: autocomplete on the command line from words in buffers > > Hello All, > > > I want to develop a plugin just using vim scripts for the verilog > language. > In the plugin I have functions that require arguments that are words > used in > the current open buffers. > > On the command line, I want to autocomplete these words that are > arguments > to functions. > > For example: > > :call function1("last_","first_") > > In open buffers, the words called last_buffer_value and > first_buffer_value > are used. So when I hit I want that word to be completed so the > result > would be > > :call function1("last_buffer_value","first_buffer_value") > > Is there a way to do this? > > Thanks in advance, > Dan Fabrizio IMHO this will become difficult. In Insert mode, Ctrl-N/Ctrl-P scans through the buffers for words, but I think there is no way to make Vim provide a similar list of completions in the command-line. You have to (kind of) scan the buffers yourself ... Please correct me if I'm wrong -- Regards, Andy EOM
RE: autocomplete on the command line from words in buffers
Does anyone know if there is a plugin that does this kind of thing? I would be able to see the source to get more details on how this would be done. Thank you for all the advice below. -Dan -Original Message- From: Suresh Govindachar [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 9:36 PM To: 'Dan Fabrizio'; 'Andy Wokula' Cc: 'Larson, David'; vim@vim.org Subject: RE: autocomplete on the command line from words in buffers See help on command-completion-custom, bufnr(), bufnr("$"), bufname(), , and . Doubt if you would need to use getLineCmd(). --Suresh -Original Message- From: Dan Fabrizio [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 5:29 PM To: 'Andy Wokula' Cc: 'Larson, David'; vim@vim.org Subject: RE: autocomplete on the command line from words in buffers Does Vim keep a Dict or list of names from all the open buffers that I can use? It sounds like there might be a way using command-completion as mentioned below and also using the getLineCmd() function? Thanks. -Original Message- From: Andy Wokula [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 6:28 PM To: Dan Fabrizio Cc: Larson, David; vim@vim.org Subject: Re: autocomplete on the command line from words in buffers Larson, David schrieb: > Hello Dan, > > I suggest wrapping these functions into vim commands and then leverage > the command completion feature. See: > > :help :command-completion > > HTH, > David > > -Original Message- > From: Dan Fabrizio [mailto:[EMAIL PROTECTED] > Sent: Monday, May 07, 2007 5:27 AM > To: vim@vim.org > Subject: FW: autocomplete on the command line from words in buffers > > Hello All, > > > I want to develop a plugin just using vim scripts for the verilog > language. > In the plugin I have functions that require arguments that are words > used in > the current open buffers. > > On the command line, I want to autocomplete these words that are > arguments > to functions. > > For example: > > :call function1("last_","first_") > > In open buffers, the words called last_buffer_value and > first_buffer_value > are used. So when I hit I want that word to be completed so the > result > would be > > :call function1("last_buffer_value","first_buffer_value") > > Is there a way to do this? > > Thanks in advance, > Dan Fabrizio IMHO this will become difficult. In Insert mode, Ctrl-N/Ctrl-P scans through the buffers for words, but I think there is no way to make Vim provide a similar list of completions in the command-line. You have to (kind of) scan the buffers yourself ... Please correct me if I'm wrong -- Regards, Andy EOM
^M displayed in vi but not in vim
Hi all, Does anyone know why vim don't show the ^M characters in a file but vi does? :set list in vim shows $ at the end of the lines but no ^M characters? :set ff=unix :w This removed the ^M characters but I had to use vi to verify. Is there some setting I'm missing that needed to show the ^M characters in vim? Thanks in advance, Dan