Re: having a function within an abbreviation

2006-08-21 Thread Yakov Lerner
On 8/21/06, Edward Wong <[EMAIL PROTECTED]> wrote: Dear all, I'm trying to accomplish sth similar as follow: ca grf =(getcmdpos() == 1 && getcmdtype() == ':' ? 'grep -i ' . expand("%:f") . ^V^V^V^V : grf) Hello Edward, ca grf =(getcmdpos() == 1 && getcmdtype() == ':' ? 'grep -i ' .expand("%:f

saving unnamed buffer

2006-08-21 Thread Yakov Lerner
I want to make saving of unnamed buffers possible as follows: When I do :w on a unnamed buffer, I want it to save to the file /tmp/N where N is number. I tried the simple code below, but it does not work. I am getting 'E32: No file name', same error as without this code. How do I fix it ? Tha

Re: saving unnamed buffer

2006-08-21 Thread A.J.Mechelynck
Yakov Lerner wrote: I want to make saving of unnamed buffers possible as follows: When I do :w on a unnamed buffer, I want it to save to the file /tmp/N where N is number. I tried the simple code below, but it does not work. I am getting 'E32: No file name', same error as without this code. H

Re: saving unnamed buffer

2006-08-21 Thread Yakov Lerner
On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: Yakov Lerner wrote: > I want to make saving of unnamed buffers possible as follows: > When I do :w on a unnamed buffer, I want it to save to the > file /tmp/N where N is number. > > I tried the simple code below, but it does not work. I am g

Re: saving unnamed buffer

2006-08-21 Thread Jürgen Krämer
Hi, Yakov Lerner wrote: > On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: >> Yakov Lerner wrote: >>> I want to make saving of unnamed buffers possible as follows: >>> When I do :w on a unnamed buffer, I want it to save to the >>> file /tmp/N where N is number. >>> >>> I tried the simple c

Re: saving unnamed buffer

2006-08-21 Thread Yakov Lerner
On 8/21/06, Yakov Lerner <[EMAIL PROTECTED]> wrote: On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: > Yakov Lerner wrote: > > I want to make saving of unnamed buffers possible as follows: > > When I do :w on a unnamed buffer, I want it to save to the > > file /tmp/N where N is number. > >

Re: having a function within an abbreviation

2006-08-21 Thread Edward Wong
On 8/21/06, Yakov Lerner <[EMAIL PROTECTED]> wrote: ca grf =(getcmdpos() == 1 && getcmdtype() == ':' ? 'grep -i ' .expand("%:f") . Reposition() : 'grf') function! Reposition() call feedkeys("\\") return "" endfun Thanks Yakov! It works. :) I still don't understand why ^V^V^M or ^V^V

Re: saving unnamed buffer

2006-08-21 Thread A.J.Mechelynck
Yakov Lerner wrote: On 8/21/06, Yakov Lerner <[EMAIL PROTECTED]> wrote: On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: > Yakov Lerner wrote: > > I want to make saving of unnamed buffers possible as follows: > > When I do :w on a unnamed buffer, I want it to save to the > > file /tmp/N w

Re: saving unnamed buffer

2006-08-21 Thread Jürgen Krämer
Hi, A.J.Mechelynck wrote: > > Yakov Lerner wrote: > > > > I fixed another bug, the '*' missing in the autocommand: > > > > au BufWritePre * if(expand('%') == '') | exe "file ".TempName() | endif > > au BufWritePre * if(expand('%') == '') | exe "saveas ".TempName() | endif > > > > , but still no l

Re: saving unnamed buffer

2006-08-21 Thread Yakov Lerner
On 8/21/06, Jürgen Krämer <[EMAIL PROTECTED]> wrote: Hi, A.J.Mechelynck wrote: > > Yakov Lerner wrote: > > > > I fixed another bug, the '*' missing in the autocommand: > > > > au BufWritePre * if(expand('%') == '') | exe "file ".TempName() | endif > > au BufWritePre * if(expand('%') == '') | ex

Re: saving unnamed buffer

2006-08-21 Thread Yakov Lerner
On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: Yakov Lerner wrote: > On 8/21/06, Yakov Lerner <[EMAIL PROTECTED]> wrote: >> On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: >> > Yakov Lerner wrote: >> > > I want to make saving of unnamed buffers possible as follows: >> > > When I do

renaming unnamed buffer at creation

2006-08-21 Thread Yakov Lerner
Now that my attempt to write unnamed buffer under name /tmp/N failed, I want to autoname empty buffer. My first attempt does not work. Autoevent is ot invoked. function! TempName() let x=1 while filereadable("/tmp/".x) let x = x + 1 endwhile return "/tmp/".x endfun au BufNew *

Re: renaming unnamed buffer at creation

