Re: Help needed on pt_BR spell checking

2007-02-08 Thread Bram Moolenaar

Leonardo Fontenelle wrote:

> I made a pt.utf-8.spl from myspell-pt_BR, and placed it in ~/.vim/spell/.
> When I run ":set spell spelllang=pt_BR", I get an error message:
> "Warning: region BR not supported". My locale is pt_BR, and I'm sure
> vim knows about that because ":lang" yields "pt_BR.UTF-8". Curiously,
> running ":set spell spelllang=~/.vim/spell/pt.utf-8.spl" works!

If you have a spell file without regions, use ":set spl=pt".  The
distributed spell file has both pt_PT and pt_BR.  See runtime/spell/pt/
in the distributed runtime files (before installing).

> http://ftp.vim.org/vim/runtime/spell/README_pt.txt doesn't have any
> contact information for the maintainers, and logs changes up to 2002,
> when the pt_PT and pt_BR dictionaries where based on the ispell ones.
> 
> Since then the br.ispell maintainer has disappeared, and the myspell
> dictionary developed by BrOffice.org (OOo's pt_BR community) became
> circa ten times larger than br.ispell. I released recently an updated
> aspell6-pt_BR based on BrOffice.org's dictionay, and would like
> everyone to have an updated pt_BR dictionary for vim.
> 
> Please help me:
> - Use the custom dictionay without "region not supported" errors.
> - Contact the pt.ENC.(spl|sug) maintainers.
> - Understand how to create a sug file.
> - How the better way to talk to Bram about pt dict maintainership.

I'll be very glad if someone wants to take over maintaining the spell
file for a specific language.  Look in the directory mentioned above,
you will find *.diff files.  These need to be applied to new .dic and
.aff files, as much as possible.  More info in runtime/spell/README.txt.

Generating the files is done with an Aap script.  Installing Aap should
be easy, it only requires Python.

-- 
>From "know your smileys":
 |-(Contact lenses, but has lost them

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Feature request: off_t / off64_t

2007-02-08 Thread Bram Moolenaar

Mathieu Malaterre wrote:

>   Could someone please add off_t / off64_t to the C syntax file.

I'll add off_t, I think it's a generic type.

I don't know off64_t.  Is that for Linux?

-- 
I AM THANKFUL...
...for the piles of laundry and ironing because it means I
have plenty of clothes to wear.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


omnicomplete pattern not found

2007-02-08 Thread Sandeep

Hi,
Much to my frustration I am unable to get omnicomplete working. I am 
using gvim 7.0 on windows. I have installed the omnicomplete and build 
the tags  database using the right ctags (version 5.6). Tags navigation 
works fine but  always returns pattern not found. Am I missing 
something? Will appreciate any ideas on debugging this problem.


-sandeep



RE: How do I replace text with a new line?

2007-02-08 Thread Knute Johnson
>>I've got a file with some control characters and I want to replace 
>>one of them with a new line.  I've tried:
>>:s/\%x03/\n/
>>:s/\%x03/^M^J/
>>:s/\%x03/\%x0a/
>
>In the search-for field, you can use '\n' to search for a newline and
>span more than one line.
>
>In the replace-with field, you need to use '\r' instead.  Something
>about the way 'vi' variants store lines internally, that each string is
>null-terminated and there doesn't exist an explicit newline char, so you
>need to insert a return char (the '\r') in the replace-with field to
>tell it to split the line.
>
>S
>
>   :s/^V^C/\r/ <-- ctl-V ctl-C is shorter,
>   else the "\%x03" will work fine
>
>should do what you want.
>
>Same with ^B that you aked about earlier, no?

Gene:

Thanks very much.  Yes that is what I needed.  And the text I'm 
playing with came from some serial data and has STX ETX wrapping the 
real data.  I was getting rid of the STX and trying to convert the 
ETX to end of line.

And since I'm on a windows machine, Yakov suggested ^Q instead of ^V. 
 So I think I've got it, till the next time any way.

Thanks,

-- 
Knute Johnson
Molon Labe...




Re: searching for a string that has many '/' characters

2007-02-08 Thread Bill McCarthy
On Fri 2-Feb-07 7:52pm -0600, [EMAIL PROTECTED] wrote:

> I have a string that has lots of forward slashes. I need to search it
> and delete it (e.g. unix path name).  I could use a backslash for
> everything forward slash and find it in vim. Is there a way I need not
> do that? For now, I use 'grep -n' to get the line number and then delete
> it. I don't actually type the string, I just use cut-and-paste!

Although I'm not exactly sure of what you want, here are two
solutions - one or both may help.

If you see what you want on the screen, visually mark it and
press * (after defining the following):

  " Search for visually selected text
  " Using v_# goes backwards at first, but requires N to
  " continue backwards - unlike searching with ?
  vnoremap  * :call VisualSearch('f')
  vnoremap  # :call VisualSearch('b')
  function! VisualSearch(direction)
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", "", "")
let @/ = l:pattern
let @" = l:saved_reg
if a:direction == 'f'
  normal n
else
  normal N
endif
  endfunc

If you have no idea where it may be in the file, use this
command to help you locate it.

  " Perform a literal search of what was typed
  function! LiteralSearch(string) range
 let l:pattern = escape(a:string, '\\/.*$^~[]')
 let @/ = l:pattern
 normal n
  endfunction
  command -nargs=1 LS call LiteralSearch ()

For example, to locate the literal text \\/.*$^~[] you would
type:

  :LS \\/.*$^~[]

It does the escaping for you.

What I'm not clear on is what you want to do next.  No
matter which approach above you use, you will have the
properly escaped text in the " register.  If you want to
delete all lines that contain the matched text:

  :g//d

If you want to remove the matched text:

  :%s/

-- 
Best regards,
Bill



Re: searching for a string that has many '/' characters

2007-02-08 Thread Kazuo Teramoto

On 2/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

I have a string that has lots of forward slashes. I need to search it
and delete it (e.g. unix path name).  I could use a backslash for
everything forward slash and find it in vim. Is there a way I need not
do that? For now, I use 'grep -n' to get the line number and then delete
it. I don't actually type the string, I just use cut-and-paste!



You can use any other separator like
s:/home/:/house/:gc

--
«Dans la vie, rien n'est à craindre, tout est à comprendre»
Marie Sklodowska Curie.


searching for a string that has many '/' characters

2007-02-08 Thread malahal
I have a string that has lots of forward slashes. I need to search it
and delete it (e.g. unix path name).  I could use a backslash for
everything forward slash and find it in vim. Is there a way I need not
do that? For now, I use 'grep -n' to get the line number and then delete
it. I don't actually type the string, I just use cut-and-paste!


Re: editing function argument lists

2007-02-08 Thread Marc Weber
On Thu, Feb 08, 2007 at 09:56:52PM +, Tom Whittock wrote:
> Hi Vim users.
> 
> I have a question: Given a standard function call block of text:
> 
> func(arg1, arg2, arg3);
> 
> how do people here deal with editing the argument list efficiently?
> 
> I'm looking to try to create a custom motion to allow me to move
> across and change arguments with a minimum number of keystrokes, as I
> find myself doing that a fair bit. This is what I quickly came up with
> (it's buggy - I don't deal with many cases here)
> 
> /\((\zs.\)\|\(,\zs.\)\|\()\)
> 
> which puts search marks here:
> 
> func(_arg1,_ arg2,_ arg3_);

Perhags you should have a look at EasyHtml which solves at least
deleting, inserting of attributes in another way.
It opens a new window and shows

win 1  main win
arg1  |
arg2  |   func ( ..
arg3  |

so you can add args and remove them in the view on the left ?
At least this is another way to think about it?
It would be a little bit more work to implement properly.

Marc


RE: How do I replace text with a new line?

2007-02-08 Thread Gene Kwiecinski
>I've got a file with some control characters and I want to replace 
>one of them with a new line.  I've tried:
>:s/\%x03/\n/
>:s/\%x03/^M^J/
>:s/\%x03/\%x0a/

In the search-for field, you can use '\n' to search for a newline and
span more than one line.

In the replace-with field, you need to use '\r' instead.  Something
about the way 'vi' variants store lines internally, that each string is
null-terminated and there doesn't exist an explicit newline char, so you
need to insert a return char (the '\r') in the replace-with field to
tell it to split the line.

S

:s/^V^C/\r/ <-- ctl-V ctl-C is shorter,
else the "\%x03" will work fine

should do what you want.

Same with ^B that you aked about earlier, no?


Re: vim paste buffer

2007-02-08 Thread A.J.Mechelynck

Albie Janse van Rensburg wrote:
[...]

here is my $vim --version
VIM - Vi IMproved 6.3 (2004 June 7, compiled Aug 22 2005 09:38:37)
Included patches: 1-21, 23-24, 26, 28-34, 36-37, 39-40, 42-43, 45-46, 81-82
Modified by <[EMAIL PROTECTED]>
Compiled by <[EMAIL PROTECTED]>
Huge version without GUI.  Features included (+) or not (-):

---^^^
[...]
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info 

^^
[...]

-X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save

-- -
[...]

This version of Vim has no clipboard support compiled-in. To be able to paste 
from Vim to something else, you need a Vim version capable of accessing the 
clipboard. Try invoking "gvim" at your window manager's Alt-F2 "execute" 
prompt, rather than (console) Vim at the bash prompt. If you don't have gvim 
at all, either install the "vim-x11" RPM, or (recommended) uninstall those 
outdated 6.3 versions completely and compile Vim for yourself (see 
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm ).


From gvim, you ought to be able to yank into register + and paste the data 
from there into a different application using Ctrl-V or Edit => Paste.



Here is the ":version" output of _my_ gvim. You'll immediately see the 
differences.



VIM - Vi IMproved 7.0 (2006 May 7, compiled Feb  7 2007 05:04:54)
Included patches: 1-192
Compiled by [EMAIL PROTECTED]
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
+jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm
-mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme
+netbeans_intg -osfiletype +path_extra +perl +postscript +printer +profile
+python +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent
-sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white +tcl +terminfo +termresponse +textobjects +title +toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace
+wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact
+xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
 user vimrc file: "$HOME/.vimrc"
  user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -DXTHREADS 
-D_REENTRANT -DXUSE_MTSAFE_API -I/opt/gnome/include/gtk-2.0 
-I/opt/gnome/lib/gtk-2.0/include -I/usr/X11R6/include 
-I/opt/gnome/include/atk-1.0 -I/opt/gnome/include/pango-1.0 
-I/usr/include/freetype2 -I/usr/include/freetype2/config 
-I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include   -DORBIT2=1 
-pthread -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -I/usr/include/libart-2.0 
-I/usr/include/libxml2 -I/opt/gnome/include/libgnomeui-2.0 
-I/opt/gnome/include/libgnome-2.0 -I/opt/gnome/include/libgnomecanvas-2.0 
-I/opt/gnome/include/gtk-2.0 -I/opt/gnome/include/gconf/2 
-I/opt/gnome/include/libbonoboui-2.0 -I/opt/gnome/include/glib-2.0 
-I/opt/gnome/lib/glib-2.0/include -I/opt/gnome/include/orbit-2.0 
-I/opt/gnome/include/libbonobo-2.0 -I/opt/gnome/include/gnome-vfs-2.0 
-I/opt/gnome/lib/gnome-vfs-2.0/include 
-I/opt/gnome/include/bonobo-activation-2.0 -I/opt/gnome/include/pango-1.0 
-I/usr/include/freetype2 -I/opt/gnome/lib/gtk-2.0/include -I/usr/X11R6/include 
-I/opt/gnome/include/atk-1.0 -I/usr/include/freetype2/config -O2 
-fno-strength-reduce -Wall  -I/usr/X11R6/include   -D_REENTRANT -D_GNU_SOURCE 
-DTHREADS_HAVE_PIDS -DDEBUGGING  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE  -I/usr/include/python2.4 
-pthread -I/usr/include  -D_LARGEFILE64_SOURCE=1  -I/usr/lib/ruby/1.8/i686-linux
Linking: gcc -L/opt/gnome/lib   -L/usr/X11R6/lib   -rdynamic  -Wl,-E 
-Wl,-rpath,/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE  -rdynamic 
-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE 
-L/usr/local/lib -o vim   -L/opt/gnome/lib -lgtk-x11-2.0 -lgdk-x11-2.0 
-latk-1.0 -lgdk_pixbuf-2.0 -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 
-lgobject-2.0 -lgmodule-2.0 -lglib-2.0   -L/opt/gnome/lib -L/usr/X11R6/lib 
-lgnomeui-2 -lbonoboui-2 -lxml2 -lz -lgnomecanvas-2 -lgnome-2 -lpopt 
-lart_lgpl_2 -lpangoft2-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 
-lgdk_pixbuf-2.0 -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 
-lgnomevfs-2 -lbonobo-2 -lgconf-2 -lbono

Re: How do I replace text with a new line?

2007-02-08 Thread Knute Johnson
>On 2/9/07, Knute Johnson <[EMAIL PROTECTED]> wrote:
>> I've got a file with some control characters and I want to replace
>> one of them with a new line.  I've tried:
>>
>> :s/\%x03/\n/
>> :s/\%x03/^M^J/
>> :s/\%x03/\%x0a/
>
>s/\%x03/\r/
>
>Yakov

Thank you Yakov, that is one combination that I didn't try.

-- 
Knute Johnson
Molon Labe...




Re: How do I replace text with a new line?

2007-02-08 Thread Yakov Lerner

On 2/9/07, Knute Johnson <[EMAIL PROTECTED]> wrote:

I've got a file with some control characters and I want to replace
one of them with a new line.  I've tried:

:s/\%x03/\n/
:s/\%x03/^M^J/
:s/\%x03/\%x0a/


s/\%x03/\r/

Yakov


How do I replace text with a new line?

2007-02-08 Thread Knute Johnson
I've got a file with some control characters and I want to replace 
one of them with a new line.  I've tried:

:s/\%x03/\n/
:s/\%x03/^M^J/
:s/\%x03/\%x0a/

Which  brings me to another question, you can use the \%x?? in the 
first half of the substitution but not the second.  What's up with 
that?

Thanks,

-- 
Knute Johnson
Molon Labe...




editing function argument lists

2007-02-08 Thread Tom Whittock

Hi Vim users.

I have a question: Given a standard function call block of text:

func(arg1, arg2, arg3);

how do people here deal with editing the argument list efficiently?

I'm looking to try to create a custom motion to allow me to move
across and change arguments with a minimum number of keystrokes, as I
find myself doing that a fair bit. This is what I quickly came up with
(it's buggy - I don't deal with many cases here)

/\((\zs.\)\|\(,\zs.\)\|\()\)

which puts search marks here:

func(_arg1,_ arg2,_ arg3_);

I can then use n as a motion to get around the function call (more or
less) and even do things like dnnp to swap an argument with the next
one in the list (sometimes it even finishes up with the correct
syntax!).

Before I spend too much time sorting out the search term to work in
more cases, I was wondering if anyone else had already dealt with
this, or if anyone has other ideas about how to accomplish editing a
list as a list.

Ideally I'd like to be able to mutate the yanked text to fit in with
its new placement within a list (move the comma to the start or end if
putting before or after a parenthesis) and also to create a command
which behaves like ciw for arguments... This seems to be beyond me,
though. I can't even work out how to create a custom motion.

Cheers.
Tom.


Re: non-quoting version of ?

2007-02-08 Thread A.J.Mechelynck

Marc Weber wrote:

On Thu, Feb 08, 2007 at 11:56:21AM +0100, A.J.Mechelynck wrote:

Marc Weber wrote:

Do I have missed a non quoting version of  ?

Consider this example:


function! T(...)
 for a in a:000
   echom 'arg:'.string(a)
 endfor
endfunction

-- 8< -- 8<   start test.vim  < -- 8< -- 8< -- 8< 


command! -nargs=* -buffer TestAddSeven :call T(7,)
	command! -nargs=* -buffer Test2 :exec "call 
	T(7,".join([],',').')'

TestAddSeven 4 'abc'
echo "Test 2"
Test2 3 'abc'

-- >8 -- >8   end  >8 -- >8 -- >8 -- >8 -- >8 



-- >8 -- >8   output  -- >8 -- >8 -- >8 -- >8 
	arg:7
	arg:'4'<< here you can see that all arguments get extra 
	extra quotes

arg:'''abc'''
Test 2
arg:7
arg:3
arg:'abc'
-- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< 


So is there a non quoting version of  which behaves like the
join([],', ') part?

Marc


Here are the various ways in which a user-command may pass arguments:

:command arg1 arg2 arg3 arg4 arg5
 passes
arg1 arg2 arg3 arg4 arg5
 passes
"arg1 arg2 arg3 arg4 arg5"
 passes
"arg1","arg2","arg3","arg4","arg5"



I did my mistake here:

:command 'arg1 arg2'
 will pass
 '''arg1' 'arg2'''
, not 'arg1 arg2'

So  works the way you'd expect but I have to pass the values
without quotes which don't bother vim here in no way..

Marc



In
:Command arg1 arg2
there are two arguments, and if the command expands to call Function() 
you get

call Function('arg1','arg2')
In
:Command 'arg1 arg2'
there is one argument (whose _value_ contains quotes at beginning and end, and 
a space in the middle) and the result (with the same command expansion as 
above) is

call Function('''arg1 arg2''')
which is the same as
call Function("'arg1 arg2'")
Finally, in
:Command arg1\ arg2
there is one argument with a space in the middle, and it would invoke
call Function('arg1 arg2')

You can test it (IIUC) with

command Command -bar -nargs=* call Function()
function Function(...)
let n = a:0
echomsg "Number of arguments:" n
let i=1
while i <= n
echomsg "Argument" i . ": «" . a:{i} . "»"
i = i + 1
endwhile
endfunction

Best regards,
Tony.
--
Of all the animals, the boy is the most unmanageable.
-- Plato


Re: GVim colours

2007-02-08 Thread Alexei Alexandrov
Hi A.J.Mechelynck, you wrote:

> 
> 3. replace the arguments of guibg= and guifg= by their #RRGGBB hex
> equivalents from the rxvt color palette. What these equivalents are, I
> don't know; but you can set any 32-bit color that way. If you want it to
> be usable (without dithering) on a 256-color terminal, you should use red,
> green and blue components, each of which is a multiple of 0x33 (i.e., 00
> 33 66 99 CC or FF).
> 

Also, when choosing a color, it might make sense to take a look at file 
$VIMRUNTIME/rgb.txt which contains standard color names supported by VIM and 
which can be used in your colorschemes.
Some time ago I wrote a function which makes viewing the rgb.txt file more 
useful:

---%<--%<--%<--%<--%<--%<--%<--%<--%<--%<---
function! Byte2Hex(byte)
let hex_chars = '0123456789ABCDEF'
return hex_chars[a:byte / 16] . hex_chars[a:byte % 16]
endfunction

function! RGBHighlight()
let line_idx = 1
let num_lines = line("$")

while line_idx <= num_lines
let line = getline(line_idx)
let line_idx = line_idx + 1

if line =~ '^\s*\d\+\s\+\d\+\s\+\d\+\s\+.*$'
let r = substitute(line, 
'^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+.*$', '\1', "")
let g = substitute(line, 
'^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+.*$', '\2', "")
let b = substitute(line, 
'^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+.*$', '\3', "")

let hlcolor = Byte2Hex(r) . Byte2Hex(g) . Byte2Hex(b)
let hlname = 'RGB' . hlcolor

if !hlexists(hlname)
exec "highlight " . hlname . " guifg=#" . hlcolor
exec "syntax match " . hlname . ' /^\s*' . r. '\s\+' . g . 
'\s\+' . b . '\s\+.*$/'
endif
endif
endwhile
endfunction

call RGBHighlight()
---%<--%<--%<--%<--%<--%<--%<--%<--%<--%<---

You can put it into a file, say, ~/rgb.vim and do

:e $VIMRUNTIME/rgb.txt
:source ~/rgb.vim

It will work absolutely correct only in Vim 7 since Vim 6 has support for very 
limited amount of syntax highlighting groups.

P.S. Tony, in the text above by "you" I mean the original poster, not you. :-)

-- 
Alexei Alexandrov


vim return code

2007-02-08 Thread Martin Krischik
Hello,

I often use little vim scripts using "vim -E". Now like all executable 
vim will return a result code after execution.

And it is often "false" which I don't want. Does anybody know how to 
influence the return value from "vim -E"?

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgpXEX3rVXrky.pgp
Description: PGP signature


RE: how do u visually select a search pattern?

2007-02-08 Thread Sibin P. Thomas
Yup that was useful, but I am stuck at the next step of my quest.

I visually select the search pattern using "//v//e", then yank it to
a register - say 0 ("0yy).
After that, I want to evaluate the yanked text to delete the highlighted part
if it meets a condition, as in ->
:if (!(@0=~"set_reg")) | exe "normal //" | exe "normal v" | exe "normal //e"
| exe "normal d"| endif

But here instead visually selecting and deleting the match this command gets
stuck at - exe "normal v"; i.e. it gets into the visual mode but fails to do
the next set of commands.
What should it be instead of - exe "normal //e" ?

Regards,
Sibin

-Original Message-
From: Tim Chase [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 08, 2007 10:40 PM
To: Sibin P. Thomas
Cc: Vim Mailing List
Subject: Re: how do u visually select a search pattern?

> I would like to search for the pattern "para\_.\{-}variable".
> When I am on the highlighted selections (3 pairs of lines in
> this case), I would like to yank the highlighted portion to a
> register (for evaluation etc).


Well, it's not quite what you describe, but it's like the "n/N" 
functionality for finding the *next* (or previous) match and 
highlighting it:

:nnoremap  //v//e
:nnoremap  ??ev??

It might also be handy to have some visual-mode mappings such as

:vmap  
:vmap  

So you can continue forward/backward in your searching.

Getting it to highlight the results immediatedly after searching 
is a considerably more difficult stunt.  Doable, but not without 
a number of crazy stunts and mindbendingly opaque mappings.  At 
least from my determination of matters.  YMMV ;)

HTH,

-tim






DISCLAIMER:
This message (including attachment if any) is confidential and may be 
privileged. Before opening attachments please check them for viruses and 
defects. MindTree Consulting Limited (MindTree) will not be responsible for any 
viruses or defects or any forwarded attachments emanating either from within 
MindTree or outside. If you have received this message by mistake please notify 
the sender by return  e-mail and delete this message from your system. Any 
unauthorized use or dissemination of this message in whole or in part is 
strictly prohibited.  Please note that e-mails are susceptible to change and 
MindTree shall not be liable for any improper, untimely or incomplete 
transmission.


Re: how do u visually select a search pattern?

2007-02-08 Thread Marc Weber
On Thu, Feb 08, 2007 at 09:59:52PM +0530, Sibin P. Thomas wrote:
> Hi all,
> 
> How can one visually select a pattern which is searched for?
You can use /v//e to select it (/e
means move to the end of match) than you can yank and read the "@
register. There may be better ways to do this though.

Marc


RE: how do u visually select a search pattern?

2007-02-08 Thread Sibin P. Thomas
True, this will work for the present case.
But what I exactly wanted was to visually select whatever is highlighted due
to the previous search, to be precise only one of the matches at a time.

For instance if my search string were "para\_.\{-}var" (notice that I am not
searching for an entire word), I want to visually select only the part
highlighted by the search operation.

Regards,
Sibin

-Original Message-
From: Michael Brailsford [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 08, 2007 10:10 PM
To: Sibin P. Thomas
Subject: Re: how do u visually select a search pattern?

:set hlsearch

This will highlight all matches of the previous match pattern.

For yanking, search for "para" the press v, then search for "variable", then
press wy.  That will highlight from the beginning of "para" to the end of
"variable".

-Michael

- Original Message 
From: Sibin P. Thomas <[EMAIL PROTECTED]>
To: Vim Mailing List 
Sent: Thursday, February 8, 2007 10:29:52 AM
Subject: how do u visually select a search pattern?

Hi all,

How can one visually select a pattern which is searched for?

In the following text : 
get_register_primitive 7
get_register_test_case_primitive 8

parameters 
address---> variable
-

set_register_primitive 11

parameters
set_reg---> variable
-
reg_resp_primitive 9
reg_resp_test_case_primitive 10

parameters
decode_reg---> variable
-



I would like to search for the pattern "para\_.\{-}variable". When I am on
the highlighted selections (3 pairs of lines in this case), I would like to
yank the highlighted portion to a register (for evaluation etc).


Regards,
Sibin



DISCLAIMER:
This message (including attachment if any) is confidential and may be
privileged. Before opening attachments please check them for viruses and
defects. MindTree Consulting Limited (MindTree) will not be responsible for
any viruses or defects or any forwarded attachments emanating either from
within MindTree or outside. If you have received this message by mistake
please notify the sender by return  e-mail and delete this message from your
system. Any unauthorized use or dissemination of this message in whole or in
part is strictly prohibited.  Please note that e-mails are susceptible to
change and MindTree shall not be liable for any improper, untimely or
incomplete transmission.





DISCLAIMER:
This message (including attachment if any) is confidential and may be 
privileged. Before opening attachments please check them for viruses and 
defects. MindTree Consulting Limited (MindTree) will not be responsible for any 
viruses or defects or any forwarded attachments emanating either from within 
MindTree or outside. If you have received this message by mistake please notify 
the sender by return  e-mail and delete this message from your system. Any 
unauthorized use or dissemination of this message in whole or in part is 
strictly prohibited.  Please note that e-mails are susceptible to change and 
MindTree shall not be liable for any improper, untimely or incomplete 
transmission.


Re: how do u visually select a search pattern?

2007-02-08 Thread Tim Chase

I would like to search for the pattern "para\_.\{-}variable".
When I am on the highlighted selections (3 pairs of lines in
this case), I would like to yank the highlighted portion to a
register (for evaluation etc).



Well, it's not quite what you describe, but it's like the "n/N" 
functionality for finding the *next* (or previous) match and 
highlighting it:


:nnoremap  //v//e
:nnoremap  ??ev??

It might also be handy to have some visual-mode mappings such as

:vmap  
:vmap  

So you can continue forward/backward in your searching.

Getting it to highlight the results immediatedly after searching 
is a considerably more difficult stunt.  Doable, but not without 
a number of crazy stunts and mindbendingly opaque mappings.  At 
least from my determination of matters.  YMMV ;)


HTH,

-tim






how do u visually select a search pattern?

2007-02-08 Thread Sibin P. Thomas
Hi all,

How can one visually select a pattern which is searched for?

In the following text : 
get_register_primitive 7
get_register_test_case_primitive 8

parameters 
address---> variable
-

set_register_primitive 11

parameters
set_reg---> variable
-
reg_resp_primitive 9
reg_resp_test_case_primitive 10

parameters
decode_reg---> variable
-



I would like to search for the pattern "para\_.\{-}variable". When I am on
the highlighted selections (3 pairs of lines in this case), I would like to
yank the highlighted portion to a register (for evaluation etc).


Regards,
Sibin



DISCLAIMER:
This message (including attachment if any) is confidential and may be 
privileged. Before opening attachments please check them for viruses and 
defects. MindTree Consulting Limited (MindTree) will not be responsible for any 
viruses or defects or any forwarded attachments emanating either from within 
MindTree or outside. If you have received this message by mistake please notify 
the sender by return  e-mail and delete this message from your system. Any 
unauthorized use or dissemination of this message in whole or in part is 
strictly prohibited.  Please note that e-mails are susceptible to change and 
MindTree shall not be liable for any improper, untimely or incomplete 
transmission.


Re: vim paste buffer

2007-02-08 Thread Guillaume Bog

On 08/02/07, Albie Janse van Rensburg <[EMAIL PROTECTED]> wrote:


> Hi, thank for answers. I'm not at work now so I can only try on
> Windows with putty term branched on a CentOS server
>
> paste from windows to vim is never a problem, but I can't make it from
> vim to outside.
For this to work, you will have to check with putty how to get data into
the windows clipboard.  It's not a Vim function, which is running inside
the ssh/telnet session you are using.
>
> gg"+yG doesn't seem to yank anything


My bad: it yanks something


> ggVG"+y or ggVG"*y yanks something but I don't get it with ctrl-v
>

V enters visual mode, and according to the vim help it automatically
copies into the PRIMARY buffer (x11 has 3 clipboards).  Try using gg"*yG
when you get a chance - it copies the entire text into the x11 PRIMARY
buffer, and is faster than using V, which has graphical implications.
Note again, this will probably not work when using putty for you
terminal, but then again, it might, if you get your settings right.


I double checked the many options of my putty but didn't find
anything... Anyway, I don't need that much pasting to windows apps,
and I'll check the gg"*yG on my office computer tomorrow (I'm in China
time).

Thanks again.

Guillaume


Re: vim paste buffer

2007-02-08 Thread Albie Janse van Rensburg



Hi, thank for answers. I'm not at work now so I can only try on
Windows with putty term branched on a CentOS server

paste from windows to vim is never a problem, but I can't make it from
vim to outside.
For this to work, you will have to check with putty how to get data into 
the windows clipboard.  It's not a Vim function, which is running inside 
the ssh/telnet session you are using.


gg"+yG doesn't seem to yank anything

ggVG"+y or ggVG"*y yanks something but I don't get it with ctrl-v



V enters visual mode, and according to the vim help it automatically 
copies into the PRIMARY buffer (x11 has 3 clipboards).  Try using gg"*yG 
when you get a chance - it copies the entire text into the x11 PRIMARY 
buffer, and is faster than using V, which has graphical implications.  
Note again, this will probably not work when using putty for you 
terminal, but then again, it might, if you get your settings right.


Hope you find your solution soon

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | 


Re: vim paste buffer

2007-02-08 Thread Tim Chase

:help x11-selection

in particular

:help quoteplus


Until I shifted to using *nix boxes regularly (via an actual X 
session, rather than remotely accessing via ssh), the distinction 
between these registers was lost on me.


On Win32, both the "*" register and the "+" register do the same 
thing.  Within X environments, "+" is the clipboard usually 
accessed by copy/paste, while "*" is the selection clipboard 
(usually filled by selecting stuff, and pasted with the 
middle-mouse button).


Thus, depending on what the OP wanted, and how they wanted to 
paste (with ^V or Edit|Paste  vs. clicking the middle-mouse 
button), it would change which register should be used.


I've had to rewire my hands to use the "+" register because it's 
what I usually mean on both systems, and just grew sloppy using 
"*" on my win32 boxen.


For this to work, you have to be running a version of vim that 
has "+clipboard" enabled in its options.


I haven't had great success with getting cut&paste to work over 
an SSH connection from a *nix box to Win32 but there might yet be 
some trick I haven't found.


HTH,

-tim




Re: vim paste buffer

2007-02-08 Thread Albie Janse van Rensburg

(Copied to group)

Guillaume, just use your mail client's "Reply to all" function if you 
don't have a "Reply to list" option, that way the mail will go to the 
group, and you will get more answers ;-)


Albie

On 08/02/07, Albie Janse van Rensburg <[EMAIL PROTECTED]> wrote:

gg"*yG

extra: on Windows XP, it also works to use + (a little easier to 
type), i.e.


gg"+yG


Hi, thank for answers. I'm not at work now so I can only try on
Windows with putty term branched on a CentOS server

paste from windows to vim is never a problem, but I can't make it from
vim to outside.

gg"+yG doesn't seem to yank anything

ggVG"+y or ggVG"*y yanks something but I don't get it with ctrl-v

here is my $vim --version
VIM - Vi IMproved 6.3 (2004 June 7, compiled Aug 22 2005 09:38:37)
Included patches: 1-21, 23-24, 26, 28-34, 36-37, 39-40, 42-43, 45-46, 81-82
Modified by <[EMAIL PROTECTED]>
Compiled by <[EMAIL PROTECTED]>
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset 
+cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info 
+comments

+cryptv +cscope +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval
+ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer
+fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap 
+langmap

+libcall +linebreak +lispindent +listcmds +localmap +menu +mksession
+modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm
+mouse_netterm +mouse_xterm +multi_byte +multi_lang -netbeans_intg 
-osfiletype

+path_extra +perl +postscript +printer +python +quickfix +rightleft -ruby
+scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup
-X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
 system vimrc file: "/etc/vimrc"
   user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -m32
-march=i386 -mtune=pentium4 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_REENTRANT -D_GNU_SOURCE  -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE
-I/usr/include/python2.3 -pthread
Linking: gcc   -Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE
-L/usr/local/lib -o vim   -lncurses -lselinux  -lacl -lgpm -Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE
-L/usr/local/lib
/usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/DynaLoader/DynaLoader.a
-L/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE -lperl -lutil -lc
-L/usr/lib/python2.3/config -lpython2.3 -lutil -lm -Xlinker
-export-dynamic


--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | 


Re: vim paste buffer

2007-02-08 Thread Kim Schulz



On Thu, 8 Feb 2007 21:34:12 +0800, "Guillaume Bog" <[EMAIL PROTECTED]> wrote:
> Hi everbody,
> 
> I'm new on this list. I use vim in a terminal on ubuntu everyday and
> still need some help for efficient use. If the file i'm editing is
> longer than one screen and I want to paste it somewhere else (say in a
> firefox textarea), I have to go out of vim, cat the file i'm editing,
> select it and then paste it (with middle mouse button). I now the
> visual mode, and how to highlight all (gg v G). But this operation
> doesn't fill the proper buffer.
> 
> I have searched some tips and vim.org but... Any idea?
> 
> Regards,
> Guillaume

just yank it into the "+ register. This is the same as your clipboard.


-- 
Kim Schulz



Re: vim paste buffer

2007-02-08 Thread Albie Janse van Rensburg

Albie Janse van Rensburg wrote:

Guillaume Bog wrote:

Hi everbody,

I'm new on this list. I use vim in a terminal on ubuntu everyday and
still need some help for efficient use. If the file i'm editing is
longer than one screen and I want to paste it somewhere else (say in a
firefox textarea), I have to go out of vim, cat the file i'm editing,
select it and then paste it (with middle mouse button). I now the
visual mode, and how to highlight all (gg v G). But this operation
doesn't fill the proper buffer.

I have searched some tips and vim.org but... Any idea?

Regards,
Guillaume



:help x11-selection

in particular

:help quoteplus

You will have to be in either a virtual terminal (in X) or in a gui 
vim (gvim), as far as I know.  I am currently on a windows machine, so 
I can not verify whether it will work from a "proper" tty (alt-f1 to 
f6), but you should be able to select the current file's text into the 
x11 cut buffer by typing (in normal mode):


gg"*G

...which you should be able to paste into firefox.

Hope it helps


Whoops.  I meant

gg"*yG

extra: on Windows XP, it also works to use + (a little easier to type), i.e.

gg"+yG

copies the current buffer into the windows clipboard.

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | 


Re: vim paste buffer

2007-02-08 Thread Kev

Guillaume Bog wrote:

Hi everbody,

I'm new on this list. I use vim in a terminal on ubuntu everyday and
still need some help for efficient use. If the file i'm editing is
longer than one screen and I want to paste it somewhere else (say in a
firefox textarea), I have to go out of vim, cat the file i'm editing,
select it and then paste it (with middle mouse button). I now the
visual mode, and how to highlight all (gg v G). But this operation
doesn't fill the proper buffer.

I have searched some tips and vim.org but... Any idea?

Regards,
Guillaume


Try the following after the ggVG for selecting the entire text: (*note 
it is a capital V)

"+y  (this will yank the highlighted text to the system clipboard)
to "paste" something from the system clipboard try:
"+p 

I have also added the following to my _vimrc in Windows to use these as 
user commands :Co and :Pa .

:command -range Co :norm"+y
:command Pa :norm"+p

Hope this helps,
Kevin


Re: vim paste buffer

2007-02-08 Thread Albie Janse van Rensburg

Guillaume Bog wrote:

Hi everbody,

I'm new on this list. I use vim in a terminal on ubuntu everyday and
still need some help for efficient use. If the file i'm editing is
longer than one screen and I want to paste it somewhere else (say in a
firefox textarea), I have to go out of vim, cat the file i'm editing,
select it and then paste it (with middle mouse button). I now the
visual mode, and how to highlight all (gg v G). But this operation
doesn't fill the proper buffer.

I have searched some tips and vim.org but... Any idea?

Regards,
Guillaume



:help x11-selection

in particular

:help quoteplus

You will have to be in either a virtual terminal (in X) or in a gui vim 
(gvim), as far as I know.  I am currently on a windows machine, so I can 
not verify whether it will work from a "proper" tty (alt-f1 to f6), but 
you should be able to select the current file's text into the x11 cut 
buffer by typing (in normal mode):


gg"*G

...which you should be able to paste into firefox.

Hope it helps

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | 


Re: vim paste buffer

2007-02-08 Thread Thomas Michael Engelke

2007/2/8, Guillaume Bog <[EMAIL PROTECTED]>:

Hi everbody,

I'm new on this list. I use vim in a terminal on ubuntu everyday and
still need some help for efficient use. If the file i'm editing is
longer than one screen and I want to paste it somewhere else (say in a
firefox textarea), I have to go out of vim, cat the file i'm editing,
select it and then paste it (with middle mouse button). I now the
visual mode, and how to highlight all (gg v G). But this operation
doesn't fill the proper buffer.


As I understand it, the register "*" represents the "systemwide
clipboard", whatever that means to the actual OS implementation. So
yanking to the register * should do the trick.

Thomas

--
GPG-Key: tengelke.de/thomas_michael_engelke.asc


Re: Mapping: Pick occurance of word under cursor, vim7-style

2007-02-08 Thread Thomas Michael Engelke

2007/2/8, Marc Weber <[EMAIL PROTECTED]>:

On Thu, Feb 08, 2007 at 01:30:37PM +0100, Thomas Michael Engelke wrote:
> Can anybody give me a hint on how to rewrite the mapping so I get such
> a conext menu instead of a numbered list?

Get the word under the cursor using expand('')

See completion examples (:h complete-functions) to filter and get the
list. To get the lines you can use getline using with range(0,line('$'))

HTH If you need more info post again.
 Aeh.. Perhaps its faster to get all lines and use the filter()
 function

There is also  which completes lines. But this is not exactly
what you want to do...

The "mapping" is done by assigning omnifunc or completefunc omnifunc is
often used by $VIMRUNTIME/**/complet* scripts so completefunc is the
better choice.


Hello Marc, and thank you for replying.

However, this information, however right it might be, will do me not
much good. I consider vimscript a much harder language than anything
I've encountered before (aside from brainfuck and maybe whitespace).

I do get the expand-part. In any codepiece, expand('') expands
to the word at the cursor position.

I do get the difference between the two approaches. The first one
(previous) used an included function [I. Your new approach uses a
script, possible a function and utilizes the new completion technique
via omnifunc.

However, how those parts fit together completely eludes me. I can try
to give as much information as possible and hope this makes it easy
for one of the pros to hack a line together:

The regex to search would be '\<'.expand('').'\>'
The list should appear at the cursor position

Well, I don't have anything more. Thanks.

Thomas

--
GPG-Key: tengelke.de/thomas_michael_engelke.asc


vim paste buffer

2007-02-08 Thread Guillaume Bog

Hi everbody,

I'm new on this list. I use vim in a terminal on ubuntu everyday and
still need some help for efficient use. If the file i'm editing is
longer than one screen and I want to paste it somewhere else (say in a
firefox textarea), I have to go out of vim, cat the file i'm editing,
select it and then paste it (with middle mouse button). I now the
visual mode, and how to highlight all (gg v G). But this operation
doesn't fill the proper buffer.

I have searched some tips and vim.org but... Any idea?

Regards,
Guillaume


Re: Mapping: Pick occurance of word under cursor, vim7-style

2007-02-08 Thread Marc Weber
On Thu, Feb 08, 2007 at 01:30:37PM +0100, Thomas Michael Engelke wrote:
> Can anybody give me a hint on how to rewrite the mapping so I get such
> a conext menu instead of a numbered list?

Get the word under the cursor using expand('')

See completion examples (:h complete-functions) to filter and get the
list. To get the lines you can use getline using with range(0,line('$'))

HTH If you need more info post again.
 Aeh.. Perhaps its faster to get all lines and use the filter()
 function

There is also  which completes lines. But this is not exactly
what you want to do...

The "mapping" is done by assigning omnifunc or completefunc omnifunc is
often used by $VIMRUNTIME/**/complet* scripts so completefunc is the
better choice.

Marc


Re: Vim presentation in Mountain View

2007-02-08 Thread Thomas Michael Engelke

2007/2/6, Vigil <[EMAIL PROTECTED]>:

Hopefully this will be available on google videos.


Yes, as a german it's an awfully long way just to meet Bram once. I
hope to see this lecture pop up as a Torrent or or Goggle Video.


Mapping: Pick occurance of word under cursor, vim7-style

2007-02-08 Thread Thomas Michael Engelke

Hello!

I am using the following mapping:

map  [I:let nr = input("Match: ")exe "normal " . nr ."[\t"

This displays a list of all lines with occurances of the word under
the cursor on it, assigns an incremental number to it and lets me pick
one to jump to. This works fine.

But I know that vim7 (or possible an earlier version, too?) can do
those context menus that pup up in the editing area rather than at the
command line below.

Can anybody give me a hint on how to rewrite the mapping so I get such
a conext menu instead of a numbered list?

Thank you,

Thomas

--
GPG-Key: tengelke.de/thomas_michael_engelke.asc


Re: Feature request: off_t / off64_t

2007-02-08 Thread Yakov Lerner

On 2/7/07, Mathieu Malaterre <[EMAIL PROTECTED]> wrote:

Hello,

  Could someone please add off_t / off64_t to the C syntax file.


You can do it yourself. Add this line
syn keyword cTypeoff64_t  off_t
to the file
   ~/.vim/after/syntax/c.vim
And 'mkdir -p ~/.vim/after/syntax' if necessary.

Yakov


Re: non-quoting version of ?

2007-02-08 Thread Marc Weber
On Thu, Feb 08, 2007 at 11:56:21AM +0100, A.J.Mechelynck wrote:
> Marc Weber wrote:
> >Do I have missed a non quoting version of  ?
> >
> >Consider this example:
> >
> >
> >function! T(...)
> >  for a in a:000
> >echom 'arg:'.string(a)
> >  endfor
> >endfunction
> >
> >-- 8< -- 8<   start test.vim  < -- 8< -- 8< -- 8< 
> >
> > command! -nargs=* -buffer TestAddSeven :call T(7,)
> > command! -nargs=* -buffer Test2 :exec "call 
> > T(7,".join([],',').')'
> > TestAddSeven 4 'abc'
> > echo "Test 2"
> > Test2 3 'abc'
> >
> >-- >8 -- >8   end  >8 -- >8 -- >8 -- >8 -- >8 
> >
> >
> >-- >8 -- >8   output  -- >8 -- >8 -- >8 -- >8 
> > arg:7
> > arg:'4'<< here you can see that all arguments get extra 
> > extra quotes
> > arg:'''abc'''
> > Test 2
> > arg:7
> > arg:3
> > arg:'abc'
> >-- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< 
> >
> >So is there a non quoting version of  which behaves like the
> >join([],', ') part?
> >
> >Marc
> >
> 
> Here are the various ways in which a user-command may pass arguments:
> 
>   :command arg1 arg2 arg3 arg4 arg5
>passes
>   arg1 arg2 arg3 arg4 arg5
>passes
>   "arg1 arg2 arg3 arg4 arg5"
>passes
>   "arg1","arg2","arg3","arg4","arg5"
> 

I did my mistake here:

:command 'arg1 arg2'
 will pass
 '''arg1' 'arg2'''
, not 'arg1 arg2'

So  works the way you'd expect but I have to pass the values
without quotes which don't bother vim here in no way..

Marc


Re: do not match the longest pattern

2007-02-08 Thread Matthew Winn
On Thu, 08 Feb 2007 13:50:51 +0800, Bin Chen <[EMAIL PROTECTED]>
wrote:

> In the help page:
> If a "-" appears immediately after the "{", then a shortest match
> first algorithm is used (see example below).  In particular, 
> "\{-}" is
> the same as "*" but uses the shortest match first algorithm.  BUT: A
> match that starts earlier is preferred over a shorter match: 
> "a\{-}b"
> matches "aaab" in "xaaab".
> 
> What's the meaning of the BUT clause? If the \{-} function as above, the 
> a\{-}b should match "ab" not "aaab".

Regular expression matchers work by starting at the beginning of the
string to be matched and seeing if it is possible to match the pattern
against the string at that point. If no match is possible then the
first character of the string is discarded and a match against the
pattern is attempted starting at the second character, then the third,
and so on.

But this continues only as long as no match is found. As soon as a
match is found the search ends and that match is returned, which means
that the match is always as far to the left as possible. If you are
interested in any other matches then you have to do the programming
yourself: for example, if you want the shortest match no matter where
it appears in the string then you'd have to save all possible matches
and look for the shortest one afterwards.

-- 
Matthew Winn


Re: non-quoting version of ?

2007-02-08 Thread A.J.Mechelynck

Marc Weber wrote:

Do I have missed a non quoting version of  ?

Consider this example:


function! T(...)
  for a in a:000
echom 'arg:'.string(a)
  endfor
endfunction

-- 8< -- 8<   start test.vim  < -- 8< -- 8< -- 8< 


command! -nargs=* -buffer TestAddSeven :call T(7,)
command! -nargs=* -buffer Test2 :exec "call 
T(7,".join([],',').')'
TestAddSeven 4 'abc'
echo "Test 2"
Test2 3 'abc'

-- >8 -- >8   end  >8 -- >8 -- >8 -- >8 -- >8 



-- >8 -- >8   output  -- >8 -- >8 -- >8 -- >8 
	arg:7

arg:'4'<< here you can see that all arguments get extra extra 
quotes
arg:'''abc'''
Test 2
arg:7
arg:3
arg:'abc'
-- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< 


So is there a non quoting version of  which behaves like the
join([],', ') part?

Marc



Here are the various ways in which a user-command may pass arguments:

:command arg1 arg2 arg3 arg4 arg5
 passes
arg1 arg2 arg3 arg4 arg5
 passes
"arg1 arg2 arg3 arg4 arg5"
 passes
"arg1","arg2","arg3","arg4","arg5"

The fact that the arguments are quoted is usually no problem: if you try to 
use a String where a Number is expected, Vim will use the longest numeric part 
at the start of the string, or 0 if there is nothing at the start that looks 
like a Number. Using a Number where a String is expected will simply use the 
decimal representation of the Number. If you still have problems with quoting, 
you may construct a wrapper function to convert the arguments: if a quoted 
argument has in fact a numeric value, then


let num1 = a:param1 + 0

will extract that value as a Numeric variable. You can check that the argument 
is numeric by doing the conversion back and forth:


if a:param1 == (a:param1 + 0) . ""
" the value is numeric (and decimal)
else
" the value is not strictly numeric
endif

The above is not perfect, however: for instance, "0xfc" + 0 gives 252; then 
252 . "" gives "252" which is not equal to "0xfc".


Best regards,
Tony.
--
According to the obituary notices, a mean and unimportant person never
dies.


Re: gvim and Unicode

2007-02-08 Thread A.J.Mechelynck

Guido Milanese wrote:
I have an additional question concerning this topic, that has been discussed 
several times.


I am happily using (g)vim with files containing several languages, basically 
as editor for LaTeX, and it's all right with Unicode. I am working in Linux 
Mandriva 2007, with (g)vim 7.0.30.
I still have a minor problem. My default encoding is Unicode-utf8: the .vimrc 
file says "set encoding=utf8". The automatic conversion from latin1 to utf8 
is perfect. However, sometimes, for reasons of compatibility with other 
programs that still cannot read Unicode files  (e.g. LyX) I must leave 
the "latin1" encoding of some files unchanged. What I do is:


1. open gvim
2: set encoding=latin1
3: e: filename.txt
4. work and save the file, that this way remains in its original encoding.

OR

:e ++enc=latin1 filename.txt

Question:
Is there any difference among the two systems?
Is the original encoding affected in some way by one of the two approaches?

Thanks!
gm


Guido Milanese
http://www.arsantiqua.org



The difference is as follows:

With your method #1, gvim represents all the data of all files internally 
using the Latin1 encoding. There is no conversion, but if you have files in 
other windows, or in hidden buffers, which are not in Latin1, it's anyone's 
guess what might happen to them.


With your method #2, gvim keeps UTF-8 for the internal representation of data. 
Conversion happens on reading and writing; that conversion is lossless and 
doesn't require an external utility such as iconv, because Vim "knows" that 
the codepoints U+ to U+00FF of Unicode correspond one-to-one and 
respectively to the characters 0x00 to 0xFF of Latin1. There may be a slight 
"swelling" of the data in memory, depending on the proportion of accented and 
other upper-ascii characters in your file, since codepoints U+0080 to U+00FF 
occupy two bytes each in memory (while U+ to U+007F are one byte each). 
Normally you can afford that swelling. All in all, I would regard this method 
as "safer" because any other files (in other windows or in hidden buffers) 
won't suffer: this method sets the 'fileencoding' of this particular file to 
Latin1 (as with ":setlocal fenc=latin1"), but other buffers (if any) are not 
affected.



Best regards,
Tony.
--
Hummingbirds never remember the words to songs.


non-quoting version of ?

2007-02-08 Thread Marc Weber
Do I have missed a non quoting version of  ?

Consider this example:


function! T(...)
  for a in a:000
echom 'arg:'.string(a)
  endfor
endfunction

-- 8< -- 8<   start test.vim  < -- 8< -- 8< -- 8< 

command! -nargs=* -buffer TestAddSeven :call T(7,)
command! -nargs=* -buffer Test2 :exec "call 
T(7,".join([],',').')'
TestAddSeven 4 'abc'
echo "Test 2"
Test2 3 'abc'

-- >8 -- >8   end  >8 -- >8 -- >8 -- >8 -- >8 


-- >8 -- >8   output  -- >8 -- >8 -- >8 -- >8 
arg:7
arg:'4'<< here you can see that all arguments get extra extra 
quotes
arg:'''abc'''
Test 2
arg:7
arg:3
arg:'abc'
-- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< 

So is there a non quoting version of  which behaves like the
join([],', ') part?

Marc


Re: gvim and Unicode

2007-02-08 Thread Guido Milanese
I have an additional question concerning this topic, that has been discussed 
several times.

I am happily using (g)vim with files containing several languages, basically 
as editor for LaTeX, and it's all right with Unicode. I am working in Linux 
Mandriva 2007, with (g)vim 7.0.30.
I still have a minor problem. My default encoding is Unicode-utf8: the .vimrc 
file says "set encoding=utf8". The automatic conversion from latin1 to utf8 
is perfect. However, sometimes, for reasons of compatibility with other 
programs that still cannot read Unicode files  (e.g. LyX) I must leave 
the "latin1" encoding of some files unchanged. What I do is:

1. open gvim
2: set encoding=latin1
3: e: filename.txt
4. work and save the file, that this way remains in its original encoding.

OR

:e ++enc=latin1 filename.txt

Question:
Is there any difference among the two systems?
Is the original encoding affected in some way by one of the two approaches?

Thanks!
gm


Guido Milanese
http://www.arsantiqua.org


Re: Workspace concept ala TextPad

2007-02-08 Thread A.J.Mechelynck

Jürgen Krämer wrote:

Hi,

A.J.Mechelynck wrote:

Eric Leenman wrote:

I read on the script that I need to follow the 6 points mentioned.

[...]

What I did:
Download the zip file:
And stored
workspace.txt is stored in C:\Program Files\Vim\vimfiles\doc

   

workspace.vim C:\Program Files\Vim\vimfiles\plugin

  

Is this OK?
No. These directories are only for what comes bundled with Vim. You should not 
change anything there, because any upgrade (maybe tomorrow, maybe next year) 
may silently undo whatever changes you had made.


sorry to correct you, Tony, but I think you missed the "vimfiles" part of
those paths. C:\Program Files\Vim\vimfiles is used for system-wide
configuration files, not for files bundled with Vim.

[...]

Oops. Right. It's C:\Program Files\vim\vim70 (and its contents) that you 
shouldn't touch.


Best regards,
Tony.
--
Confession is good for the soul only in the sense that a tweed coat is
good for dandruff.
-- Peter de Vries