ctrl-c oddity with visual block insert

2007-05-07 Thread James Vega
Since C-c is supposed to act like Esc in most circumstances, one
would expect that pressing C-c to end Insert mode during a visual
block insert would prepend the text to all selected lines.  In fact,
This was the behavior in versions of Vim prior to vim7.  As it currently
stands, pressing C-c will only insert the text on the first line of
the visually selected block unless the user has at some point setup a
C-c vmap.  Example:

vim -u NONE -N
:insert
foo
bar
baz
.
ggC-vjjIXXC-c

This will only insert XX at the front of the first line.  If we instead
do the following, the XX will be inserted at the front of every line.

vim -u NONE -N
:vmap C-c nop
:insert
foo
bar
baz
.
ggC-vjjIXXC-c

The presence of the C-c vmap isn't important.  You can vunmap it
immediately after.  It's the mere act of defining a C-c vmap that
causes C-c to act as expected.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: [PATCH] cygwin: Trouble recognizing absolute path

2006-10-13 Thread James Vega
On Fri, Oct 13, 2006 at 09:38:16PM +0200, Corinna Vinschen wrote:
 Interesting enough it works in 6.4 without doing anything similar to my
 patch does to os_unix.c.  What's different in swap file handling between
 6.4 and 7.0 so that it works in the former but doesn;t in the latter?

memline.c was changed for 7.0 as far as how Vim determined where to
store the swapfile when editing symlinks.  The change was to follow the
symlink, find the directory the actual file was in and key off that when
creating the swapfile so that editing the symlink and the actual file at
the same time would cause the 'swapfile already exists' message.  Maybe
this is related.  The relevant code is sectioned off by '#ifdef
HAVE_READLINK'/'#endif' sections in memline.c

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: [PATCH] cygwin: Trouble recognizing absolute path

2006-10-13 Thread James Vega
On Fri, Oct 13, 2006 at 10:34:40PM +0200, Corinna Vinschen wrote:
 On Oct 13 16:06, James Vega wrote:
  On Fri, Oct 13, 2006 at 09:38:16PM +0200, Corinna Vinschen wrote:
   Interesting enough it works in 6.4 without doing anything similar to my
   patch does to os_unix.c.  What's different in swap file handling between
   6.4 and 7.0 so that it works in the former but doesn;t in the latter?
  
  memline.c was changed for 7.0 as far as how Vim determined where to
  store the swapfile when editing symlinks.  The change was to follow the
  symlink, find the directory the actual file was in and key off that when
  creating the swapfile so that editing the symlink and the actual file at
  the same time would cause the 'swapfile already exists' message.  Maybe
  this is related.  The relevant code is sectioned off by '#ifdef
  HAVE_READLINK'/'#endif' sections in memline.c
 
 Thanks for this hint.  I'll look into that in the next couple of days.
 It doesn't seem to be related to the actual directory in which to place
 the swap file, though.  directory is set to /tmp in my example, so the
 swap file should be created there.

I misspoke slightly in my previous email.  The patch isn't purely about
where to store the file.  It primarily deals with determining what
actual file is being edited so that proper swapfile checking can be
performed.  In order to do this it has to resolve the symlink and
determines the absolute path for the file being edited.  It may be that
determining the absolute path is causing the mixup in path formats,
although that seems unlikely since it is a common function used
throughout Vim.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Invoke _gvimrc.vim / unexpected expansions

2006-08-11 Thread James Vega
On Fri, Aug 11, 2006 at 08:43:10AM +0200, jandl wrote:
 Dear colleagues,
 I have 2 problems with gvim
 
 1/ when I start gvim in Windows XP (double click on icon), gvim opens
 without invoking the _gvimrc.vim. I have _gvimrc.vim located in
 c:\programs\vim. I have also tried to put _gvimrc.vim into
 c:\programs\vim\vim70 but it was not automatically started from there
 either.
 
 2/ I am using gvim for edition my latex files and have the Latex-Suite
 as an add-in. That has generated some conflict: whenever I press a '.'
 I get 'C-R=SIDSmartDots()CR'.
 
 Here is my _gvimrc.vim:
 [snip]
  To use it, copy it to
  for Unix and OS/2:  ~/.gvimrc
