RE: Making Omni Complete suggest but not complete

2006-06-19 Thread Jared Parsons

 -Original Message-
 From: Linsong [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 19, 2006 12:58 AM
 To: Jared Parsons
 Cc: vim@vim.org
 Subject: Re: Making Omni Complete suggest but not complete
 
 Jared Parsons wrote:
 
 Is there any way to make omni complete popup a list of suggestions but
 not
 immediately add one of them to the buffer?  I find omni complete very
 useful
 but it's incredibly annoying that it auto-chooses one of the entries.
 I'd
 prefer it popup the list of suggestions but not modify the buffer.
 
 
 
 If I understand your question correctly, I think what you need is:
:set completeopt=menu,preview,longest

With these options it still inserts a match into the buffer.  I don't want
omni complete to insert anything.  I just want it to popup a list of
possible matches.

Jared



Making Omni Complete suggest but not complete

2006-06-16 Thread Jared Parsons
Is there any way to make omni complete popup a list of suggestions but not
immediately add one of them to the buffer?  I find omni complete very useful
but it's incredibly annoying that it auto-chooses one of the entries.  I'd
prefer it popup the list of suggestions but not modify the buffer. 

-- 
Jared






RE: Making Omni Complete suggest but not complete

2006-06-16 Thread Jared Parsons
I'm both working on a new plugin (C#) and using a couple of existing ones.
I tried the hack of returning the original text as well.  It works if you
are using omni complete on demand.  However I would like to add automatic
omni complete after certain characters such as '.'.  In that case you can't
insert the existing text (there isn't any) and if you try and return '' as
one of the valid words omni complete will just ignore it.  

Jared

-Original Message-
From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 16, 2006 12:34 PM
To: Jared Parsons
Cc: vim@vim.org
Subject: Re: Making Omni Complete suggest but not complete


On Fri, 16 Jun 2006 at 11:46am, Jared Parsons wrote:

 Is there any way to make omni complete popup a list of suggestions but not
 immediately add one of them to the buffer?  I find omni complete very
useful
 but it's incredibly annoying that it auto-chooses one of the entries.  I'd
 prefer it popup the list of suggestions but not modify the buffer. 


You can workaround this by always returning the original text also as
the first match. If you are writing a plugin, then it is easy for you to
do this, but if you are using an existing plugin, you might have to wrap
the original function and add the original text before returning it. The
omni completion plugins should probably make this a standard setting.

-- 
HTH,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



RE: Making Omni Complete suggest but not complete

2006-06-16 Thread Jared Parsons


 -Original Message-
 From: Hari Krishna Dara [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 16, 2006 2:54 PM
 To: Jared Parsons
 Cc: vim@vim.org
 Subject: RE: Making Omni Complete suggest but not complete
 
 
 On Fri, 16 Jun 2006 at 2:23pm, Jared Parsons wrote:
 
  I'm both working on a new plugin (C#) and using a couple of existing
 ones.
  I tried the hack of returning the original text as well.  It works if
 you
  are using omni complete on demand.  However I would like to add
 automatic
  omni complete after certain characters such as '.'.  In that case you
 can't
  insert the existing text (there isn't any) and if you try and return ''
 as
  one of the valid words omni complete will just ignore it.
 
  Jared
 
 Yep, I saw that problem as well. As I mentioned in one of my other
 threads, I am trying to do automatic completion after every character
 using CursorMovedI event, and observe this issue sometimes, even when I
 always have some text to return.
 
 If you are triggering completion on say '.', see if you can
 automatically rollback the completion by also doing a C-P. However you
 might not find a hook to invoke C-P
 
 As a workaround, how about marking the start of completion as including
 the . character, and include . also as the first result? This will
 not work on the first column in the line, but I bet you will not face
 that problem.

That's a good solution.  The drop down will look a bit funny but it should
solve the immediate issue.  

Is there a fix planned for this in the future.  Some option I can specify to
prevent auto-insertion of a match?  

--
Jared


 
 --
 HTH,
 Hari
 
  -Original Message-
  From: Hari Krishna Dara [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 16, 2006 12:34 PM
  To: Jared Parsons
  Cc: vim@vim.org
  Subject: Re: Making Omni Complete suggest but not complete
 
 
  On Fri, 16 Jun 2006 at 11:46am, Jared Parsons wrote:
 
   Is there any way to make omni complete popup a list of suggestions but
 not
   immediately add one of them to the buffer?  I find omni complete very
  useful
   but it's incredibly annoying that it auto-chooses one of the entries.
 I'd
   prefer it popup the list of suggestions but not modify the buffer.
  
 
  You can workaround this by always returning the original text also as
  the first match. If you are writing a plugin, then it is easy for you to
  do this, but if you are using an existing plugin, you might have to wrap
  the original function and add the original text before returning it. The
  omni completion plugins should probably make this a standard setting.
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com



Re: matchparen bug?

2006-06-08 Thread Jared
On 06/08/2006 04:14, Mathias Michaelis wrote:
 Bram has fixed this bug already a month ago ;-)
 
 See: http://groups.yahoo.com/group/vimdev/message/43639

Sigh.  Good news, but I wish we knew this 13 e-mails ago.  :-)

Thanks to everyone that looked into this.

--
Jared



Re: matchparen bug?

2006-06-07 Thread Jared
On 06/06/2006 23:47, Benji Fisher wrote:
 I am stumped.  I tried it with
 
 $ vim -u NONE
 :set nocp
 :runtime plugin/matchparen.vim
 
 and I still get the cursor on the o in the third line.

Benji, Ilya,

I appreciate both of you taking the time to investigate.  I'm a little
puzzled why Benji and I are seeing this issue, but Ilya is not.

Can anyone else either confirm or refute this?  Is it perhaps a
Windows-specific bug?  I only currently have access to Vim 7 on a Windows
system, so I'm unable to test it under Linux.

--
Jared Breland
[EMAIL PROTECTED]
http://www.legroom.net/



matchparen bug?

2006-06-01 Thread Jared
I think I found a bug in in the matchparen feature of Vim 7.  I'm using the
7.0 binary release for Windows XP.

When I'm in Insert mode and moving across lines, if the cursor passes over a
paren (defined here as any character in the matchpairs option), the cursor
will stay in the column position when moving to the next line.  See the
following code for an example:

let g:loaded_autoit_completion = 1
let s:cache_name = []
 This function is used for the 'omnifunc' option.

Now, if my cursor is on the '1' in the first line and I press down twice,
I'd expect the cursor to end up on the 'o' in 'omnifunc' in the third line.
 However, if I'm in Insert mode and matchparen is active, then my cursor
will instead end up on the 'e' in 'used'.

If I'm in Normal mode, this does not happen.  If I issue :NoMatchParen, this
does not happen.  However, if I reissue :DoMatchParen and enter Insert mode,
the problem reoccurs.

Can anyone else confirm this?  I do have a lot of customizations in my vimrc
files, so I'm not entirely sure it's not a problem that I'm causing myself,
but I've reviewed my vimrc pretty carefully and I can't find anything that
should cause this issue.  If anyone else would like to check, you can find
both vimrc files here:

http://www.legroom.net/~jbreland/transfer/Packages/Vim_7.0/support/_vimrc
http://www.legroom.net/~jbreland/transfer/Packages/Vim_7.0/support/_gvimrc

Please let me know if this is an actual Vim bug.  Thanks.

--
Jared



sftp file browsing

2006-05-30 Thread Jared
Is it possible to browse a remote folder through FTP?  Eg, if I enter ':e .'
it'll display the directory browser for the current directory.  How can I do
the same for remote directories?

I can run ':e sftp://sage/nessus_conf/nessusd.conf' to edit a particular
file, but if I don't know the exact filename I'd like to be able to run
something like ':e sftp://sage/nessus_conf/' to get a directory listing.

Thanks.

--
Jared



Re: sftp file browsing

2006-05-30 Thread Jared

On 05/30/2006 13:00, Thor Andreassen wrote:
 On Tue, May 30, 2006 at 11:19:11AM -0500, Jared wrote:
 Is it possible to browse a remote folder through FTP?  Eg, if I enter
 ':e .' it'll display the directory browser for the current directory.
 How can I do the same for remote directories?
  
 This already works with newer versions of the netrw plugin. An upgrade
 would probably solve this issue for you.

hmm... I just realized that I was trying this on 6.3.  The only copy of Vim
7 I have available is on my Windows box, but of course there is no sftp
command.  I do have pftp from PuTTY, however.  I can I change the command
that netrw uses?  I see from the docs that it's saved in the
g:netrw_sftp_cmd variable, but I can't figure out how to change it.

Thanks.

--
Jared



Re: right-to-left text selection

2006-05-21 Thread Jared
On 5/20/2006 7:21 PM, Gerald Lai wrote:
 Hi, Gerald.  Thanks for the reply.  This is a pretty creative suggestion,
 but I can't get it to work quite right.  I tried adding this to my
 .vimrc:

 nnoremap 2-LeftMouse viwoC-g
 vnoremap 2-LeftDrag  LeftDrag
 
 Yes, Vim should recognize the 2-LeftDrag event. I verified your
 problem and found out what happened :)
 
 Stripping down my mappings led me to the solution. Add this extra
 mapping:
 
   nnoremap LeftRelease Nop

That did it!  Thanks again for the help, Gerald.  With this I'm finally able
to mark the last thing of my vimrc todo list.  :-)

--
Jared


Re: right-to-left text selection

2006-05-17 Thread Jared
On 5/17/2006 11:11 PM, Eric Arnold wrote:
 While the visual mode selection is active, hitting o moves to the
 opposite corner.

 SNIP

 Keep in mind that it doesn't work the same with a selection made by
 the mouse, since that leaves it in select mode not visual mode,
 which has some properties like insert mode, but in general has to be
 treated differently.  Use ^G to switch visual/select modes.


Ok, this was the problem.  I was using select mode rather than visual mode,
and it was behaving exactly as you described.  If I select the text, then
hit ^gol^c, I can finally select all text, including the last character.  Yay!

Not exactly the easiest key sequence, but at least I can make it work now.

Thanks, Eric!

--
Jared


using variables in ! command

2006-05-17 Thread Jared
This should be really easy, but I can't find an example in the help that
shows what I'm trying to do.  I'm mapping an external command to a function
key, but I can't figure out how to include a variable in the command.
Specifically, I want to specify the %programfiles% directory.  So far I've
tried:

1) map F2 :silent ! start  $PROGRAMFILES\Inno Setup\ISetup.hlp
2) map F2 :silent ! start  %PROGRAMFILES%\Inno Setup\ISetup.hlp
3) let isshelp = $PROGRAMFILES.\\Inno Setup\\ISetup.hlp
   map F2 :silent ! start  isshelp