2006-08-21 Thread Jürgen Krämer
Hi, Yakov Lerner wrote: > > Now that my attempt to write unnamed buffer under > name /tmp/N failed, I want to autoname empty buffer. > My first attempt does not work. Autoevent is ot invoked. > > function! TempName() > let x=1 > while filereadable("/tmp/".x) > let x = x + 1 >

Re: renaming unnamed buffer at creation

2006-08-21 Thread A.J.Mechelynck
Yakov Lerner wrote: Now that my attempt to write unnamed buffer under name /tmp/N failed, I want to autoname empty buffer. My first attempt does not work. Autoevent is ot invoked. function! TempName() let x=1 while filereadable("/tmp/".x) let x = x + 1 endwhile return "/tmp/".

E505, File is write-protected

2006-08-21 Thread Wolfgang Schmidt
Hi vimmers, when I try to write (:w) a certain buffer, I get E505 (~ "file XXX is write-protected, override with w!"). The protection seems to be set by Vim, not the OS (WinXP). So I looked for the "readonly" option value, but it's set to "noreadonly". I also checked "write", which is set t

Re: renaming unnamed buffer at creation

2006-08-21 Thread Charles E Campbell Jr
Yakov Lerner wrote: Now that my attempt to write unnamed buffer under name /tmp/N failed, I want to autoname empty buffer. My first attempt does not work. Autoevent is ot invoked. Hello! The autocmd system is always invoked based on the buffer name. Thus it appears none of the autocmds will f

Re: E505, File is write-protected

2006-08-21 Thread Jürgen Krämer
Hi, Wolfgang Schmidt wrote: > > when I try to write (:w) a certain buffer, I get E505 (~ "file XXX is > write-protected, override with w!"). > The protection seems to be set by Vim, not the OS (WinXP). So I looked > for the "readonly" option value, > but it's set to "noreadonly". I also checke

Re: renaming unnamed buffer at creation

2006-08-21 Thread Jürgen Krämer
Hi, Charles E Campbell Jr wrote: > Yakov Lerner wrote: > > > Now that my attempt to write unnamed buffer under > > name /tmp/N failed, I want to autoname empty buffer. > > My first attempt does not work. Autoevent is ot invoked. > > > The autocmd system is always invoked based on the buffer na

Re: E505, File is write-protected

2006-08-21 Thread Wolfgang Schmidt
Wolfgang Schmidt wrote: when I try to write (:w) a certain buffer, I get E505 (~ "file XXX is write-protected, override with w!"). The protection seems to be set by Vim, not the OS (WinXP). So I looked for the "readonly" option value, but it's set to "noreadonly". I also checked "write", which i

Re: renaming unnamed buffer at creation

2006-08-21 Thread A.J.Mechelynck
Charles E Campbell Jr wrote: Yakov Lerner wrote: Now that my attempt to write unnamed buffer under name /tmp/N failed, I want to autoname empty buffer. My first attempt does not work. Autoevent is ot invoked. Hello! The autocmd system is always invoked based on the buffer name. Thus it appea

Re: renaming unnamed buffer at creation

2006-08-21 Thread Bob Hiestand
On 8/21/06, Jürgen Krämer <[EMAIL PROTECTED]> wrote: Hi, Yakov Lerner wrote: > > Now that my attempt to write unnamed buffer under > name /tmp/N failed, I want to autoname empty buffer. > My first attempt does not work. Autoevent is ot invoked. > > function! TempName() > let x=1 > while

Re: E505, File is write-protected

2006-08-21 Thread A.J.Mechelynck
Wolfgang Schmidt wrote: Wolfgang Schmidt wrote: when I try to write (:w) a certain buffer, I get E505 (~ "file XXX is write-protected, override with w!"). The protection seems to be set by Vim, not the OS (WinXP). So I looked for the "readonly" option value, but it's set to "noreadonly". I also

Re: E505, File is write-protected

2006-08-21 Thread A.J.Mechelynck
Wolfgang Schmidt wrote: A.J.Mechelynck wrote: Then the file might be write-protected by Windows (any program can override that if it takes extra steps for it). Try attrib filename.ext in CMD.EXE (where "filename.ext" is the name of the file). There are four possible attributes, each of w

using counter prefix in a map/command

2006-08-21 Thread Rodolfo Borges
I did the following command to open man pages inside Vim: nmap K :Man command! -bar -nargs=1 DoMan %!/usr/bin/man -P cat command! -bar -nargs=1 Man \ new \| DoMan \| %s/.^H//g \| set filetype=man \| goto 1 \| set buftype=nofile It works nice, but I want also to be able to specify the m

Re: E505, File is write-protected - Problem solved

2006-08-21 Thread Wolfgang Schmidt
I don't know. I'm sending this to the list so someone else may answer. (Please use "Reply to all" next time.) Best regards, Tony. I got rid of the problem finally now by - rebooting. I looks like another nice feature of this obscure NTFS file system. Thanx Tony and Jürgen for your proposal