for Amiga:  s:.gvimrc
   for MS-DOS and Win32:  $VIM\_gvimrc

As your _gvimrc says, there should be no .vim extension on your
_gvimrc (or _vimrc). :)  That will fix 1).

As for 2), you may have to edit the plugin to change that mapping so it
doesn't override a normal Vim command.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Patch 7.0.048

2006-08-08 Thread James Vega
On Tue, Aug 08, 2006 at 08:48:31PM +0200, Bram Moolenaar wrote:
 --- 127,135 
   let nmt = s:tempname(nm)
   if rename(nm, nmt) == 0
 if exists(b:gzip_comp_arg)
 ! call system(a:cmd .   . b:gzip_comp_arg .  ' . nmt . ')
 else
 ! call system(a:cmd .  ' . nmt . ')

If the filename itself has single quotes, this will prematurely end the
quoting.  escape(nmt, ') should probably be used as well.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Running python scripts from Vim

2006-07-28 Thread James Vega
On Fri, Jul 28, 2006 at 01:46:46PM +0200, Preben Randhol wrote:
 I have now tried several vim scripts for python to set up vim as a good
 python IDE. It has taken some time due to that not all scripts are well
 documented and there are some old buggy scripts that makes other scripts
 not work. But now it really starts to shape up :-)