However, they all fail:

1) :echo $PROGRAMFILES displays the correct page, but the above command
simply tries to run $PROGRAMFILES as a literal string

2) Each % expands to the source filename rather than being recognized as an
environmental variable

3) isshelp contains the correct string, but it's output literally rather
than treated as a variable


Like I said, I know this is a pitiful problem, but I'm running out of ideas.
 What am I doing wrong?

--
Jared


ctrl+shift key mappings

2006-05-17 Thread Jared
Ok, this will be my last question for the night (promise!).  I'd like to map
separate commands to Ctrl-C and Ctrl-Shift-C.  I've tried a couple different
ways to do it, but this one seems like it should be most correct:

vnoremap C-c +y
vnoremap C-S-c ^Gol+y

What's happening, though, is that the C-S-c map overwrites the C-c map.  If
I were to place C-c below C-S-c in .vimrc, the it'd be the other way around.

So, two questions: 1) Am I defining the C-S-c mapping correctly?  I
believe that's how it's done, but I couldn't find a specific example in the
docs.  2) How do I make Vim distinguish between the two commands?

Actually, I also have a 3rd, pseudo-related question:  How do I include a
control key sequence in a map?  I'm using ^G in the above example, but that
seems to be completely ignored when I hit C-S-c.  I also tried C-g, but
that's also ignored.