Re: renaming unnamed buffer at creation

2006-08-21 Thread Yakov Lerner
On 8/21/06, Bob Hiestand <[EMAIL PROTECTED]> wrote: On 8/21/06, Jürgen Krämer <[EMAIL PROTECTED]> wrote: > > Hi, > > Yakov Lerner wrote: > > > > Now that my attempt to write unnamed buffer under > > name /tmp/N failed, I want to autoname empty buffer. > > My first attempt does not work. Autoevent

Re: using counter prefix in a map/command

2006-08-21 Thread A.J.Mechelynck
Rodolfo Borges wrote: I did the following command to open man pages inside Vim: nmap K :Man command! -bar -nargs=1 DoMan %!/usr/bin/man -P cat command! -bar -nargs=1 Man \ new \| DoMan \| %s/.^H//g \| set filetype=man \| goto 1 \| set buftype=nofile It works nice, but I want also to b

Re: renaming unnamed buffer at creation

2006-08-21 Thread A.J.Mechelynck
Yakov Lerner wrote: On 8/21/06, Bob Hiestand <[EMAIL PROTECTED]> wrote: On 8/21/06, Jürgen Krämer <[EMAIL PROTECTED]> wrote: > > Hi, > > Yakov Lerner wrote: > > > > Now that my attempt to write unnamed buffer under > > name /tmp/N failed, I want to autoname empty buffer. > > My first attempt doe

Mapping Alt_Shift on Vim windows

2006-08-21 Thread Panos Laganakos
Hello, My problem is this: I am used to pressing Alt_Shift in order to switch languages on windows, but Doing so in Vim will just change language without changing keymap. That results in me not being able to use Vim as keybindings don't work etc. I'd like to know how it'll be possible to map Al

Re: using counter prefix in a map/command

2006-08-21 Thread Yakov Lerner
On 8/21/06, Rodolfo Borges <[EMAIL PROTECTED]> wrote: I did the following command to open man pages inside Vim: nmap K :Man command! -bar -nargs=1 DoMan %!/usr/bin/man -P cat command! -bar -nargs=1 Man \ new \| DoMan \| %s/.^H//g \| set filetype=man \| goto 1 \| set buftype=nofile It

TempName() and swapfiles

2006-08-21 Thread Yakov Lerner
I'm generating short temp names like /tmp/N or ~/tmp/N where N is number. My first take on the TempName() function was: function! TempName() let x=1 while filereadable("/tmp/".x) let x = x + 1 endwhile return "/tmp/".x endfun Surprising problem came up. vim#1 choose name /tmp/

Re: saving unnamed buffer