You might be interested in trying out PIDA (http://pida.berlios.de/).

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: vim server ? security hole?

2006-07-26 Thread James Vega
On Wed, Jul 26, 2006 at 10:20:05AM +0200, Marc Weber wrote:
 I did notice that you can do
 su
 gvim
 :echo SERVERNAME
 
 and then using another user
 gvim --servername=GVIMxx --remote-send='!/dowhatyouwant ;-)'
 
 Thus: If you know your admin is using vim you can easily try to get one
 gvim instance to execute arbitrary commands as super user!!

Performing a simple su saves the environment that you su'ed from.  If
you instead ran su -, I imagine this would not work.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: CTRL-S under WXP and Linux

2006-07-17 Thread James Vega
On Mon, Jul 17, 2006 at 01:09:58PM +, Eric Leenman wrote:
 Hi,
 
 I'm using VIM under WXP and under Linux.
 When I type :map it's both mapped as:
 
 v  C-S  * C-C:updateCR
 noC-S  * :updateCR
 
 Why does my screen lock when I press CTRL-S under Linux?
 And is the only way to unlock it CTRL-Q under linux?

That's because of the flow control capabilities terminals have.  If you
google for xoff xon, you'll find sites explaining what the flow
control does.  It's just something that you have to get used to when
using *nixes.  You may be able to disable it through the stty command.

HTH,

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Sudden problem with: exe set listchars=tab:\xbb\xb7,trail:\xb7

2006-07-13 Thread James Vega
On Fri, Jul 14, 2006 at 02:29:49AM +0300, Yakov Lerner wrote:
 I always had this line in my vimrc:
   exe set listchars=tab:\xbb\xb7,trail:\xb7
 (It is equivalent to set listchars=tab:»·,trail:·)
 Suddenly his line stopped working. (I didn't change it)
 It assigns now empty value to listchars:
set listchars?
listchars=tab:,trail:
 
 Command L=line  :set listchars=tab:»·,trail:·
 stopped to work, too.
 It prints E474: Invalid argument: listchars=tab:»·,trail:·
 
 What can be causing this ?

It sounds like you're running Vim in an environment that doesn't
understand those characters.  You'll probably want to check what
'encoding' is.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: why does this mapping interpret the literal and not work?

2006-07-11 Thread James Vega
On Tue, Jul 11, 2006 at 07:50:43AM -0700, Arias Hung wrote:
 When attempting to create a mapping for my muttng.vim file I add the 
 following
 
 :nmap zz w!cr
 
 however it interprets it literally like:
 
 w!cr
 
 instead of interpreting the return cr.  Anyone know why?

You've made a normal mode mapping.  You want to perform a command-line
mode command, but you haven't entered command-line mode.  Adding a :
should fix your problem. :)

  :nmap zz :w!CR

HTH,

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Irritating column numbers with encoding=utf-8

2006-07-05 Thread James Vega
On Wed, Jul 05, 2006 at 11:50:51AM +0200, Jürgen Krämer wrote:
 
 Hi,
 
 with 'encoding' set to utf-8 there is a quite confusing (to me)
 difference between the column number and my expectations (supported by
 the virtual column number) if there are non-ASCII characters on the
 line.

Column number n is really the nth byte on that line.  This is described
at :help /\%c.  This description should explain all the behavior
you're seeing.  This is the intended behavior and I'm not sure of a way
off-hand to get the visual character count like you want.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Restore cursor to last line not working in Vim 7

2006-06-07 Thread James Vega
On Wed, Jun 07, 2006 at 10:26:36AM -0400, Kevin Old wrote:
 Anyone else experiencing this?  Any ideas how to fix it?

If Tim's suggestion does not solve the problem, I'd suggest checking if
your system-wide vimrc has changed.  The code snippet at :help
last-position-jump may have previously been in the system-wide vimrc
but was removed or replaced by a new vimrc.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: I just updated my Vim site

2006-06-06 Thread James Vega
On Tue, Jun 06, 2006 at 03:30:32PM +0200, A.J.Mechelynck wrote:
 James Vega wrote:
 On Mon, Jun 05, 2006 at 11:10:21PM -0700, Hari Krishna Dara wrote:
   
 Isn't there a cross-compiler for producing cygwin executables from
 Linux?
 
 
 There is a cross-compiler for producing Windows native executables.
 It's mingw and that was what I used to produce binaries of the vim7
 pre-release before I found Tony's site.  I'm not sure if it can be used
 to create cygwin executables.
 
 James
   
 MinGW runs on Windows with Unix-like tools, doesn't it?

Yes, that's one use of MinGW, but there is also a linux-win32
cross-compiler.  Your distribution may have packages.  The MinGW wiki
also has a HOWTO[0] for building the cross-compiler from their tools.

James
[0] 
http://www.mingw.org/MinGWiki/index.php/build%20a%20Win32%20x-compiler%20for%20Linux
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: I just updated my Vim site

2006-06-06 Thread James Vega
On Tue, Jun 06, 2006 at 05:58:56PM +0200, A.J.Mechelynck wrote:
 James Vega wrote:
 On Tue, Jun 06, 2006 at 03:30:32PM +0200, A.J.Mechelynck wrote:
   
 James Vega wrote:
 
 On Mon, Jun 05, 2006 at 11:10:21PM -0700, Hari Krishna Dara wrote:
  
   
 Isn't there a cross-compiler for producing cygwin executables from
 Linux?

 
 There is a cross-compiler for producing Windows native executables.
 It's mingw and that was what I used to produce binaries of the vim7
 pre-release before I found Tony's site.  I'm not sure if it can be used
 to create cygwin executables.
 
 James
  
   
 MinGW runs on Windows with Unix-like tools, doesn't it?
 
 
 Yes, that's one use of MinGW, but there is also a linux-win32
 cross-compiler.  Your distribution may have packages.  The MinGW wiki
 also has a HOWTO[0] for building the cross-compiler from their tools.
 
 James
 [0] 
 http://www.mingw.org/MinGWiki/index.php/build%20a%20Win32%20x-compiler%20for%20Linux
   
 My distribution has lots of packages; but searching in yast2 among all 
 (installed and uninstalled) packages for Name/Summary/Description 
 Contains mingw (case-insensitive) gives: Null result. Similarly, rpm 
 -qa |grep mingw (which IIUC searches only the names of installed 
 packages) also gives nothing.
 
 I see that wiki but I'm not anymore enough of a guru to be certain that 
 it will not clobber my installation of gcc for Linux. If it seems simple 
 to you, why don't you do it yourself?

I was more pointing this out for informational purposes instead of
trying to push you to continue producing win32 versions of Vim. :)

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: display tweaks - tilde lines, statusline..