Thanks once again.  Believe me when I say that I'm most appreciative of the
help that's constantly offered on this mailing list.

--
Jared


Re: using variables in ! command

2006-05-17 Thread Jared
On 5/18/2006 12:08 AM, Yakov Lerner wrote:
 Try
 
 map F2 :exe :silent! start .isshelp cr

Thanks for the reply, Yakov.  However, that gives me an error message:

E121: Undefined variable: isshelp
E15: Invalid expression:silent! start .isshelp

Any other ideas?

--
Jared


Re: using variables in ! command

2006-05-17 Thread Jared
On 5/18/2006 12:31 AM, A.J.Mechelynck wrote:
 :exe 'silent ! start  ' . $PROGRAMFILES . '\Inno Setup\Isetup.hlp'

That did it!

Thanks a bunch, Tony.

--
Jared


Re: sourcing vimrc files

2006-05-16 Thread Jared
On 5/14/2006 8:41 PM, Gerald Lai wrote:
 Encase your function like this:
 
 if !exists(*Source_vimrc)
   function Source_vimrc()
   ...
   endfunction
 endif

Thanks, Gerald.  This worked perfectly.

Also, thanks to everyone else for their suggestions.  I appreciate the
feedback and read up on the suggested commands, but this ended up being the
easiest.  :-)