2006-08-21 Thread Gary Johnson
On 2006-08-21, Yakov Lerner <[EMAIL PROTECTED]> wrote: > On 8/21/06, Jürgen Krämer <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > A.J.Mechelynck wrote: > > > > > > Yakov Lerner wrote: > > > > > > > > I fixed another bug, the '*' missing in the autocommand: > > > > > > > > au BufWritePre * if(expand

Re: using counter prefix in a map/command

2006-08-21 Thread A.J.Mechelynck
Rodolfo Borges wrote: On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: Since DoMan (and Man) accept only one argument, separating spaces must be escaped, which means you cannot do it with the above K mapping. Oh, really? I never thought such a thing (that is, "you cannot do something") wo

Re: Mapping Alt_Shift on Vim windows

2006-08-21 Thread A.J.Mechelynck
Panos Laganakos wrote: Hello, My problem is this: I am used to pressing Alt_Shift in order to switch languages on windows, but Doing so in Vim will just change language without changing keymap. That results in me not being able to use Vim as keybindings don't work etc. I'd like to know how it'

Re: renaming unnamed buffer at creation

2006-08-21 Thread Gary Johnson
On 2006-08-21, Yakov Lerner <[EMAIL PROTECTED]> wrote: > This is nice, but. This works for :new (I tried BufNew), > but still does not work > for that empty buffer #1 that is created when vim is invoked without > commandline arguments. > > I want it to work for the initial empty buffer, too. I

How do one open files for editing from a function?

2006-08-21 Thread Preben Randhol
Hi again I have another question... I'm trying to make a function to open files for editing from a function. however I keep getting an error. I have included a very simple functions that gives the same error message. I understand that one cannot do it this way, but I don't know how to do it:

Re: TempName() and swapfiles

2006-08-21 Thread A.J.Mechelynck
Yakov Lerner wrote: I'm generating short temp names like /tmp/N or ~/tmp/N where N is number. My first take on the TempName() function was: function! TempName() let x=1 while filereadable("/tmp/".x) let x = x + 1 endwhile return "/tmp/".x endfun Surprising problem came up. vi

Re: How do one open files for editing from a function?

2006-08-21 Thread A.J.Mechelynck
Preben Randhol wrote: Hi again I have another question... I'm trying to make a function to open files for editing from a function. however I keep getting an error. I have included a very simple functions that gives the same error message. I understand that one cannot do it this way, but I don't

Re: How do one open files for editing from a function?

2006-08-21 Thread Yakov Lerner
On 8/21/06, Preben Randhol <[EMAIL PROTECTED]> wrote: Hi again I have another question... I'm trying to make a function to open files for editing from a function. however I keep getting an error. I have included a very simple functions that gives the same error message. I understand that one ca

Re: How do one open files for editing from a function?

2006-08-21 Thread Gary Johnson
On 2006-08-21, "A.J.Mechelynck" <[EMAIL PROTECTED]> wrote: > Preben Randhol wrote: > > Hi again > > > > I have another question... > > > > I'm trying to make a function to open files for editing from a function. > > however I keep getting an error. I have included a very simple functions > > that g

Email Text Formatter Plugin

2006-08-21 Thread Tom Purl
Forgive me if this is a terribly simple question, but I searched for a while and couldn't find the solution to this problem. I'm looking for a simple function that will reformat a selected block of text for e-mail messages (80 columns long, preserving ">" characters, etc). Vim Cream can do this v

Re: Email Text Formatter Plugin

2006-08-21 Thread Pete Johns
On Mon, 2006-08-21 at 20:54:21 -0500, Tom Purl sent: >I'm looking for a simple function that will reformat a selected >block of text for e-mail messages (80 columns long, preserving >">" characters, etc). Vim Cream can do this very well, but the >functionality doesn't easily translate to vanilla V

Re: Email Text Formatter Plugin

2006-08-21 Thread Tom Purl
Thanks a ton! This works very well. On Tue, Aug 22, 2006 at 12:08:50PM +1000, Pete Johns wrote: > On Mon, 2006-08-21 at 20:54:21 -0500, Tom Purl sent: > >I'm looking for a simple function that will reformat a selected > >block of text for e-mail messages (80 columns long, preserving > >">" charac

Re: Email Text Formatter Plugin

2006-08-21 Thread cga2000
On Mon, Aug 21, 2006 at 10:08:50PM EDT, Pete Johns wrote: > On Mon, 2006-08-21 at 20:54:21 -0500, Tom Purl sent: > >I'm looking for a simple function that will reformat a selected > >block of text for e-mail messages (80 columns long, preserving > >">" characters, etc). Vim Cream can do this very

Re: Email Text Formatter Plugin

2006-08-21 Thread Pete Johns
On Mon, 2006-08-21 at 23:47:56 -0400, cga2000 sent: >Someone on the list recently suggested I use "gqip" to reflow >paragraphs and I was going to suggest that. Much to my delight, >I later found that it also preserved the ">" characters in >e-mail messages, so I was going to recommend using that.

Re: UTF-8 Problem with Localization in Windows GVIM

2006-08-21 Thread Edward L. Fox
On 8/20/06, Yongwei Wu <[EMAIL PROTECTED]> wrote: This is really an old problem. It begins with VIM 6. While it is possible to set encoding=UTF-8 on Windows to be able to process text file in multiple encodings at the same time, the localized menu/messages has problems. The simplest _vimrc one m

Re: Email Text Formatter Plugin

2006-08-21 Thread cga2000
On Mon, Aug 21, 2006 at 11:55:54PM EDT, Pete Johns wrote: > On Mon, 2006-08-21 at 23:47:56 -0400, cga2000 sent: > >Someone on the list recently suggested I use "gqip" to reflow > >paragraphs and I was going to suggest that. Much to my delight, > >I later found that it also preserved the ">" charac

% does not work with ' ( '

2006-08-21 Thread Peter Hodge
Hello, Is there any way to make % jump to the correct parenthesis and ignore a '(' inside a single-quoted string? For example: if('string(string') Pressing % while the cursor is at the end of the line will jump to the wrong '('. Is there any way to fix this? The help page on % does not ment

Re: % does not work with ' ( ' - never mind

2006-08-21 Thread Peter Hodge
Sorry, disregard last post, % wasn't working because I didn't actually have % in cpoptions yet. --- Peter Hodge <[EMAIL PROTECTED]> wrote: > Hello, > > Is there any way to make % jump to the correct parenthesis and ignore a '(' > inside a single-quoted string? For example: > > if('string(s

Re: How do one open files for editing from a function?

2006-08-21 Thread Preben Randhol
"A.J.Mechelynck" <[EMAIL PROTECTED]> wrote on 21/08/2006 (23:08) : > > The function definition must not be in a script or function which is > called from an autocommand which is triggered by opening a file for editing. Ah! Thanks! I understand. I was testing the code by just adding it to my ftpl