2006-06-05 Thread James Vega
On Mon, Jun 05, 2006 at 01:09:41AM -0400, cga2000 wrote:
 I think I should stick these doubtful customizations of mine in some
 separate file rather than modifying individual colorschemes. I've just
 tested: 
 
 :set FoldColumn=2
 :hi  Foldcolumn ctermbg=black
 
 .. and it adds a 2-column margin to the left of my display and thought
 I could add these to my .vimrc but then this will be lost whenever I
 change colorscheme on the fly.

As Tony mentioned, setting 'foldcolumn' can be done in your vimrc.  The
highlighting can also be done there by taking advantage of autocommands.

  :au ColorScheme * hi FoldColumn ctermbg=black

This only works in vim7 though since that's when the ColorScheme event
was introduced.  It may also be better to set ctermbg=NONE in case you
change which colorscheme you use in the future to one that does not have
a black background.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Functions developed in 6.4, to be used in 7

2006-06-02 Thread James Vega
On Fri, Jun 02, 2006 at 12:53:02PM +0200, Lukas Ruf wrote:
 My questions:
 - can I list all functions that are currently available in an overview
   manner?

If you're referring to Vim's builtin functions, :he functions will
give you the list you're looking for.

 - has there anything changed significantly re. the function handling
   between 6 and 7?

Not that I know of, but :he version7 should list any significant
changes.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: detecting a readonly file and not doing something...

2006-05-30 Thread James Vega
On Tue, May 30, 2006 at 09:04:15AM -0400, Robert Hicks wrote:
 I currently have this:
 
 autocmd BufEnter * :%s/[ \t\r]\+$//e get rid of the pesky ^M
 
 However, it gives me an error I have to enter through when I open a 
 readonly file.

Something along the lines of

  autocmd BufEnter * :if ro | %s/[ \t\r]\+$//e | endif

should do the trick.  :help expr-option shows the different ways you
can access options in expressions.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: detecting a readonly file and not doing something...

2006-05-30 Thread James Vega
On Tue, May 30, 2006 at 09:16:38AM -0400, James Vega wrote:
 On Tue, May 30, 2006 at 09:04:15AM -0400, Robert Hicks wrote:
  I currently have this:
  
  autocmd BufEnter * :%s/[ \t\r]\+$//e get rid of the pesky ^M
  
  However, it gives me an error I have to enter through when I open a 
  readonly file.
 
 Something along the lines of
 
   autocmd BufEnter * :if ro | %s/[ \t\r]\+$//e | endif

That should actually be

  autocmd BufEnter * :if !ro | %s/[ \t\r]\+$//e | endif

since you want the replacement performed only when the buffer is not
readonly.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Perl Support in Debian

2006-05-25 Thread James Vega
On Thu, May 25, 2006 at 12:02:35PM -0400, William O'Higgins Witteman wrote:
 I'm hoping someone has a quick fix for this.  I have installed vim-perl
 on Debian (from unstable)

Debian Vim maintainer hat
Please report bugs with our Vim package directly to us.  This allows us
to determine if it's a packaging problem which we need to deal with or
an upstream problem which we can triage and report to Bram.

The preferred method of reporting bugs is via reportbug:

  apt-get install reportbug  reportbug vim-perl
/Debian Vim maintainer hat

 but when I look at :ver I see that Perl is
 listed as -perl.  As I understand it, I should see +perl.  Is there
 a way to fix this at run-time, or do I have to compile this in?  Thanks.

Are you sure you're running vim.perl and not another one of the variants
we provide?  Try explicitly invoking vim.perl instead of vim.  If that
works, then there's probably another variant of Vim installed which is
being pointed to by the alternatives system.  You can see what
alternatives are providing the vim binary via:

  /usr/sbin/update-alternatives --display vim

HTH,

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: viminfo feature not working after upgrade from vim6.2-vim7.0

2006-05-23 Thread James Vega
On Tue, May 23, 2006 at 05:30:37PM +0530, Srinivas Rao. M wrote:
 Hi,
 When i upgraded my vim from vim6.2 to vim7.0, i am finding that the
 feature viminfo is not working. (Viminfo remembers last position in the
 file when we reopen file). I had set the viminfo option in my .vimrc
 file as.
 
 set viminfo='1000,f1,\500
 
 Do i have to add any special options for vim7 ?.