--
Jared


right-to-left text selection

2006-05-16 Thread Jared
Ok, I have a really weird questions this time.  I use the
selection=exclusive option, because I don't like Vim to select the hidden
newline character at the end of lines when I'm copying or deleting an
entire line.  However, this has one side effect that I have not been able to
figure out.  If I try to select a line of text from the right to the left,
it is impossible to select the last character of the line.

Of course, one solution would be to set selection=inclusive, but then the
newline character at the end of the line is always selected when selecting
text from left to right.  I know that sounds pretty trivial, but it's a
major nuisance for my editing style.

So, my question:  is it somehow possible to be able to select the last
character of a line when selecting from right-to-left while using
selection=exclusive?  Alternatively, is there some way to make Vim NOT
select the newline character at the end of the line when selecting text from
left-to-right while using selection=inclusive?  At this point I've tried
quite a few options and I'm thinking it's not, but I'd certainly like to
hear from the pros if they have any suggestions.

Does this even make sense?  Given how many times I used the word select,
probably not.  :-)  Please let me know if this comes across as gibberish and
I'll try to better explain myself.

Thanks!

--
Jared


Re: echo question

2006-05-14 Thread Jared
On 5/14/2006 1:37 AM, Gerald Lai wrote:
 On Sun, 14 May 2006, Yakov Lerner wrote:
 Try 2 things
 (1) add :redraw before the :echo in question
 (2) if that doesn't help, make message shorter.
 I noticed that if message is longer than screen width-15,
 it cases the prompt.
 
 You could also readjust the height of the command-line dynamically:
 
   let msg = str
   let len = strlen(substitute(msg, ., x, g))
   let t_ch = cmdheight
   let cmdheight = len / (columns - 15) + 1
   echo msg
   let cmdheight = t_ch
 
 See :help 'cmdheight'  :help strlen().


I tried adding :redraw, but that didn't seem to work.  As for making the
message shorter or the changing the height, I don't think those are
applicable.  The line is not longer than the window width.  In fact, this is
the function:

function Toggle_spell()
   if spell
  exec set nospell
   else
  exec set spell
  echo ]s to skip to word, zg to add word, z= to suggest word
   endif
endfunction
nmap C-s :call Toggle_spell()CR

I just want to display a message in the status reminding me of the commands
when I enable the spell checker.

Any other ideas?  Thanks.

--
Jared



Re: scrolling in vim7 on winxp?

2006-05-14 Thread Jared
when you say scrolling, do you mean with a mouse wheel?  Or moving dragging
the scroll bar?  Or something else?

I tried to duplicate this behavior, but was unable to do so.  Vim's working
fine on my copy of Windows XP.  This is the stock version, though.

--
Jared Breland
[EMAIL PROTECTED]
http://www.legroom.net/