That feature isn't an option that's set, but an autocommand that is run.
It was probably in your system-wide vimrc before you upgraded.  You can
add the code snippet at :help last-position-jump to your .vimrc to
re-enable that behavior.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: weird issue with :put

2006-05-22 Thread James Vega
On Mon, May 22, 2006 at 02:11:49PM -0700, Hari Krishna Dara wrote:
 
 In a Vim7 session, after working for sometime, I started getting a weird
 error, when one of my plugins did the below:
 
 :put=

This is the same as using:

  :put =

Double quotes are Vim's comment character so you either need to use
single quotes or escape the double quotes.

 and the error was:
 
 E121: Undefined variable: retVal
 E15: Invalid expression: retVal

As noted in the help for :put, if nothing is specified after '=' then
the previous expression is used.  In this case, it appears that
contained a variable that was no longer in scope.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: [BUG] Swap file searched for in the wrong place

2006-05-17 Thread James Vega
On Tue, May 16, 2006 at 11:19:57PM -0500, Gautam Iyer wrote:
 Now when you type vim /tmp/bar it reports that a .swp file is found
 and asks you about recovery. However when you press R for recovering
 the file, vim complains saying it can not find the swap file (probably
 because vim looks for the swap file in /tmp, instead of in /tmp/foo).

This appears to be fixed in vim7.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: Vim 7.0 tablist question

2006-05-05 Thread James Vega
On Fri, May 05, 2006 at 06:49:44AM -0700, Jeff Lanzarotta wrote:
 Hello,
 
 Is there a way to list all the buffers on a tab-page? Not the windows,
 the actual buffers?

tabpagebuflist() may be what you're looking for, but that doesn't mean
the buffers aren't also displayed in another window/tab page.  Buffer's
aren't tied to any specific window or tab page.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: How can I detect the OS?

2006-04-26 Thread James Vega
On Wed, Apr 26, 2006 at 02:34:02PM +0300, Eddy Petrişor wrote:
 Hello,
 
 Is there a way to detect the OS on which Vim is running?

You can use has() and the list of features under :help feature-list to
determine what type of Vim (and therefore under which OS is running).

  if has('win32')
 ... win32 specific stuff ...
  endif

Search for version of Vim from the feature-list help topic and that
should bring you to the different versions for which you can check.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: :for var in list

2006-04-25 Thread James Vega
On Tue, Apr 25, 2006 at 02:21:07PM -0400, Charles E Campbell Jr wrote:
 Hello!
 
 I know this is a late date, but I think it would be helpful if
 
  for var in list
  ...
  endfor
 
 would complete with var= .  For example where this might come in handy:
 
 for home in split(rtp,',')
  if isdirectory(home) | break | endif
 endfor

This seems like a rather arbitrary imposition.  There could be
legitimate reasons for var getting the value  in a loop (such as
looping over the results from matchlist()) which would be confused by
adding an additional loop with var = .

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: [vim 70d] switching tab pages

2006-04-13 Thread James Vega
On Fri, Apr 14, 2006 at 01:18:19AM +0200, Wojciech Pilorz wrote:
 2006/4/13, Bram Moolenaar [EMAIL PROTECTED]:
 
  Wojtek Pilorz wrote:
 
   I have build gvim 7.0d on Fedora Core 4 as
   'Big version with GTK2 GUI.'
  
   I have noticed the following behaviour with multple tab pages (gvim);
  
   1. You can switch with Ctrl-Pgup - Ctrl-PgDown when in normal mode;
   In insert and replace mode you need to type Ctrl-O Ctrl-Pgup/PgDown
   (perhaps should be documented?)
 
  It is documented.
 I could not find that, at least in tabpage.txt.
 And I do not think it is obvious.

I find this no less obvious than not being able to switch windows or
buffers while in insert mode.  It's called insert mode for a reason.
Beginners may be confused by this, but I think that's more because they
usually haven't fully grasped the concept of Vim being a modal editor.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega [EMAIL PROTECTED]


signature.asc
Description: Digital signature