On 5/13/2006 12:35 PM, oystercatcher wrote:
 I am running vim 7  on winxp  compiled with mingw  7.0223
 
 I have noticed that when I am scrolling through text  (postscript source)
 that I lose focus on the vim window.   I thought at first that I was
 simple bumping another key or the mouse.  Then I thought that
 maybe some running application was somehow taking focus
 to another window.
 
 Since I am not sure of the cause and will continue to monitor
 what might be happening,  I thought I would just ask the list
 if anyone might have noticed the same problem?
 
 Thanks



Re: echo question

2006-05-14 Thread Jared
On 5/14/2006 8:44 AM, Yukihiro Nakadaira wrote:
 I think that your 'cmdheight' is 1 and 'showcmd' or 'ruler' is on and
 perhaps 'laststatus' is 0 or 1.
 How about this
 
 let ru_save = ruler
 let sc_save = showcmd
 set noruler noshowcmd
 echo ]s to skip to word, zg to add word, z= to suggest word
 let showcmd = sc_save
 let ruler = ru_save

I think it was the ruler option that was causing the problem.  I still can't
figure out why echo would behave differently depending on whether it's
called interactively or as part of a function, but by adding the three ruler
lines you suggested above I was able to make it work correctly.

Thanks!

--
Jared


sourcing vimrc files

2006-05-14 Thread Jared
I'd like to map a hotkey to re-source my vimrc files (system + user).  I
originally tried this simple approach:

nmap buffer S-F9 :source $VIM\vimrcCR
\ :source $VIM\_vimrcCR
\ :source $HOME\_vimrcCR

But that failed because source aborts when the file doesn't exist.  I then
modified it to a function call, like so:

function! Source_vimrc()
if filereadable($VIM.'\vimrc')
source $VIM\vimrc
endif
if filereadable($VIM.'\_vimrc')
echo test1
source $VIM\_vimrc
echo test2
endif
if filereadable($HOME.'\_vimrc')
source $HOME\_vimrc
endif
endfunction
nmap buffer S-F9 :call Source_vimrc()CR

Longer and more complicated, but now I can check to see if the file exists
before sourcing it.  However, this also causes a problem: when I try to
source the file containing this function, it gives me an error saying that
it cannot replace the function because it is currently in use.  If I remove
the !, it still gives me an error because it already exists.

Any ideas how to work around this?  Or if you have a different/better way of
doing this, I'm certainly open to suggestions.  :-)

This is on Windows XP.  Thanks.

--
Jared


echo question

2006-05-13 Thread Jared
I have a simple question that I can't seem to figure out.  When I use the
echo command to echo a statement on my open window, it simply displays that
message in the status bar.  However, if I use echo in a function, it adds
Please ENTER or type command to continue after it.

How do I make it not do that?  Eg, I just want it to display the message,
not prompt me to press a key.

Thanks.

--
Jared



get Vim option value?

2006-05-12 Thread Jared
I use a function called Toggle_num() in my .vimrc that toggles line numbers
on/off, and in the process also resizes the Vim window so that the number of
usable columns in the document stays remains constant.  In Vim 7.0, this
was hardcoded to 8, so I just hardcoded the value in the function.

Now, I can limit the line number column with using the numberwidth option.
I'd like to update this function to grow/shrink the columns by numberwidth
instead of leaving it hardcoded to 8.  Problem is, I can't figure out how to
get the value of numberwidth within the script.

How exactly do I do this?  Thanks.

--
Jared



set highlight color?

2006-05-12 Thread Jared
How do I change the background color used for cursorline in Vim 7.0?  I'd
like to make it a few shades darker.  It looks like it can be set with
hl-CursorLine, but I can't figure out how to actually do it.

I currently use the following setting in .gvimrc to set the color scheme:
highlight Normal guifg=white guibg=black

Any suggestions?  Thanks.

--
Jared



Re: set highlight color?

2006-05-12 Thread Jared
Thanks, Gerald.  This worked perfectly.

I didn't realize that I had to apply the highlight setting directly to
CursorLine.  I was trying to group it under Normal.  Oops.  :-)

--
Jared

On 5/12/2006 2:44 PM, Gerald Lai wrote:
 Just like you did with Normal, you can do with CursorLine. For example:
 
   :highlight CursorLine guibg=Grey20
 
 To see what it's current set to:
 
   :hi CursorLine
 
 HTH.
 -- 
 Gerald