Re: Importing values from vim to python in vim9

2023-12-06 Thread rameo
You are right. The variable names in the above example should be without 
quotes MyFunction(variable1, variable2) . 
In my functions, they are without quotes.

On Wednesday, December 6, 2023 at 1:14:04 AM UTC+1 Salman Halim wrote:

> I might be nitpicking, but why are the function parameters in the function 
> definition in quotes?
>
> Salman
>
> On Tue, Dec 5, 2023, 17:14 Christian Brabandt  wrote:
>
>>
>> On Di, 05 Dez 2023, rameo wrote:
>>
>> > I installed vim 9 but still have multiple functions written in old 
>> vimscript.
>> > 
>> > I've read that functions written in old vimscript still work.
>> > 
>> > However I noticed that importing variables into Python 
>> `vim.eval("a:myvariable")` no longer works
>> > 
>> > I don't always get the right values imported.
>> > 
>> > Example :
>> > 
>> > :call MyFunction("12", "14") 
>> > 
>> > function! MyFunction("variable1, variable2") 
>> > python3 << endpython 
>> > variable1 = vim.eval("a:variable1") 
>> > variable2 = vim.eval("a:variable2") 
>> > print(variable1 + " " + variable2) 
>> > endpython 
>> > 
>> > endfunction
>> > 
>> > What's wrong in above code?
>> > 
>> > Or better... why doesn't it work anymore in vim9?
>>
>> Do you get an error message? Which one? If this doesn't work anymore, 
>> when did it stop working?
>>
>> Thanks,
>> Christian
>> -- 
>> Driver does not carry cash.
>>
>> -- 
>> -- 
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "vim_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to vim_use+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/vim_use/ZW%2Bgsu3Q23sAczgm%40256bit.org
>> .
>>
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/e4c19d3a-eb3e-472b-9360-cdd4440c02f5n%40googlegroups.com.


Re: Importing values from vim to python in vim9

2023-12-05 Thread rameo
No message. 
I noticed that the values are no longer correct. I am using the same 
function more and the values are not refreshed. Old values are kept. 
I can't remember exactly when it stopped working. I noticed it today.

I just tested with this: 
variable1 = str(vim.bindeval("a:variable1"))
variable2 = str(vim.bindeval("a:variable2"))

This works.

But now it's binary isn't it (b'value')? How do I get it as text again?
Isn't there a better solution?

Thanks,
Rameo

On Tuesday, December 5, 2023 at 11:14:21 PM UTC+1 Christian Brabandt wrote:

>
> On Di, 05 Dez 2023, rameo wrote:
>
> > I installed vim 9 but still have multiple functions written in old 
> vimscript.
> > 
> > I've read that functions written in old vimscript still work.
> > 
> > However I noticed that importing variables into Python 
> `vim.eval("a:myvariable")` no longer works
> > 
> > I don't always get the right values imported.
> > 
> > Example :
> > 
> > :call MyFunction("12", "14") 
> > 
> > function! MyFunction("variable1, variable2") 
> > python3 << endpython 
> > variable1 = vim.eval("a:variable1") 
> > variable2 = vim.eval("a:variable2") 
> > print(variable1 + " " + variable2) 
> > endpython 
> > 
> > endfunction
> > 
> > What's wrong in above code?
> > 
> > Or better... why doesn't it work anymore in vim9?
>
> Do you get an error message? Which one? If this doesn't work anymore, 
> when did it stop working?
>
> Thanks,
> Christian
> -- 
> Driver does not carry cash.
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/c7057a99-f171-459a-a834-58f7ac397e1bn%40googlegroups.com.


Importing values from vim to python in vim9

2023-12-05 Thread rameo
 

I installed vim 9 but still have multiple functions written in old 
vimscript.

I've read that functions written in old vimscript still work.

However I noticed that importing variables into Python 
`vim.eval("a:myvariable")` no longer works

I don't always get the right values imported.

Example :
:call MyFunction("12", "14") 

function! MyFunction("variable1, variable2") 
python3 << endpython 
variable1 = vim.eval("a:variable1") 
variable2 = vim.eval("a:variable2") 
print(variable1 + " " + variable2) 
endpython 

endfunction 

What's wrong in above code?

Or better... why doesn't it work anymore in vim9?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/cce40585-46a4-4967-8f09-2aaf8398d117n%40googlegroups.com.


Re: Command Line Bookmark manager

2021-07-19 Thread rameo
Thank you, even though it looks really good, it's much more than I wanted. 
I was looking for something in vim itself and only focused on saving vim 
search/exec commands (like a bookmark manager).

On Saturday, July 17, 2021 at 5:37:56 PM UTC+2 stevelitt wrote:

> rameo said on Fri, 16 Jul 2021 02:37:44 -0700 (PDT)
>
> >Hi,
> >
> >Is there a possibility in Vim or a script that allows us to Bookmark
> >or Pin Command Line commands?
>
> You might like UMENU2: http://www.troubleshooters.com/projects/umenu2/
>
> SteveT
>
> Steve Litt 
> Spring 2021 featured book: Troubleshooting Techniques of the Successful
> Technologist http://www.troubleshooters.com/techniques
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/08833cfe-7292-475c-bb23-b74c56f6ccb4n%40googlegroups.com.


Re: Command Line Bookmark manager

2021-07-16 Thread rameo
 Hi, 

Vim command line commands 

On Friday, July 16, 2021 at 4:37:21 PM UTC+2 rwmit...@gmail.com wrote:

> On Friday, July 16, 2021 at 5:37:44 AM UTC-4 rameo wrote:
>
>> Hi,
>>
>> Is there a possibility in Vim or a script that allows us to Bookmark or 
>> Pin Command Line commands?
>>
>> I know there is such a thing for files and directories (eg FavMenu) but 
>> is there something similar for search and execute commands? 
>>
>> Thanks in advance.
>>
>
> Just to be clear, are you referring to Vim command line commands (:) or 
> terminal/shell command line? 
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/28215902-8965-46e7-929f-8c9c1dd95772n%40googlegroups.com.


Command Line Bookmark manager

2021-07-16 Thread rameo
Hi,

Is there a possibility in Vim or a script that allows us to Bookmark or Pin 
Command Line commands?

I know there is such a thing for files and directories (eg FavMenu) but is 
there something similar for search and execute commands? 

Thanks in advance.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/fe8df999-a98d-4d39-bcde-611df7f802b4n%40googlegroups.com.


Re: Vim9 - Python/Lua interface

2020-05-13 Thread rameo
Thank you for your comment.
That is good news.
Glad to hear.

I read about the new features in vim9 here:
https://www.reddit.com/r/vim/comments/ey91bd/i_have_mixed_feelings_for_vim9_script_what_do_you/

and here:
https://github.com/brammool/vim9
(2. Phasing out Interfaces)

Would be great to use python regex in the command line. 
Hopefully it'll work out. I'm also thinking of a way to leave python 
functions just like in vimscript (return).

On Wednesday, May 13, 2020 at 12:54:19 PM UTC+2, rameo wrote:
>
> I first came into contact with Vim about 15 years ago.
> A few times I uninstalled it and reinstalled it a while later. After a few 
> months I was convinced it was the best text editor I had ever seen.
> I only noticed how much value it had when I wrote scripts in vimrc myself 
> and changed plugins/menu.
> Still, I had to get used to Vimscript. A whole new language, not something 
> similar I already knew.
> However, I got completely excited when I understood that I could write 
> scripts in Lua and Python.
> Why? Because it was not easy to get used to Vimscript and the help I asked 
> on internet sites was rarely answered.
> Anyway, I did benefit from the vim_use group but I noticed that I found 
> solutions faster writing in Python. 
> I knew the language better and there was a huge amount of information 
> online.
>
> Now I recently read on Reddit that there would be some changes in Vim9 and 
> not everyone thought it was a good idea.
> Vimscript is going to change in Vim9 to make Vim respond faster. That's a 
> good idea, although Vim is fast enough for me. The fastest editor I've ever 
> seen.
> Reading further I read that Vim9 will be without its Python/Lua interface.
> That is really a pity. 
> Instead of removing the Python and Lua interface, why not integrate them 
> even more?
> It would be great if we could search in Vim with python regex.
> Even if we could program the user input in python code.
> People often already know Python and Lua. I think it will bring a much 
> larger amount of users to Vim.
>
> Is it true that the Python and Lua interface will disappear?
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/714c7efa-bc1b-4b4d-b010-c742f4cb40e6%40googlegroups.com.


Vim9 - Python/Lua interface

2020-05-13 Thread rameo
I first came into contact with Vim about 15 years ago.
A few times I uninstalled it and reinstalled it a while later. After a few 
months I was convinced it was the best text editor I had ever seen.
I only noticed how much value it had when I wrote scripts in vimrc myself 
and changed plugins/menu.
Still, I had to get used to Vimscript. A whole new language, not something 
similar I already knew.
However, I got completely excited when I understood that I could write 
scripts in Lua and Python.
Why? Because it was not easy to get used to Vimscript and the help I asked 
on internet sites was rarely answered.
Anyway, I did benefit from the vim_use group but I noticed that I found 
solutions faster writing in Python. 
I knew the language better and there was a huge amount of information 
online.

Now I recently read on Reddit that there would be some changes in Vim9 and 
not everyone thought it was a good idea.
Vimscript is going to change in Vim9 to make Vim respond faster. That's a 
good idea, although Vim is fast enough for me. The fastest editor I've ever 
seen.
Reading further I read that Vim9 will be without its Python/Lua interface.
That is really a pity. 
Instead of removing the Python and Lua interface, why not integrate them 
even more?
It would be great if we could search in Vim with python regex.
Even if we could program the user input in python code.
People often already know Python and Lua. I think it will bring a much 
larger amount of users to Vim.

Is it true that the Python and Lua interface will disappear?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/a7593c48-e393-4f55-820e-83036c37b7fb%40googlegroups.com.


Vim external command output encoding

2019-02-15 Thread rameo
I am trying to get the output from Everything Search in Vim using Everything 
commandline (es.exe)

This works great in cmd shell but when I do the same in gvim I do not see any 
accents.

E.g.
:r !es *.doc
returns all doc files, but all accents (éèòì etc) are not shown.

No problem if I use this in cmd.exe:
es *.doc

These are my settings in gvim:
 if has('multi_byte')
   set encoding=utf-8
   setglobal fenc=utf-8
   set fileencodings=ucs-bom,utf-8,cp1252,latin1
 endif

I tried to change the encoding of the "everything search" output in gvim:
:e ++enc=utf8
:set bomb
:e ++enc=latin1
:e ++enc=Windows-1252
:e ++enc=ISO-8859-1

No change. I don't see accents.

Current encoding:
:set encoding?
encoding=utf-8
:set termencoding?
termencoding=
:set shell?
shell=c:\windows\system32\cmd.exe
:set shellcmdflag?
shellcmdflag=/c
:set shellpipe?
shellpipe=>%s 2>&1
:set shellredir?
shellredir=>%s 2>&1
:set shellxquote?
set shellxquote=(
:set shellquote?
set shellquote=

What's happening?

ps: it does work when I change shell to powershell but I don't want to use 
powershell because it messes up all my other external commands using cmd.exe.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: python 3

2017-11-24 Thread rameo
On Wednesday, November 22, 2017 at 11:31:10 PM UTC+1, Ni Va wrote:
> Hi,
> 
> Just try from vim.8.0.1330 to execute :py3 import sys (with python v3.7.0a2) 
> fails and exit vim.
> 
> 
> May I miss some things to do?
> Thank you

You're using Python 3.7.
Vim is made for Python 3.5.
You need to install Python 3.5 (32 bits or 64 bits (the same as your Vim 
version))

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Vim as external editor for thunderbird

2017-02-06 Thread rameo
Guido,

I use http://www.listary.com/text-editor-anywhere

Saluti da una ventosa Francia. :)

~R.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


idx-edx: Different Character count in Vim and Python

2017-01-25 Thread rameo
Example:

s="I like crème caramel but not only caramel I also like crème fraîche."

Searching the idx-edx numbers of the matches of the word "crème":
echo matchstrpos(s, "crème") --> 7,13
echo matchstrpos(s, "crème",14)  --> 55,61

I do have a python function in which I transform the above string using slices.
But the problem is that in python accented letters are counted as 1
and in Vim as 2, my slicing goes wrong.

How can I resolve this problem?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


python search regex

2016-11-23 Thread rameo
A time ago, I asked if it possible to add python regex to vim.
No one answered that question.

VIM is a great editor and the use of Vimscript makes it even better.
Then I started to learn Python and noted that Bram has integrated Python in 
Vim. 
I transformed many scripts from Vimscript to Python.
I noted that the things you want to do in vimscript, you can do the same thing 
in Python with 30/40% less lines.

There is much more info on line about python and much more people who can help 
you to resolve a problem.
Many things that you can do easier in Python.
Number manipulations, range with float step (using Numpy) etc.
And what about list manipulations? It is so easy in Python. 
Putting all your buffer lines in a python list and you can do magic with your 
text in the buffer.

But what I miss and why I have to mix my functions with vimscript, is the 
python regex to search things in the buffer.
If I want to catch certain things in the text I have to search it using 
vimscript. It would be much easier if I could use also the python regex.

Would this be possible in a future vim release?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


visual mode detection

2016-08-21 Thread rameo
I'm using the latest Nightly Vim Windows build v7.4.2232

I noted that the last builds don't detect visual mode.

in my menu.vim

nnoreme 93.02.12 \  :call VerticalSort("%")
vnoreme 93.02.12 \  :call VerticalSort("''<,''>")

When I don't select anything the first line must be the current one:
"%" must be send to VerticalSort.
However "''<,''>" is sent to VerticalSort.

I had no problems with the official 7.4 vim version.

Did something change in the builds?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Python Regex in a Vim Search

2016-05-11 Thread rameo
I would like to ask whether it is possible to add python regex to the VIM 
search in a future VIM release?

p.e. 
We could use a `P` or something like that in a vim search to indicate that it 
concerns a Python regex p.e. `/P'pythonregex'`

If we have this we can use the same regex in the other python code if not we 
have to switch from Vim code to python code. A wonderful thing in VIM is that 
it accepts other languages as Ruby and Python. Both have more features so that 
we can achieve things faster and easier. It's also easier to find online help. 
There are more users programming in these languages then Vimscript

Slickedit has a similar function:
https://www.slickedit.com/products/slickedit/cool-features
(please see 'Regex Evaluator' at the bottom of this document)

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Capture columns nummers of matches ending with double byte chars

2016-04-26 Thread rameo
Op dinsdag 26 april 2016 09:14:52 UTC+2 schreef rameo:
> Op dinsdag 26 april 2016 08:14:33 UTC+2 schreef Christian Brabandt:
> > Hi rameo!
> > 
> > On Mo, 25 Apr 2016, rameo wrote:
> > 
> > > 
> > > > 
> > > > It is much better to download sources from https://github.com/vim/vim.
> > > > 
> > > 
> > > Found it:
> > > https://github.com/vim/vim-win32-installer/releases
> > > 
> > > However...
> > > Tried:
> > > gvim_7.4.1782_x86.exe
> > > gvim_7.4.1786_x86.exe
> > > 
> > > Both gives an error: 
> > > Error detected while processing vimrc_example.vim
> > > line 114:
> > > E919: Directory not found in 'packpath': "pack/*/opt/matchit"
> > 
> > Yes, your $VIMRUNTIME does not include the pack directory.
> > So, you need to install a new runtime. Check the zip file, it includes 
> > an updated runtime directory.
> > 
> > 
> > Best,
> > Christian
> > -- 
> > Falsche Vorstellung, dass man ein Phänomen durch Kalkül oder 
> > durch Worte abtun und beseitigen könne.
> > -- Goethe, Maximen und Reflektionen, Nr. 1004
> 
> I just commented out 'packadd matchit', now it works.
> 
> Thank you very much Christian for these new features.
> 
> Does matchstrpos not capture all matches on line?
> 
>for n in range(0, len(LinewithMatches)-1)
>  let s = getline(LinewithMatches[n])
>  let r= matchstrpos(s, @/)
>  echo s
>  echo r
>endfor
> 
> It only returns the first match on the 1st line.
> Did I do something wrong?

Found it, I had to add a startposition and adapt the counter in a while loop.

just an idea: add all matches found in entire string to a list
[['match1',2,7]['match2',12,17]..etc]

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Capture columns nummers of matches ending with double byte chars

2016-04-26 Thread rameo
Op dinsdag 26 april 2016 08:14:33 UTC+2 schreef Christian Brabandt:
> Hi rameo!
> 
> On Mo, 25 Apr 2016, rameo wrote:
> 
> > 
> > > 
> > > It is much better to download sources from https://github.com/vim/vim.
> > > 
> > 
> > Found it:
> > https://github.com/vim/vim-win32-installer/releases
> > 
> > However...
> > Tried:
> > gvim_7.4.1782_x86.exe
> > gvim_7.4.1786_x86.exe
> > 
> > Both gives an error: 
> > Error detected while processing vimrc_example.vim
> > line 114:
> > E919: Directory not found in 'packpath': "pack/*/opt/matchit"
> 
> Yes, your $VIMRUNTIME does not include the pack directory.
> So, you need to install a new runtime. Check the zip file, it includes 
> an updated runtime directory.
> 
> 
> Best,
> Christian
> -- 
> Falsche Vorstellung, dass man ein Phänomen durch Kalkül oder 
> durch Worte abtun und beseitigen könne.
>   -- Goethe, Maximen und Reflektionen, Nr. 1004

I just commented out 'packadd matchit', now it works.

Thank you very much Christian for these new features.

Does matchstrpos not capture all matches on line?

   for n in range(0, len(LinewithMatches)-1)
 let s = getline(LinewithMatches[n])
 let r= matchstrpos(s, @/)
 echo s
 echo r
   endfor

It only returns the first match on the 1st line.
Did I do something wrong?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Capture columns nummers of matches ending with double byte chars

2016-04-26 Thread rameo

> 
> It is much better to download sources from https://github.com/vim/vim.
> 

Found it:
https://github.com/vim/vim-win32-installer/releases

However...
Tried:
gvim_7.4.1782_x86.exe
gvim_7.4.1786_x86.exe

Both gives an error: 
Error detected while processing vimrc_example.vim
line 114:
E919: Directory not found in 'packpath': "pack/*/opt/matchit"

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Capture columns nummers of matches ending with double byte chars

2016-04-25 Thread rameo
Op maandag 25 april 2016 22:26:27 UTC+2 schreef Ken Takata:
> Hi rameo,
> 
> 2016/4/23 Sat 21:37:15 UTC+9 rameo wrote:
> > Searchpos() doesn't return the right end value of a match if the match end 
> > with a double byte character (èéòìùá...). (encoding utf-8)
> > Isn't this a bug
> 
> You might misunderstand the spec of searchpos().
> When the 'e' flag is specified, the cursor moves to the last character of
> the match and searchpos() returns the position of the cursor.  It means
> that the returned value is a byte index of start of the last character,
> not the end of the character.
> 

Hello Ken,

thank you for your reply :)

Just a question, why does someone need the byte index of the start of the last 
character and not simply the end of the last character?

> 
> > The last few years I used match/matchend then I noted that it did not 
> > capture correctly double byte characters within the string.
> 
> Can you show an example?
> match()/matchend() return a byte offset, not a character count.
> 
> FYI, matchstrpos() can be used to get both start and end position
> after 7.4.1685.
> 
> 
> Regards,
> Ken Takata

That's great news.
I waited long for such a feature.

Can you please send me the url of the site where the patches can be downloaded?
I can't find it anymore.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Capture columns nummers of matches ending with double byte chars

2016-04-23 Thread rameo
Searchpos() doesn't return the right end value of a match if the match end with 
a double byte character (èéòìùá...). (encoding utf-8)
Isn't this a bug

Would it be possible to add a feature in Vim like finditer in Python?
Searchpos() searches the entire file till stopline.
finditer returns all startvalues, endvalues and matches of a search in a string 
(or line).
This would be great!

>From Python website:
re.finditer(pattern, string[, flags])

Return an iterator yielding MatchObject instances over all non-overlapping 
matches for the RE pattern in string. The string is scanned left-to-right, and 
matches are returned in the order found. Empty matches are included in the 
result unless they touch the beginning of another match.

>>> text = "He was carefully disguised but captured quickly by police."
>>> for m in re.finditer(r"\w+ly", text):
... print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))
07-16: carefully
40-47: quickly

https://docs.python.org/3/library/re.html

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Capture columns nummers of matches ending with double byte chars

2016-04-21 Thread rameo
Since I use Vim I have troubles with double byte characters.

I want to capture all strings of matches together with startcolumn and 
endcolumn of a match (line by line). I don't need only the strings but also the 
columnnumbers for other functions.

The last few years I used match/matchend then I noted that it did not capture 
correctly double byte characters within the string.
Then I adapted everything to use searchpos() but today I found out that it 
gives troubles with string with a double byte character at the end. 


   "mylist = list with all linenrs having matches
   for n in range(0, len(mylist)-1)
 let idx  = []
 let edx  = []
 let matches_between_cols = []

 "FIND ALL IDX MATCHES 
 "idx --> forward search
 call cursor(mylist[n],1)
 while line(".") == mylist[n]
   let S= searchpos(@/, '')
   if S[0] == mylist[n]
 call add(idx, S[1]-1)
   endif
 endwhile
 "idx --> backward search (to include matches on first column)
 call cursor(mylist[n],len(getline(mylist[n])))
 while line(".") == mylist[n]
   let S= searchpos(@/, 'b')
   if S[0] == mylist[n]
 call add(idx, S[1]-1)
   endif
 endwhile

 "FIND ALL EDX MATCHES
 "edx --> forward search
 call cursor(mylist[n],1)
 while line(".") == mylist[n]
   let E= searchpos(@/, 'e')
   if E[0] == mylist[n]
 call add(edx, E[1])
   endif
 endwhile
 "edx --> backward search (to include matches on first column)
 call cursor(mylist[n],len(getline(mylist[n])))
 while line(".") == mylist[n]
   let E= searchpos(@/, 'eb')
   if E[0] == mylist[n]
 call add(edx, E[1])
   endif
 endwhile

 if len(idx) > 0
   for i in range(0,len(idx)-1)
let r = strpart(getline(mylist[n]),idx[i], edx[i]-idx[i])
call add(matches_between_cols, r)
   endfor
 endif
   endfor

---
Buffer:
city | Felicità 
whatever | Peach 
pmg0001 | Perché 
text| Céline
bMgbXuEWo | Université 


@/ = "| \zs\S\+"
it captures:
Felicit
Peach
Perch
Céline
Universit

Expected:
Felicità 
Peach 
Perché
Céline 
Université 

Can you please tell me what I did wrong?
(Is it not possible to let every character be a single byte char as in 
languages as Python?)

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Vim Function: return from within Python Code

2016-03-21 Thread rameo
@ZyX,

Thanks,
You mean to extract the Python code to a .py file and import it in my vim 
function?
I still don't understand how to exit from my pythoncode from within my python 
code.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Vim Function: return from within Python Code

2016-03-19 Thread rameo
I have a VIM function with a lot of code written in python.

There are many loops and sub-loops with this kind of code:

if this 
  exit
else
  do this

Does anyone know how to exit the python code and return to vim?
(or even better "how to exit the function from within python code?")
sys.exit() and exit() doesn't work.



-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Start/end positions of all matches on a single line

2016-03-19 Thread rameo
I would like to know the start/end positions of matches on a few lines.
These linenumbers are in a list "list".
I want to add the startpositions of all matches in the list "idx"
and the endpositions of matches in the list "edx"

idx = []
edx = []
for n in range(0,len(list)-1)
  "idx positions
  call cursor(list[n],1)
  while line(".") == list[n]
let S= searchpos(@/, '')
if S[0] == list[n]
  call add(idx, S[1]-1)
endif
  endwhile
  "edx positions
  call cursor(list[n],1)
  while line(".") == list[n]
let E= searchpos(@/, 'e')
if E[0] == list[n]
  call add(edx, E[1])
endif
  endwhile

  "do things with these lists before to go to next for loop (...add linenumber)
endfor

However this does not give an (idx) matchposition when the match is at the 
start of line.
Does anyone know how to catch all start/end positions of all matches of only 1 
single line?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any way to count all latin characters in utf-8 as 1 byte?

2016-03-08 Thread rameo
Thanks but I still don't understand it. No problem. 
Hope I'll not have problems with `vim.current.buffer[linenr -1]`.

My experience with Python tells me that Python language is much easier then 
vimscript. Things can be done easier with the many Python modules using less 
code then in vimscript. Even Python regex is much easier (p.e. 
lookahead/behind). I wish both language were more compatible. ;)







-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any way to count all latin characters in utf-8 as 1 byte?

2016-03-08 Thread rameo
> Better `vim.Function('getline')(linenr)

You seems to know everything in every computer language :)
Yes I use Pyth3 and many times also `vim.current.buffer[linenr-1]`
or things like this `r = vim.current.buffer[startline:endline]`

To avoid decoding errors it is better to switch all these statements to:
vim.Function('getline')(linenr) ?
p.e. line 3 in vim: vim.current.buffer[2]` --> vim.Function('getline')(2)?
How does python know from which buffer it has to capture the line and what 
would be the vim.Function statement in this case with a slice: 
`vim.current.buffer[startline:endline]`?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any way to count all latin characters in utf-8 as 1 byte?

2016-03-08 Thread rameo
Thank you.
You're right. It is not a question of decoding a list but decoding a string. 
Never did anything before with string encoding. I've got it: I cannot use 
searchpos() to use with python. Searching positions must be done in python 
(p.e. finditer). 

BTW I thought that ['encoding'] was a placeholder for utf8/latin1.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any way to count all latin characters in utf-8 as 1 byte?

2016-03-08 Thread rameo
Can't find anything on the net about string.encode(vim.options[encoding]).
No info either in Vim documentation: if_pyth

Let say I create my list "MyPositions" with start/end position of matches using 
searchpos() in vim.

Then in my python code I have to do something like this to convert it to byte 
strings:

python3 << endpython
import vim
myposPyth = str(vim.eval("MyPositions"))
myposPyth  = myposPyth.encode(vim.options['utf8'])

?
I still don't get it.
(btw above returns a key-error)



-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any way to count all latin characters in utf-8 as 1 byte?

2016-03-07 Thread rameo
 
> In Python you are not using *byte* counts, it indexes *unicode
> codepoints*. You may convert unicode Python objects to bytes objects
> by using `string.encode(vim.options['encoding'])`, use
> `.decode(vim.options['encoding'])` to convert back. bytes objects are
> indexed by bytes. You may also count codepoints on Vim side by using
> `strchars()`.
> 

Thank you ZyX, Can you please tell me where to put 
string.encode(vim.options['encoding'])? Before searchpos()? And 
decode(vim.options['encoding'])after searchpos()?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Is there any way to count all latin characters in utf-8 as 1 byte?

2016-03-07 Thread rameo
I use searchpos() to capture start/endcolumns of a matches.
Then I use the results in Python code to transform the text.

However I noted that latin characters as 'èéàòìù' are counted as 1 byte in 
Python but 2 bytes in Vim and the output is not as expected.

Is there any way to resolve this problem?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Vim and Python

2016-03-04 Thread rameo
Vim and Python is an incredible power combination.
Vimscript is great, Python makes it even greater, faster and easier.

What I just want to ask is if it possible in a future release to include the 
python regex code as well.
Now I do a search in vim, capture the search/matches and use it in a vimscript 
function with partially vimscript code, switching to python code.
If Vim could understand python regex code it would be even easier.
I just can do the search in python and capture matches in python, using a vim 
function.

Just an idea: using a P to let VIM know that the search is a python search?
VIM:
/mysearch 

PYTHON:
P/mysearch

It is also difficult to exit python code within a vim function.
sys.exit() in python code p.e. doesn't work in a vim function. 

In all ways, thanks again for the great editor.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Capture confirmation flag

2016-02-15 Thread rameo
"linenumber".s/search/replace/gc

Replace with 'replace' (y/n/a/q/l/^E/^Y)?

Do you know if there is any way to capture which one has been clicked?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


inputdialog() font

2016-01-24 Thread rameo
I use this monospaced font in VIM (in _vimrc): 
set guifont=DejaVu_Sans_Mono:h10

However in the inputdialog window the font is not this monospaced font but some 
NON monospaced font (it seems to me that it is Arial).

Is it possible to change the font in inputdialog()?
(text is not aligned in inputdialog())

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Python 3 support

2016-01-22 Thread rameo
I've installed the latest vim beta: gvim-7-4-1087.exe

Doesn't the beta support python 3? 

`import vim` doesn't work.
Vim could not load library python27.dll

I've installed python 3.5.
uninstalled it and installed python 3.4
uninstalled it and installed 3.3

Still same error.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Python 3 support

2016-01-22 Thread rameo
I've installed the latest vim beta: gvim-7-4-1087.exe

Doesn't the beta support python 3? 

`import vim` doesn't work.
Vim could not load library python27.dll

I've installed python 3.5.
uninstalled it and installed python 3.4
uninstalled it and installed 3.3

Still same error.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python 3 support

2016-01-22 Thread rameo
Op vrijdag 22 januari 2016 22:18:03 UTC+1 schreef Christian Brabandt:
> Hi rameo!
> 
> On Fr, 22 Jan 2016, rameo wrote:
> 
> > I've installed the latest vim beta: gvim-7-4-1087.exe
> > 
> > Doesn't the beta support python 3? 
> > 
> > `import vim` doesn't work.
> > Vim could not load library python27.dll
> > 
> > I've installed python 3.5.
> > uninstalled it and installed python 3.4
> > uninstalled it and installed 3.3
> > 
> > Still same error.
> 
> check the output of :version for :python3
> 
> You also need to use :python3 to use it.
> 
> 
> Best,
> Christian
> -- 
> Ein Fanatiker ist - in psychologischen Begriffen definiert - ein
> Mensch, der bewußt einen geheimen Zweifel überkompensiert.
>   -- Aldous Huxley


Thank you for your answer Christian.

This is what is written in my VIM:
python3/dyn
-DFEAT_PYTHON 
-DDYNAMIC_PYTHON
-DDYNAMIC_PYTHON_DLL="python27.dll"
-DFEAT_PYTHON3
-DDYNAMIC_PYTHON3
-DDYNAMIC_PYTHON3_DLL="python33.dll"

Does that mean that Python 3.4 and Python 3.5 don't work on my VIM?
I need Python 3.3 is that correct?

Best regards,
Rameo

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Inputdialog - Aligning

2014-08-02 Thread rameo
On Sunday, July 27, 2014 11:51:30 AM UTC+2, rameo wrote:
 I noted that Vim uses the proportional windows default font for his 
 inputdialog text. (The same font as the gvim menu font)
 
 If I create an inputdialog like this:
 
 Let question = Which formatting?
   \ \n
   \ \n1) %.2f -- Floating point number, 2 decimals
   \ \n2) %10d -- Integer Right aligned (width 10)
   \ \n3) %02d -- Integer with 1 leading zero
   \ \n4) %g   -- Floating point number, as %f or %e depending on value
   \ \n5) etc
   \
 let a = inputdialog(question)
 
 The output is not aligned at all. I want to align the field starting with %, 
 the '--' field and the field after the '--'.
 How can I do this?
 
 I also tried to use tabs but the result is the same.

Any idea?

I forgot to write that the text is not aligned in the input dialog window (no 
problem that it is not aligned in the function).

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Inputdialog - Aligning

2014-07-27 Thread rameo
I noted that Vim uses the proportional windows default font for his inputdialog 
text. (The same font as the gvim menu font)

If I create an inputdialog like this:

Let question = Which formatting?
  \ \n
  \ \n1) %.2f -- Floating point number, 2 decimals
  \ \n2) %10d -- Integer Right aligned (width 10)
  \ \n3) %02d -- Integer with 1 leading zero
  \ \n4) %g   -- Floating point number, as %f or %e depending on value
  \ \n5) etc
  \
let a = inputdialog(question)

The output is not aligned at all. I want to align the field starting with %, 
the '--' field and the field after the '--'.
How can I do this?

I also tried to use tabs but the result is the same.

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Encoding and Fileencoding of a latin1 file

2014-07-06 Thread rameo
Thank you very much Ben for your great explication.
Not easy to understand.

I still don't understand why my vimrc and menu.vim, containing both french 
characters as œu, could be read in latin1 in the past, without any problem or 
error.
(The only encoding line I had in my vimrc file at that moment was set 
encoding=latin1)

What I also don't understand is that with above setting, files in latin1 where 
encoded in latin1 but the fileencoding in my statusline was empty (no 
fileencoding was indicated by vim)
If I changed the above setting to set encoding=utf8, encoding and 
fileencoding both indicated utf-8. Does vim take as default encoding the 
default windows encoding?

Every now and then I write something in Russian that is why it might be better 
to change the default encoding to utf8, isn't it? I had also troubles to use a 
plugin using latin1 as the default encoding.
If I set my default encoding to utf-8, what would be the filencodings?
Set fileencodings=ucs-bom,utf8,cp1252,latin1?
utf8 at the end or after ucs-bom?
Btw I'm on a windows OS, 8bit-cp1252 has to be cp1252, isn't it?

If my default encoding will be utf-8, it is better to convert vimrc and 
menu.vim to utf8 as well to avoid that I see every time Converted after the 
filename, isn't it?
Do you know a good software to convert cp1252 files to utf-8? (I used iconv in 
the past)

Btw Ben, you noted in your reply setglobal fileencoding=utf-8 
What difference is there between set fileencoding=utf-8  and setglobal 
fileencoding=utf-8. I thought there was no local buffer encoding setting?

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Encoding and Fileencoding of a latin1 file

2014-07-05 Thread rameo
Ben,

Try to write these french words in a file with a latin1 fileencoding: 
 bœuf, cœur, manœuvre, œil
(beef, heart, manoeuvre, eye)

Close this file.
Set encoding to utf-8 in your vimrc.
Open the file.

Encoding is utf-8
Fileencoding is latin1 (:set fileencoding?), converted is written after the 
file name.
But all words have squares.
(The same file is visualized well in notepad+++, recognized as latin1)

Btw you asked me how I check encoding and fileencoding of a file?
I have this in my statusline:
set statusline+=%2*\ E:%{fileencoding?fileencoding:encoding}
set statusline+=%2*\ F:%{fileencoding?fileencoding:fileencoding} 

Years ago I had also problems with utf-8 and switched back to latin1 encoding.
These days I switched again to utf-8 and after a while it messed up again my 
files (p.e. my vimrc file).

A question:
Why should there be an encoding and fileencoding? Why not put them together?
If a file is a latin1 file: encoding and fileencoding has to be in latin1.
If a file is an utf-8 file: encoding and fileencoding has to be in utf-8.
Without Conversion written after a file name.
And in the Config file a user can then indicate whether a new file should be in 
utf-8 or any other encoding, something like this:
let NewFileEncoding = utf-8


-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Match all characters enclosed in brackets

2013-08-09 Thread rameo
I have trouble finding the correct regex.

I know that a sequence of characters enclosed in brackets means their optional: 
[xyz] means any 'x' OR 'y' OR 'z'

but how can I find them all?
 any 'x' AND 'y' AND 'z' in whatever sequence and quantity

p.e. 
Match first an uppercase character then all lowercase characters with at least 
1 uppercase character
This would be easier if the sequence of characters enclosed in brackets aren't 
optional.

Something like this:
\u[a-zA-Z]




-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: using !sort in windows commandline: passing special characters

2013-07-22 Thread rameo
On Monday, July 22, 2013 4:08:28 AM UTC+2, Tim Chase wrote:
 [copying the list, as your reply came directly to me.  You may want
 
 to check your reply before sending]
 
 
 
 On 2013-07-21 22:29, wrote:
 
  Thank you very much for your reply Tim.
 
  
 
   This sounds like cmd.exe is being used for your shell processing
 
   of your command, rather than some other (bash?) shell.  Within
 
   vim, what is the result of
 
  
 
  :set shell?
 
  
 
   I'm presuming it's something like C:\...\cmd.exe rather than
 
   C:\...\bash.exe (or some such cygwin shell).
 
  
 
  Yes you're right
 
  shell=cmd.exe
 
  
 
   As directed at :help 'shell', you might also want to investigate
 
   your settings for 'shelltype', 'shellpipe', 'shellslash'
 
   'shellredir', 'shellquote', 'shellxquote' and 'shellcmdflag' to
 
   figure out what they're set to.  Including those values in a reply
 
   may help track down further issues if pointing 'shell' at a *nixy
 
   shell rather than a Win32 shell.
 
  
 
  shelltype: option not supported
 
  shellpipe=%s 21
 
  noshellslash
 
  shellredir=%s 21
 
  shellquote=
 
  shellxquote=
 
  shellcmdflag=/c
 
 
 
 Someone with a Win32+cygwin environment might be able to step in here
 
 and compare their settings with yours.
 
 
 
 It might also help to know whether you're running vim-for-Windows
 
 (the Windows version of vim) or a vim built to be cygwin aware.  I
 
 seem to recall that there were some differences in them.
 
 
 
 
 
   If it's cmd.exe, you might try setting the value of 'shell' to the
 
   path where you'll find your preferred *nixy shell as installed by
 
   cygwin, and re-test (and providing the results here if it doesn't
 
   work for you).
 
  
 
  The windows shell is working very well as intermetter to the bash
 
  shell, just these pipes and quotes problems.
 
  I noted much more problems when I define the bash shell as shell in
 
  vim.
 
 
 
 I've found that cmd.exe's parameter-quoting and piping are somewhat
 
 less predictable when compared to *nixy shells
 
 
 
 
 
  I use unix sort command because I've found it much more flexible as
 
  the vim sort command.
 
  p.e. to sort by column(nr) 5 and if there are equals sort by
 
  column(nr) 12, isn't possible (i.m.o) with vim sort command.
 
  I use it also to sort by real columns (and define a separator to
 
  number columns), like the one in my example.
 
 
 
 since you have the full expressive power of Vim regexps at your
 
 disposal with the internal sort, your example could be done with
 
 either of
 
 
 
   :%sort /|/
 
   :%sort n /|/
 
 
 
 (depending on whether you wanted numeric sorting or
 
 ASCII/lexicographical sort order)
 
 
 
 For subsequent columns it gets a little messier, but you can do it.
 
 For 2 preceding columns (i.e., sorting on the 3rd column), you can do
 
 
 
   :%sort /^\([^|;:]*[|;:]\)\{2}/
 
 
 
 to allow for any of a pipe, colon, or semi-colon as delimiters.
 
 
 
 All the basics that you can do with GNU sort should be pretty doable
 
 with Vim's internal sort, except perhaps some of the more edge-case
 
 sort-orders (such as --month-sort, --human-numeric-sort and
 
 --version-sort).  I don't use those very often and far more
 
 frequently have need to sort by some regexp like vim provides.
 
 
 
 -tim

Thank you very much Tim.
Sorry that my reply came to you and not to the list.

Thanks also for your regex.
This one is maybe even easier:

:%sort! n /^\(.\{-}\zs[|;:]\)\{'.columnnr.'}/

Hope that someone will answer also to the shell settings.
(btw I use the vim windows version (not the cygwin vi version).

Sure I will use the vim sort command a bit more (and have to study it a bit 
more)

I still use the unix sort command to sort single columns (p.e.\\%2v) 
P.e. to sort by column 4 and if there are equals sort by column 8.
This is very easy to do with the unix sort command, it seems to me much more 
difficult with the vim sort command.

However, thanks so far. 
Rameo

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




using !sort in windows commandline: passing special characters

2013-07-21 Thread rameo
I use cygwin on my windows system to use unix commands from vim commandline.

This is written in my text file:
Adam|12345
Bob|34567
Joe|56789
Sam|45678
Wendy|23456

When I use:

 :%!sort -k2n -t'|'

it gives an error:
''' is not recognized as an internal or external command, operable program or 
batch file.

Same problem when I use '' and '' as separator.
Escaping doesn't resolve my problem.
I don't have problems with other separators as ';', ')', '\\', '=' and many 
others.

btw
Is it possible to use regex in the sort command. No info is written in the 
manual and it doesn't work in my vim.

:%!sort -k3 -t'[,;]'

(sort after the 3rd time a ',' or ';' is found)

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cursor question

2013-03-14 Thread rameo
Thank you Ben,

Yes indeed I've never noted it before but these days I had a few times that the 
cursor moved to the wrong position. I thought it was something in my VIM and I 
put an empty vim version on my disk but the mouse moved still a few times to 
the wrong position, so I decided to post this message.
Well if there is nothing I can do, I have to accept it as it is :)

On Wednesday, March 13, 2013 10:34:22 AM UTC+1, rameo wrote:
 In insert mode I have a blinking vertical bar as cursor.
 
 I noted a strange thing when I'm in insert mode:
 I have to click with the mouse on the next letter in order to put the 
 vertical bar before this letter.
 When I click on the space between two letters the cursor goes to the space 
 before the previous letter:
 
 In notepad and in other applications on my windows system (p.e. writing this 
 message in my browser), the vertical bar goes where I click with the mouse.
 
 I would like to have this also in vim.
 What can I do to obtain this?
 
 This is what I have in _vimrc:
 set guicursor=i-c-ci:ver20-Cursor,r-cr:hor10-RCursor

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Cursor question

2013-03-13 Thread rameo
In insert mode I have a blinking vertical bar as cursor.

I noted a strange thing when I'm in insert mode:
I have to click with the mouse on the next letter in order to put the vertical 
bar before this letter.
When I click on the space between two letters the cursor goes to the space 
before the previous letter:

In notepad and in other applications on my windows system (p.e. writing this 
message in my browser), the vertical bar goes where I click with the mouse.

I would like to have this also in vim.
What can I do to obtain this?

This is what I have in _vimrc:
set guicursor=i-c-ci:ver20-Cursor,r-cr:hor10-RCursor

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




command using numeric keypad

2013-01-27 Thread rameo
I would like to associate commands with the numeric keypad 

ctrl + - (number 6 on the numeric keypad with numlock enabled)

I don't know how to do this.
Can anyone help me?

-- 
-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php





Re: email plugin

2012-11-29 Thread rameo
On Friday, November 30, 2012 12:05:41 AM UTC+1, Bost wrote:
 Is there any good email plugin you can recommend me guys? It seems
 
 like there isn't any star plugin for handling emails in vim, in fact
 
 google search doesn't return many useful links to this topic. So, I'd
 
 like to hear your tips  comments before I plunge in an evaluation of
 
 the existing plugins. Thanx in advance
 
 
 
 Bost

I use text editor anywhere.
With a shortcut my email (or email selection) is send to Vim.
Then I write my email, save it and close Vim. 
Then I go back to my email client and my email has been updated.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Highlight after invoking a function

2012-05-02 Thread rameo
I would like to know how to highlight matches after invoking a function p.e.

  function! s:MyFunction()
   let search = '\d\+'
   let @/ = search
   return normal n 
  endfunction

:call SIDTest()CR 
does not highlight the matches.

I know I can add :set hlsCR after the function call but that creates problems
with output of echo commands.

:set hlsCR does also create problems if the function
waits for an user input p.e.
:%s/pattern/replace-pattern/gc

Thanks in advance.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Colorschemes and split window

2012-04-30 Thread rameo
It seems that I have found the solution (after many many hours of trying :-( )

I created the function below.
The function must do this (and seems to do it):

a) when there is only 1 window:
  check if filetype is vim -- Dark_ColorScheme
if filetype is not vim -- Light_ColorScheme
b) when there is a split window:
   check if exist split window colorscheme variable (g:splitcolor)
   if yes, colorscheme of splitwindow = g:splitcolor
   
   when leaving split window:
   keep the value of the current color in g:splitcolor

Can anyone tell me if I made a mistake and if the function can be simplified?

function SetColors()
if winnr('$')  1
   if exists('g:splitcolor')
 exe 'colors '.g:splitcolor
   else
 exe 'colors Light_ColorScheme'
   endif
elseif winnr('$') == 1  ft == 'vim'
 exe 'colors Dark_ColorScheme'
elseif winnr('$') == 1  ft != 'vim' 
 exe 'colors Light_ColorScheme'
endif
endfunction
function KeepColors()
   if winnr('$')  1
   let g:splitcolor = g:colors_name
   endif
endfunction
augroup filetype_colorscheme
au BufEnter * call SetColors()
au BufLeave * call KeepColors()
augroup END 

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Colorschemes and split window

2012-04-29 Thread rameo
On Saturday, April 28, 2012 12:39:51 AM UTC+2, Tony Mechelynck wrote:
 On 27/04/12 23:41, rameo wrote:
  On Friday, April 27, 2012 8:29:03 PM UTC+2, Tony Mechelynck wrote:
  On 27/04/12 18:34, rameo wrote:
  On Friday, April 27, 2012 6:18:29 PM UTC+2, Ben Fritz wrote:
  On Friday, April 27, 2012 10:56:55 AM UTC-5, rameo wrote:
  I use this code in my .vimrc to use my dark colorscheme when I open a 
  .vim page and my light colorscheme when I open whatever other page:
 
  augroup filetype_colorscheme
au BufEnter *
\ if !exists('b:colors_name')
\ | if ft == vim
\ | let b:colors_name = 'color_dark'
\ | else
\ | let b:colors_name = 'color_light'
\ | endif
\ | endif
\ | exe 'colorscheme' b:colors_name
  augroup END
 
  However, it doesn't work fine in split windows.
  When I click on a .vim file in the split window all not .vim files 
  changes to the dark colorscheme as well.
  I would like to keep them their own colorscheme; a .vim page always the 
  dark colorscheme and whatever other file always the light colorscheme.
 
  I've learned that colorschemes will always affect the entire vim 
  instance and that it is not possible to have a different color scheme 
  per split window.
 
  In that point I would like to disable above code for split windows in 
  order to give all split windows the default colorscheme (which I can 
  change afterwards using :color colorscheme) but don't know how to 
  realize this. Whatever I tried didn't do what I want it to do.
  Can anyone help me?
 
  You can check the number of windows with winnr('$'). If  1, you have 
  multiple split windows.
 
  Hi Ben,
 
  That's what I tried.
  But wherever I put it in above code it doesn't work.
  Where would you place this in above code?
 
 
  Around your autocommand:
 
  augroup filetype_colorscheme
au BufEnter *
\ if winnr('$') == 1
\ | if !exists('b:colors_name')
\ | if ft == vim
\ | let b:colors_name = 'color_dark'
\ | else
\ | let b:colors_name = 'color_light'
\ | endif
\ | endif
\ | exe 'colorscheme' b:colors_name
\ | else
\ | colorscheme default
| | endif
  augroup END
 
  or (maybe more readable)
 
  function SetColors()
 if exists('b:colors_name')
 exe 'colorscheme' b:colors_name
 return
 endif
 if winnr('$')  1
 colorscheme default
 elseif ft == 'vim'
 colorscheme color_dark
 else
 colorscheme color_light
 endif
 let b:colors_name = g:colors_name
  endfunction
  augroup filetype_colorscheme
 au BufEnter * call SetColors()
  augroup END
 
  This way, the autocommand will be defined unconditionally, but if it
  finds that at BufEnter three are more than one window in the current tab
  it will go back to the default scheme.
 
 
  Best regards,
  Tony.
  --
  Actor: So what do you do for a living?
  Doris: I work for a company that makes deceptively shallow serving
 dishes for Chinese restaurants.
 -- Woody Allen, Without Feathers
 
  Thank you very much.
 
  Just one little thing..
 
  What I noted is that when I have a split window it gives the default 
  colorscheme (that's ok) but I would like to have the possibility to change 
  the colorscheme of all split buffers in a window with the :color 
  colorscheme command (and if possible keep this colorscheme when I switch 
  from one Tab to another and back to the split window or when I click in 
  another split buffer in the split window.
  (when I have multiple .vim files in the split window I prefer the dark 
  colorscheme, when I have multiple .txt files in the split, I prefer the 
  light colorscheme. That isn't possible now. When I use :color colorscheme 
  and click in another split window all other split windows changes again to 
  the default colorscheme)
 
  Is it possible to do?
 
 
 Well, it is possible, with a slight refinement to the above. You may 
 want to remember the Vim terminology:
 
 - buffer: one file (or file-like data) in Vim memory, with the relevant 
 metadata. It may be displayed in zero or more windows.
 - window: a viewport into a buffer. If several windows display the same 
 buffer, changes made in one are reflected in all others. Also, if 
 several windows display the same buffer, the displayed regions of that 
 buffer may or may not overlap.
 - tab page: a set of one or more windows which are displayed at the same 
 time.
 
 another split buffer in a split window has no meaning. Maybe you meant 
 another window in the current tab?
 
 You can use variables with different scopes:
 
 b:something   local to a buffer
 g:something   global to all Vim
 l:something   local to a function
 s:something

Re: Colorschemes and split window

2012-04-28 Thread rameo
On Saturday, April 28, 2012 12:39:51 AM UTC+2, Tony Mechelynck wrote:
 On 27/04/12 23:41, rameo wrote:
  On Friday, April 27, 2012 8:29:03 PM UTC+2, Tony Mechelynck wrote:
  On 27/04/12 18:34, rameo wrote:
  On Friday, April 27, 2012 6:18:29 PM UTC+2, Ben Fritz wrote:
  On Friday, April 27, 2012 10:56:55 AM UTC-5, rameo wrote:
  I use this code in my .vimrc to use my dark colorscheme when I open a 
  .vim page and my light colorscheme when I open whatever other page:
 
  augroup filetype_colorscheme
au BufEnter *
\ if !exists('b:colors_name')
\ | if ft == vim
\ | let b:colors_name = 'color_dark'
\ | else
\ | let b:colors_name = 'color_light'
\ | endif
\ | endif
\ | exe 'colorscheme' b:colors_name
  augroup END
 
  However, it doesn't work fine in split windows.
  When I click on a .vim file in the split window all not .vim files 
  changes to the dark colorscheme as well.
  I would like to keep them their own colorscheme; a .vim page always the 
  dark colorscheme and whatever other file always the light colorscheme.
 
  I've learned that colorschemes will always affect the entire vim 
  instance and that it is not possible to have a different color scheme 
  per split window.
 
  In that point I would like to disable above code for split windows in 
  order to give all split windows the default colorscheme (which I can 
  change afterwards using :color colorscheme) but don't know how to 
  realize this. Whatever I tried didn't do what I want it to do.
  Can anyone help me?
 
  You can check the number of windows with winnr('$'). If  1, you have 
  multiple split windows.
 
  Hi Ben,
 
  That's what I tried.
  But wherever I put it in above code it doesn't work.
  Where would you place this in above code?
 
 
  Around your autocommand:
 
  augroup filetype_colorscheme
au BufEnter *
\ if winnr('$') == 1
\ | if !exists('b:colors_name')
\ | if ft == vim
\ | let b:colors_name = 'color_dark'
\ | else
\ | let b:colors_name = 'color_light'
\ | endif
\ | endif
\ | exe 'colorscheme' b:colors_name
\ | else
\ | colorscheme default
| | endif
  augroup END
 
  or (maybe more readable)
 
  function SetColors()
 if exists('b:colors_name')
 exe 'colorscheme' b:colors_name
 return
 endif
 if winnr('$')  1
 colorscheme default
 elseif ft == 'vim'
 colorscheme color_dark
 else
 colorscheme color_light
 endif
 let b:colors_name = g:colors_name
  endfunction
  augroup filetype_colorscheme
 au BufEnter * call SetColors()
  augroup END
 
  This way, the autocommand will be defined unconditionally, but if it
  finds that at BufEnter three are more than one window in the current tab
  it will go back to the default scheme.
 
 
  Best regards,
  Tony.
  --
  Actor: So what do you do for a living?
  Doris: I work for a company that makes deceptively shallow serving
 dishes for Chinese restaurants.
 -- Woody Allen, Without Feathers
 
  Thank you very much.
 
  Just one little thing..
 
  What I noted is that when I have a split window it gives the default 
  colorscheme (that's ok) but I would like to have the possibility to change 
  the colorscheme of all split buffers in a window with the :color 
  colorscheme command (and if possible keep this colorscheme when I switch 
  from one Tab to another and back to the split window or when I click in 
  another split buffer in the split window.
  (when I have multiple .vim files in the split window I prefer the dark 
  colorscheme, when I have multiple .txt files in the split, I prefer the 
  light colorscheme. That isn't possible now. When I use :color colorscheme 
  and click in another split window all other split windows changes again to 
  the default colorscheme)
 
  Is it possible to do?
 
 
 Well, it is possible, with a slight refinement to the above. You may 
 want to remember the Vim terminology:
 
 - buffer: one file (or file-like data) in Vim memory, with the relevant 
 metadata. It may be displayed in zero or more windows.
 - window: a viewport into a buffer. If several windows display the same 
 buffer, changes made in one are reflected in all others. Also, if 
 several windows display the same buffer, the displayed regions of that 
 buffer may or may not overlap.
 - tab page: a set of one or more windows which are displayed at the same 
 time.
 
 another split buffer in a split window has no meaning. Maybe you meant 
 another window in the current tab?
 
 You can use variables with different scopes:
 
 b:something   local to a buffer
 g:something   global to all Vim
 l:something   local to a function
 s:something

Colorschemes and split window

2012-04-27 Thread rameo
I use this code in my .vimrc to use my dark colorscheme when I open a .vim page 
and my light colorscheme when I open whatever other page:

augroup filetype_colorscheme
au BufEnter *
\ if !exists('b:colors_name')
\ | if ft == vim
\ | let b:colors_name = 'color_dark'
\ | else
\ | let b:colors_name = 'color_light'
\ | endif
\ | endif
\ | exe 'colorscheme' b:colors_name
augroup END 

However, it doesn't work fine in split windows.
When I click on a .vim file in the split window all not .vim files changes to 
the dark colorscheme as well.
I would like to keep them their own colorscheme; a .vim page always the dark 
colorscheme and whatever other file always the light colorscheme.

I've learned that colorschemes will always affect the entire vim instance and 
that it is not possible to have a different color scheme per split window.

In that point I would like to disable above code for split windows in order to 
give all split windows the default colorscheme (which I can change afterwards 
using :color colorscheme) but don't know how to realize this. Whatever I 
tried didn't do what I want it to do.
Can anyone help me?


-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Colorschemes and split window

2012-04-27 Thread rameo
On Friday, April 27, 2012 6:18:29 PM UTC+2, Ben Fritz wrote:
 On Friday, April 27, 2012 10:56:55 AM UTC-5, rameo wrote:
  I use this code in my .vimrc to use my dark colorscheme when I open a .vim 
  page and my light colorscheme when I open whatever other page:
  
  augroup filetype_colorscheme
  au BufEnter *
  \ if !exists('b:colors_name')
  \ | if ft == vim
  \ | let b:colors_name = 'color_dark'
  \ | else
  \ | let b:colors_name = 'color_light'
  \ | endif
  \ | endif
  \ | exe 'colorscheme' b:colors_name
  augroup END 
  
  However, it doesn't work fine in split windows.
  When I click on a .vim file in the split window all not .vim files changes 
  to the dark colorscheme as well.
  I would like to keep them their own colorscheme; a .vim page always the 
  dark colorscheme and whatever other file always the light colorscheme.
  
  I've learned that colorschemes will always affect the entire vim instance 
  and that it is not possible to have a different color scheme per split 
  window.
  
  In that point I would like to disable above code for split windows in order 
  to give all split windows the default colorscheme (which I can change 
  afterwards using :color colorscheme) but don't know how to realize this. 
  Whatever I tried didn't do what I want it to do.
  Can anyone help me?
 
 You can check the number of windows with winnr('$'). If  1, you have 
 multiple split windows.

Hi Ben,

That's what I tried.
But wherever I put it in above code it doesn't work.
Where would you place this in above code?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Colorschemes and split window

2012-04-27 Thread rameo
On Friday, April 27, 2012 8:29:03 PM UTC+2, Tony Mechelynck wrote:
 On 27/04/12 18:34, rameo wrote:
  On Friday, April 27, 2012 6:18:29 PM UTC+2, Ben Fritz wrote:
  On Friday, April 27, 2012 10:56:55 AM UTC-5, rameo wrote:
  I use this code in my .vimrc to use my dark colorscheme when I open a 
  .vim page and my light colorscheme when I open whatever other page:
 
  augroup filetype_colorscheme
   au BufEnter *
   \ if !exists('b:colors_name')
   \ | if ft == vim
   \ | let b:colors_name = 'color_dark'
   \ | else
   \ | let b:colors_name = 'color_light'
   \ | endif
   \ | endif
   \ | exe 'colorscheme' b:colors_name
  augroup END
 
  However, it doesn't work fine in split windows.
  When I click on a .vim file in the split window all not .vim files 
  changes to the dark colorscheme as well.
  I would like to keep them their own colorscheme; a .vim page always the 
  dark colorscheme and whatever other file always the light colorscheme.
 
  I've learned that colorschemes will always affect the entire vim instance 
  and that it is not possible to have a different color scheme per split 
  window.
 
  In that point I would like to disable above code for split windows in 
  order to give all split windows the default colorscheme (which I can 
  change afterwards using :color colorscheme) but don't know how to 
  realize this. Whatever I tried didn't do what I want it to do.
  Can anyone help me?
 
  You can check the number of windows with winnr('$'). If  1, you have 
  multiple split windows.
 
  Hi Ben,
 
  That's what I tried.
  But wherever I put it in above code it doesn't work.
  Where would you place this in above code?
 
 
 Around your autocommand:
 
 augroup filetype_colorscheme
  au BufEnter *
  \ if winnr('$') == 1
  \ | if !exists('b:colors_name')
  \ | if ft == vim
  \ | let b:colors_name = 'color_dark'
  \ | else
  \ | let b:colors_name = 'color_light'
  \ | endif
  \ | endif
  \ | exe 'colorscheme' b:colors_name
  \ | else
  \ | colorscheme default
  | | endif
 augroup END
 
 or (maybe more readable)
 
 function SetColors()
   if exists('b:colors_name')
   exe 'colorscheme' b:colors_name
   return
   endif
   if winnr('$')  1
   colorscheme default
   elseif ft == 'vim'
   colorscheme color_dark
   else
   colorscheme color_light
   endif
   let b:colors_name = g:colors_name
 endfunction
 augroup filetype_colorscheme
   au BufEnter * call SetColors()
 augroup END
 
 This way, the autocommand will be defined unconditionally, but if it 
 finds that at BufEnter three are more than one window in the current tab 
 it will go back to the default scheme.
 
 
 Best regards,
 Tony.
 -- 
 Actor:So what do you do for a living?
 Doris:I work for a company that makes deceptively shallow serving
   dishes for Chinese restaurants.
   -- Woody Allen, Without Feathers

Thank you very much. 

Just one little thing..

What I noted is that when I have a split window it gives the default 
colorscheme (that's ok) but I would like to have the possibility to change the 
colorscheme of all split buffers in a window with the :color colorscheme 
command (and if possible keep this colorscheme when I switch from one Tab to 
another and back to the split window or when I click in another split buffer in 
the split window.
(when I have multiple .vim files in the split window I prefer the dark 
colorscheme, when I have multiple .txt files in the split, I prefer the light 
colorscheme. That isn't possible now. When I use :color colorscheme and click 
in another split window all other split windows changes again to the default 
colorscheme)

Is it possible to do?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: questions about submatch()

2012-04-24 Thread rameo
Tnx John and Ben.
Please let me ask one more question about submatch()

If I use submatch like this:
:%s/'pattern'/\=MyFunction(submatch())/g

function! MyFunction(m)

variable x
do something with variable x

return x
endfunction


I would like to confirm (with a c flag) all single substitutions
but the c flag at the end of the substitution command 
(:%s/'pattern'/\=MyFunction(submatch())/gc) doesn't work.



-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: questions about submatch()

2012-04-24 Thread rameo
On Tuesday, April 24, 2012 10:01:35 AM UTC+2, JohnBeckett wrote:
 rameo wrote:
  If I use submatch like this:
  :%s/'pattern'/\=MyFunction(submatch())/g
 
 That gives:
 E119: Not enough arguments for function: submatch
 E116: Invalid arguments for function MyFunction(submatch())
 
  I would like to confirm (with a c flag) all single
  substitutions but the c flag at the end of the substitution
  command (:%s/'pattern'/\=MyFunction(submatch())/gc) doesn't work.
 
 The following works on my system:
 
 function! MyFunction(m)
   let x = len(a:m)
   return x
 endfunction
 %s/'pattern'/\=MyFunction(submatch(0))/gc
 
 Testing on following gave a confirm for each change.
 
 'pattern' hello 'pattern' hello 'pattern' hello
 
 John

Thank you John.
I resolved it :)

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


questions about submatch()

2012-04-23 Thread rameo
Hello to all readers,

I use submatch() to increment/decrement numbers in a text.

My questions are:
1) In my country the comma is seen as decimal separator.
   submatch() doesn't seem to recognize the comma but use the dot 
   as separator.
   Is there a way to let submatch() know that the decimal separator in the 
   text is the comma?
2) Often the numbers in my text have thousand separators.
   submatch() doesn't recognize them.
   %s/1.000.000/\=submatch(0) + 10/g gives as output 11
   How can I tell submatch that dots are thousand separators?
3) In my text I have integers and float values.
   If I use %s/a search string/\=string2float(submatch(0)) [+-]nr/g all 
   non float values have .0 after the conversion.
   If I use %s/a search string/\=submatch(0) [+-]nr/g there are no decimals
   added after the conversion when there are float values.
   How can I let submatch() know that it has to make a float value when
   the increment/decrement value or the number self is a float, else it has
   to see the value as integer?

Tnx,
Rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: questions about submatch()

2012-04-23 Thread rameo
On Monday, April 23, 2012 8:41:33 AM UTC+2, rameo wrote:
 Hello to all readers,
 
 I use submatch() to increment/decrement numbers in a text.
 
 My questions are:
 1) In my country the comma is seen as decimal separator.
submatch() doesn't seem to recognize the comma but use the dot 
as separator.
Is there a way to let submatch() know that the decimal separator in the 
text is the comma?
 2) Often the numbers in my text have thousand separators.
submatch() doesn't recognize them.
%s/1.000.000/\=submatch(0) + 10/g gives as output 11
How can I tell submatch that dots are thousand separators?
 3) In my text I have integers and float values.
If I use %s/a search string/\=string2float(submatch(0)) [+-]nr/g all 
non float values have .0 after the conversion.
If I use %s/a search string/\=submatch(0) [+-]nr/g there are no decimals
added after the conversion when there are float values.
How can I let submatch() know that it has to make a float value when
the increment/decrement value or the number self is a float, else it has
to see the value as integer?
 
 Tnx,
 Rameo

John,

I don't know exactly what you think is not clear in my question and  how 
examples can help to clarify.

In text what I use the comma is the decimal separator.
The dot is a thousand separator.
submatch() doesn't recognize the thousand separator and doesn't recognize the 
comma as decimal separator.
submatch() handles different regional settings as the one in my country.
Is there a way to let submatch() my regional settings?
If not .. do I have to convert all xx,xx numbers to xx.xx numbers (substitute 
dot for comma) and all x.xxx.xxx numbers to xxx numbers (removing the 
thousand separator)?

p.e. 
see these examples:
please put these values in a new buffer:
1.000.000  25,20   10.15  200

These are the the different examples:

%s/1.000.000\|25,20\|10.15\|200/\=submatch(0) + 10/g
output: 11  35   20  210
What I expected: 1.000.010 35,20 (or 35) -- 210

%s/1.000.000\|25,20\|10.15\|200/\=submatch(0) + 1.000/g
output: 2.0  26.0   11.0  201.0
What I expected: 1.001.000 1025 - 1.200

%s/1.000.000\|25,20\|10.15\|200/\=str2float(submatch(0)) + 10,0/g
output: invalid expression
What I expected: 1.000.010,0 35,20 -- 210,0

%s/1.000.000\|25,20\|10.15\|200/\=str2float(submatch(0)) + 1.000/g
output: 2.0  26.0   11.15  201.0
What I expected: 1.001.000 1025,20 -- 1.200





-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: matchend() and \zs

2012-04-20 Thread rameo
On Thursday, April 19, 2012 8:12:55 PM UTC+2, Ben Fritz wrote:
 On Thursday, April 19, 2012 5:35:11 AM UTC-5, rameo wrote:
  My file - first line:
  an  91.010 System.-sep010-   Nop
  
  I want to copy all numbers after -sep
  echo match(getline(1), 'sep\zs\d\+\ze-')
  gives 23 as output. 
  All ok.
  
  but
  echo matchend(getline(1), 'sep\zs\d\+\ze-', 23)
  gives -1 as output.
  Why?
  
  If I remove sep before '\zs' it works.
  (echo matchend(getline(1), '\zs\d\+\ze-', 23)
  gives 26 as output.
  
  Does matchend not work with \zs?
  How can I resolve this problem?
 
 I haven't looked in detail at your problem, but I wonder if you're running 
 into the same issue as this recent thread:
 
 https://groups.google.com/d/topic/vim_use/prE5uPDeETU/discussion
 
 In summary, giving a starting position to matchend() without giving a count 
 treats the string as if the beginning of the string is at the starting 
 position. So anything before the starting position cannot be used in the 
 match, unless you provide a count as well.

Hi Ben,

Yes that's me.

Thanks for the answer.
What do you mean with provide a count?
How do you provide a count to match()

--

After all these match() and matchend() problems, I'm trying to view if matches 
can be captured by using the submatch(0) and adding them to a register.
Isn't this a bit dangerous because you have to return the submatch (in order to 
left the buffertext unchanged)?
However I tested that it captures all matches whatever the regex is.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: matchend() and \zs

2012-04-20 Thread rameo
On Friday, April 20, 2012 5:52:37 PM UTC+2, Ben Fritz wrote:
 On Friday, April 20, 2012 2:45:28 AM UTC-5, rameo wrote:
  
  After all these match() and matchend() problems, I'm trying to view if 
  matches can be captured by using the submatch(0) and adding them to a 
  register.
  Isn't this a bit dangerous because you have to return the submatch (in 
  order to left the buffertext unchanged)?
  However I tested that it captures all matches whatever the regex is.
 
 submatch() only works inside a substitute() call or inside a :substitute 
 command (:help sub-replace-expression). It says this explicitly in :help 
 submatch(). In the future, please read the help topics on the functions you 
 are using before posting to the list.
 
 In order to use the matched text, you can try matchstr() or matchlist() 
 instead. Again, had you read the help for match(), you would have been 
 directed to these functions.

yes Ben,
What do you think that I haven't read the help?
I know that submatch() works only in a substitute command but that was not my 
question.
I asked if it is a bit dangerous to use submatch() to capture matches because 
it does a substitute in the text. However it seems to capture all, whatever 
regex.

And I've read also about match(), but not everything is so easy for me as it is 
for you as you are a longtime user ;)

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: matchend() and \zs

2012-04-20 Thread rameo
On Friday, April 20, 2012 8:51:37 PM UTC+2, Ben Fritz wrote:
 On Friday, April 20, 2012 11:30:02 AM UTC-5, rameo wrote:
  On Friday, April 20, 2012 5:52:37 PM UTC+2, Ben Fritz wrote:
   On Friday, April 20, 2012 2:45:28 AM UTC-5, rameo wrote:

After all these match() and matchend() problems, I'm trying to view if 
matches can be captured by using the submatch(0) and adding them to a 
register.
Isn't this a bit dangerous because you have to return the submatch (in 
order to left the buffertext unchanged)?
However I tested that it captures all matches whatever the regex is.
   
   submatch() only works inside a substitute() call or inside a :substitute 
   command (:help sub-replace-expression). It says this explicitly in :help 
   submatch(). In the future, please read the help topics on the functions 
   you are using before posting to the list.
   
   In order to use the matched text, you can try matchstr() or matchlist() 
   instead. Again, had you read the help for match(), you would have been 
   directed to these functions.
  
  yes Ben,
  What do you think that I haven't read the help?
  I know that submatch() works only in a substitute command but that was not 
  my question.
  I asked if it is a bit dangerous to use submatch() to capture matches 
  because it does a substitute in the text. However it seems to capture all, 
  whatever regex.
  
  And I've read also about match(), but not everything is so easy for me as 
  it is for you as you are a longtime user ;)
 
 My apologies, I must have misunderstood your question about submatch(). I 
 thought you had not read the help because:
 
 1. I thought you were trying to use submatch() with a match() or matchend() 
 call, since you did not mention using substitute()
 2. You did not seem aware of the optional 4th argument to match() and 
 matchend() which is documented in the help
 3. You did not seem aware of matchstr() or matchlist(), which are linked from 
 the help topic for match()
 
 submatch() does not do any substitute by itself. It is as way to access a 
 captured group in the replace text for a regular expression applied using the 
 substitute() function, or the :substitute command, either of which can be 
 manipulated to not actually make any textual changes.

No problem.
ad 1) yes you're right I didn't mention it but I thought it was clear that I 
mentioned submatch() as alternative of match(),matchend()
ad 2) you're right. I was not aware of the 4th argument to match() and 
matchend()
ad 3) I know them. I often use matchstr().

I didn't know that submatch() doesn't do a substitute itself.
Yesterday I created a function which captures now what I want to capture using 
submatch() but I noted that the buffer is modified every time I capture the 
matches (using submatch()).

Btw.. thank you for your answers. I learn a lot of your replies.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: matchend() and \zs

2012-04-19 Thread rameo
On Thursday, April 19, 2012 1:09:10 PM UTC+2, jott...@googlemail.com wrote:
 Hi,
 
 rameo wrote:
  My file - first line:
  an  91.010 System.-sep010-   Nop
  
  I want to copy all numbers after -sep
  echo match(getline(1), 'sep\zs\d\+\ze-')
  gives 23 as output. 
  All ok.
  
  but
  echo matchend(getline(1), 'sep\zs\d\+\ze-', 23)
  gives -1 as output.
  Why?
 
 because the 23 that was returned from match() is the position of the
 first digit, not the position of 'sep'. Thus you try to find
 'sep\zs\d\+\ze-' in a string that for matchend() seems to consist only
 of
 
   010-   Nop
 
 
 Regards,
 J�rgen
 
 -- 
 Sometimes I think the surest sign that intelligent life exists elsewhere
 in the universe is that none of it has tried to contact us. (Calvin)

Thanks Jurgen,

I use match() and matchend() to copy search matches to the clipboard
or remove them out of the text.

What can I do to make match() and matchend() work in order to copy p.e. the 
numbers after -sep?

Regards,
Raimond

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Temporary stop Relative Line number where it is.

2012-04-12 Thread rameo
I like Relative Line number (rnu) and use it often.
But when something is not visible in my vim window I have to scroll down and 
Relative Line numbers changes with it.

Sometimes when I write functions I receive error messages; error at line .. and 
I have to count how many lines are between the top of the function to the line 
of the error message.

It would be nice to temporary hold/stop Relative Line numbers where it is.
p.e. to set line 0 at the top of the function and keep it there till I need 
it.

Is there a way to hold on Relative Line number temporary?
(Hope I made myself clear)

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: match and matchend with a negative lookbehind

2012-04-06 Thread rameo
Hi Ben and John,

Thank you for your answers.

Ben,
Yes I'm talking about a simple / search 
Sorry that I didn't add an example.
Please see the example in John example.
This is exactly what I've done and noted.

John,
Yes, that's what I getting.
I had never seen such a strange behavior with match() and matchend()



-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: match and matchend with a negative lookbehind

2012-04-06 Thread rameo
On Friday, April 6, 2012 5:04:19 PM UTC+2, Ben Fritz wrote:
 On Thursday, April 5, 2012 10:13:55 PM UTC-5, John Little wrote:
  On Friday, April 6, 2012 10:02:48 AM UTC+12, Ben Fritz wrote:
   Please give the EXACT command you ran...
  
  Perhaps this script will illustrate:
  
  let s = '-2 3-4-5-6-7-8'
  let p = '\([0-9-]\@!-\)\?\d[0-9]*'
  let [start, end] = [0, 0]
  while 1
  let start = match(s, p, end)
  let end   = matchend(s, p, end)
  if start == -1
  break
  endif
  echo s[start : end-1]
  endwhile
  
  I get:
  
  -2
  3
  -4
  -5
  -6
  -7
  -8
  
  It would appear that using the third parameter to match() and matchend(), 
  the match is done as if on a substring starting at the parameter, so the 
  look behind assertion does not see what's there in the original string.
  
  This is unlike searching in a buffer; the look behind assertion does look 
  behind the start position of the search. Rameo, is this what you're getting 
  at?
  
 
 I think you've analyzed it perfectly! Looking closer at the help for match(), 
 I see:
 
   For a String, if {start}  0 then it is like the string starts
   {start} bytes later, thus ^ will match at {start}.  Except
   when {count} is given, then it's like matches before the
   {start} byte are ignored
 
 So with only 3 arguments, from this help text, I would expect exactly the 
 results given, for the reason given.
 
 However, this gave me a hint to fix the problem. With a minor tweak:
 
let s = '-2 3-4-5-6-7-8'
 let p = '\([0-9-]\@!-\)\?\d[0-9]*'
 let [start, end] = [0, 0]
 while 1
  count=1 to ignore previous matches rather than making the string
  start at a new place
 let start = match(s, p, end, 1)
 let end   = matchend(s, p, end, 1)
 if start == -1
 break
 endif
 echo s[start : end-1]
 endwhile
 
 It works as intended. With this script, I get:
 
 -2
 3
 4
 5
 6
 7
 8

Works great!
I adapted it in the function copymatches which I once found on wikia.com 
http://vim.wikia.com/wiki/Copy_the_search_results_into_clipboard 
and it works.
Hope it will work in all documents ;)


-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


match and matchend with a negative lookbehind

2012-04-05 Thread rameo
I noted a strange behavior with match and matchend when I use a regex with a 
negative lookbehind.

p.e. 
text in document:

  -2 3-4-5-6-7-8

search string: \([0-9-]\@!-\)\?\d[0-9]*
it highights -2 3 4 5 6 7 8 (as I aspected)

but when I check the match and matchend in order to copy the matches, it does 
include the - between 3-4 4-5 5-6 6-7 7-8
Does match and matchend not work with a negative lookbehind?

(please see attachment if the search string doesn't show up correct)

 

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
attachment: match-matchend.jpg

Re: Horizontal Ruler in interface?

2012-03-27 Thread rameo
On Sunday, March 25, 2012 12:21:43 PM UTC+2, coot_. wrote:
   You received this message from the vim_use maillist.
   Do not top-post! Type your reply below the text you are replying to.
   For more information, visit http://www.vim.org/maillist.php
  
  If you don't want the first line this should work for you:
  nmap \ru :2new +set\ buftype=nofile\ nomod RulerCR:%d 
  _CR8i123456789*EscCR:winc jCR
  
  If you want the ruler to be longer change 8 to a higher value.
  
  Best,
  Marcin
 
 Small update (the buffer might have just one line):
 nmap \ru :1new +set\ buftype=nofile\ nomod RulerCR:%d 
 _CR8i123456789*EscCR:winc jCR
 
 Best,
 Marcin


Thank you Marcin + Christian,
Now I understand what the 1st line was: the decimals.
However they were not places at the correct place

This is what I see when I use the 2 line version:
 1 2 3 4 5 6 7 8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
 

This is what it has to be (isn't it?:
 1 2 3 4 5 6 7 8
12345678901234567890123456789012345678901234567890123456789012345678901234567890
 
How can I change the 2 line version in order to obtain above result?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Horizontal Ruler in interface?

2012-03-26 Thread rameo
On Sunday, March 25, 2012 12:21:43 PM UTC+2, coot_. wrote:
 On 11:16 Sun 25 Mar , Marcin Szamotulski wrote:
  On 03:00 Sun 25 Mar , rameo wrote:
   On Saturday, March 24, 2012 2:22:26 PM UTC+1, volker@gmx.de wrote:
On Sat, 24 Mar 2012 14:06:30 +0100
Christian Brabandt wrote:

 Hi rameo!
 
 On Fr, 23 M�r 2012, rameo wrote:
 
  I would like to know if it is possible in a future gvim release to 
  add
  a horizontal ruler like the actual vertical ruler (set ruler)
  (p.e. set:coruler -- set column ruler)
  
  I would like to see always the columnnumbers
  123456789*123456789*123456789* etc
  
  I know there is a plugin to add a horizontal ruler in the text 
  (which
  I use often) but putting it in the text moves the text (changes the
  line numbers of the text).
  
  I also added the column number info in the statusbar but in this 
  case
  I have to click on every column to see where I'am
 
 can't you do something like this:
 ~$ cat columns.vim
 setl scrollbind
 abo sp +enew
 call setline(1,repeat('1234567890',100))
 let l:stl=%#Normal#.repeat(' ',winwidth(0))
 res 1
 setl scrollbind nomod buftype=nofile
 wincmd p
 ~$
 
 That opens a new split window above your current window, put some 
 numbers in it and scrollbind it to your original window.
 
 regards,
 Christian
 
 -- 
 You received this message from the vim_use maillist.
 Do not top-post! Type your reply below the text you are replying to.
 For more information, visit http://www.vim.org/maillist.php

Found this in my _vimrc:

nmap \ru   :2new RulerCR8i1234567890EscO12345678Esc:s/\d/ 
/gCR:set nomodCR:winc jCR


regards,
Volker
   
   Thank you Christian, Marcin and Volker for your answers.
   
   Volker, I like the ruler in a buffer. 
   What I see is this:
   
1 2 3 4 5 6 7 8
   12345678901234567890123456789012345678901234567890123456789012345678901234567890
   
   I changed the 0 to * in order to better see the decades but why the first 
   line? 
   What do I have to do to remove the first line?
   
   Best,
   Rameo
   
   -- 
   You received this message from the vim_use maillist.
   Do not top-post! Type your reply below the text you are replying to.
   For more information, visit http://www.vim.org/maillist.php
  
  If you don't want the first line this should work for you:
  nmap \ru :2new +set\ buftype=nofile\ nomod RulerCR:%d 
  _CR8i123456789*EscCR:winc jCR
  
  If you want the ruler to be longer change 8 to a higher value.
  
  Best,
  Marcin
 
 Small update (the buffer might have just one line):
 nmap \ru :1new +set\ buftype=nofile\ nomod RulerCR:%d 
 _CR8i123456789*EscCR:winc jCR
 
 Best,
 Marcin

Happy to have found a solution.
Thank you Marcin :)

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Horizontal Ruler in interface?

2012-03-25 Thread rameo
On Saturday, March 24, 2012 2:22:26 PM UTC+1, volker@gmx.de wrote:
 On Sat, 24 Mar 2012 14:06:30 +0100
 Christian Brabandt wrote:
 
  Hi rameo!
  
  On Fr, 23 Mär 2012, rameo wrote:
  
   I would like to know if it is possible in a future gvim release to add
   a horizontal ruler like the actual vertical ruler (set ruler)
   (p.e. set:coruler -- set column ruler)
   
   I would like to see always the columnnumbers
   123456789*123456789*123456789* etc
   
   I know there is a plugin to add a horizontal ruler in the text (which
   I use often) but putting it in the text moves the text (changes the
   line numbers of the text).
   
   I also added the column number info in the statusbar but in this case
   I have to click on every column to see where I'am
  
  can't you do something like this:
  ~$ cat columns.vim
  setl scrollbind
  abo sp +enew
  call setline(1,repeat('1234567890',100))
  let l:stl=%#Normal#.repeat(' ',winwidth(0))
  res 1
  setl scrollbind nomod buftype=nofile
  wincmd p
  ~$
  
  That opens a new split window above your current window, put some 
  numbers in it and scrollbind it to your original window.
  
  regards,
  Christian
  
  -- 
  You received this message from the vim_use maillist.
  Do not top-post! Type your reply below the text you are replying to.
  For more information, visit http://www.vim.org/maillist.php
 
 Found this in my _vimrc:
 
 nmap \ru   :2new RulerCR8i1234567890EscO12345678Esc:s/\d/ 
 /gCR:set nomodCR:winc jCR
 
 
 regards,
 Volker

Thank you Christian, Marcin and Volker for your answers.

Volker, I like the ruler in a buffer. 
What I see is this:

 1 2 3 4 5 6 7 8
12345678901234567890123456789012345678901234567890123456789012345678901234567890

I changed the 0 to * in order to better see the decades but why the first line? 
What do I have to do to remove the first line?

Best,
Rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Horizontal Ruler in interface?

2012-03-24 Thread rameo
Hi Ben,

Yes I was thinking of a horizontal ruler with numbers as in p.e.
wordpad, psp ultraedit and other editors.

Agree, that I had to post the message in vim-dev.

Why I need this feature?
I often use the  /%columnnrC   in code.
I often do column operation p.e. delete from column to column (p.e.
around a text block in a table) and I often have to look in which
column the text is written before to do the operation.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Horizontal Ruler in interface?

2012-03-23 Thread rameo
I would like to know if it is possible in a future gvim release to add
a horizontal ruler like the actual vertical ruler (set ruler)
(p.e. set:coruler -- set column ruler)

I would like to see always the columnnumbers
123456789*123456789*123456789* etc

I know there is a plugin to add a horizontal ruler in the text (which
I use often) but putting it in the text moves the text (changes the
line numbers of the text).

I also added the column number info in the statusbar but in this case
I have to click on every column to see where I'am

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


h j k l -- keys

2011-12-16 Thread rameo
I just want to know why Vim developers (and other software) have
chosen the h j k l keys for left, down, up and right and not the j
k l ; keys?

I type with ten fingers and with touch typing, the right hand is on
the j k l ; keys.

To go to left I have to switch my forefinger from the j to the
h.
I checked other national keyboards, they are almost all the same as
the US keyboard.

I noted that other software as well use the j and k keys to go
down and go up.
What is the reason for it?

ps: I switched the keys h j k l to my j k l ; keys but I noted
that other software use the j and k keys to move up and down so I
switched back to default.



-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Deleting duplicate lines _without_ sorting

2011-07-08 Thread rameo
Have you checked the one I mentioned above?

The one above is working in menu-vim (the pipe symbol has to be
escaped in menu.vim)
To let it work in the commandline the escape before the pipe symbol
has to be removed:

g/^/kl |if search('^'.escape(getline('.'),'\.*[]^$/').'$','bW') |'ld

The only problem I've found after using it for a few weeks, that it
removes
also the double empty lines.

(I would be happy also to know what the code exactly does)

ps: I added in my menu let @/ = '' to avoid after-highlighting.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Deleting duplicate lines _without_ sorting

2011-07-07 Thread rameo
Hi Stefan,

I found this one a few weeks ago.
It does the job without sorting.

:g/^/kl \|if search('^'.escape(getline('.'),'\.*[]^$/').'$','bW')
\|'ld

Regards,
Rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: remove all except pattern

2011-06-20 Thread rameo
Hi TIm,

this is the output of the text when I use your command %s/\w\+/
\=submatch(0)=~'hello'?submatch(0):'' :

hello this is an example, hello to everybody
 hello

this is the output of the text when I use your command %s/\w\+\W*/
\=submatch(0)=~'hello'?submatch(0):'' :

hello this is an example, hello to everybody
hello

Rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: remove all except pattern

2011-06-20 Thread rameo
Thank you, yes now it works with hello.

It doesn't work p.e. with emails.
This is my command to search emails:
\([A-Z0-9+_.-]\+@\([A-Z0-9-]\+\.\)\+[A-Z]\{2,6}\)

p.e.

myem...@mydomain.com hello myotherem...@mydomain.com
hello mylatestem...@mydomain.co.uk

Putting that in your command gives an empty output (it removes the
emails).

Regards,
Rameo


On Jun 20, 6:19 pm, Tim Chase v...@tim.thechases.com wrote:

 Ah...it looks like it was missing the g flag at the end:

   :%s/\w\+\W*/\=submatch(0)=~'hello'?submatch(0):''/g

 Something must not have copied over when I pasted it into the
 original email.


No problem

 -tim

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: remove all except pattern

2011-06-20 Thread rameo
Hi,

Thank you for replying.

I use this command to put all matches on a new line:
:let @a=CR:%s//\=setreg('A', submatch(0), 'l')/gCR:%d _CR:put
aCR:0d _CR

I can't find out how to keep them on the same line.

I tried this command:
%s/\(^\|\(hello\)\@=\).\{-}\($\|hello\)\@=//g

It works with text but not with p.e. emails:
it removes the last character of every email. I tried many things to
change the command but I suppose I don't understand enough about
vimscript to find the solution.

Regards, R.

On Jun 20, 7:14 pm, Tim Chase v...@tim.thechases.com wrote:
 On 06/20/2011 11:35 AM, rameo wrote:

  This is my command to search emails:
  \([A-Z0-9+_.-]\+@\([A-Z0-9-]\+\.\)\+[A-Z]\{2,6}\)

  p.e.

  myem...@mydomain.com hello myotherem...@mydomain.com
  hello mylatestem...@mydomain.co.uk

  Putting that in your command gives an empty output (it removes the
  emails).

 Ah...with that context, I might try to approach the problem
 differently.  If you don't mind newlines being added when more
 than one email was on the same line, I might do something like

   :%s/\([A-Z0-9+_.-]\+@\([A-Z0-9-]\+\.\)\+[A-Z]\{2,6}\)/\r\r/g
   :v/^\([A-Z0-9+_.-]\+@\([A-Z0-9-]\+\.\)\+[A-Z]\{2,6}\)$/d

 The first one puts each email address alone on a line, and the
 second one deletes all lines that don't have an email address on
 them.  Given your example, one might also have to add \c to
 your pattern to make it case-insensitive (your regexp only finds
 uppercase email addresses).

 If you need to keep emails on the same line back together, it
 might take a little more work.

 -tim

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


remove all except pattern

2011-06-19 Thread rameo
Hi,

I would like to know how to remove everything except pattern.

p.e.

hello this is an example, hello to everybody
example hello

 I do a search for hello

My output has to be:

hellohello
hello

or

hello hello
hello

using :%s//\=setreg('A', submatch(0), 'l')/g
puts every hello on a new line.
I don't want to put them on a new line.

I checked also the match() function but I haven't found out how to use
it.

Anyone has an idea how to resolve my problem?

Rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim: reference to another menu line command

2011-06-18 Thread rameo
Anyone has an idea how to resolve my question?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim: reference to another menu line command

2011-06-18 Thread rameo
I believe that I have found it.
it is the C-r/ command

let delmatches = ':g/C-r//d C'
an 98.002Edit\ Menu.Delete\ Matches\:exe delmatchesCR
--- doesn't work (E486 pattern not found: C-r)

an 98.002Edit\ Menu.Delete\ Matches\:g/C-r//d CCR
--- does work.

Any idea?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim: reference to another menu line command

2011-06-18 Thread rameo
Thank you very much.
When I read that I had to put the menu command inside the :execute
I placed the :exe before delmatches (I thought the menu command was
the command in the menu) and not before the whole menu command.

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Switch Horizontal/Vertical View in Vimdiff

2011-06-17 Thread rameo
On Jun 14, 10:07 am, Roy Fulbright rfulb...@hotmail.com wrote:
 How can I switch between horizontal and vertical view of vimdiff display 
 without exiting and re-running vimdiff
with the other (horizontal/vertical) display option?

Hi Roy,

I use these 2:

Vertical Split to Horizontal Split:  C-WtC-WK
Horizontal Split to Vertical Split:  C-WtC-WH

Regards,
rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


menu.vim: reference to another menu line command

2011-06-17 Thread rameo
I can't find out how to refer to another menu line in menu.vim

p.e.

an95.038 Search\ Menu.Do\ command\ 1\   :a command of 150
characters

an98.002 Edit\ Menu.Do\ command\ 2\:my command1


How can I refer to command 1 in command 2 without rewriting the whole
commandline of command 1?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim: reference to another menu line command

2011-06-17 Thread rameo
On Jun 17, 9:56 am, Tony Mechelynck antoine.mechely...@gmail.com
wrote:
 On 17/06/11 09:40, rameo wrote:

  I can't find out how to refer to another menu line in menu.vim

  p.e.

  an95.038Search\ Menu.Do\ command\ 1\   :a command of 150
  characters

  an98.002Edit\ Menu.Do\ command\ 2\:my command1

  How can I refer to command 1 in command 2 without rewriting the whole
  commandline of command 1?

 maybe
 let menutext1 = ':a command of 150 characters'
 exe 'anoremenu 95.38 Search.Do\ command\ 1'
 \ . menutext1
 exe 'anoremenu 98.2 Edit.Do\ command\ 2\'
 \ . menutext1
 ?

 see
 :help :let
 :help :exe

 HTH,
 Tony.
 --
 If I had any humility I would be perfect.
 -- Ted Turner

Dear Tony,

This doesn't seem to work (or I did something wrong).

p.e. command 1 = :%s/foo/bar/g

let command_1 = ':%s/foo/bar/g'
an 98.002Edit\ Menu.Do\ command\ 2\:command_1  ??

Regards




-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim: reference to another menu line command

2011-06-17 Thread rameo
On Jun 17, 1:31 pm, Christian Brabandt cbli...@256bit.org wrote:
 Hi rameo!

 On Fr, 17 Jun 2011, rameo wrote:



  This doesn't seem to work (or I did something wrong).

  p.e. command 1 = :%s/foo/bar/g

  let command_1 = ':%s/foo/bar/g'
  an 98.002Edit\ Menu.Do\ command\ 2\:command_1  ??

 You need to evaluate the variable first. This is done using the :exe
 command.

 See also this question from the 
 faq:http://vimhelp.appspot.com/vim_faq.txt.html#faq-25.13

 regards,
 Christian

I can't make this work.

This is my command:
let deletematches1 = ':call SIDCopyMatchesLines(%,)CR:let @c =
CR:g/C-r//d CCR:let @*=@cCR'

this is my menu:
an 98.002Edit\ Menu.Delete\ Matches\:exe
deletematches1 ??

Tried everything without success

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim: reference to another menu line command

2011-06-17 Thread rameo
On Jun 17, 2:33 pm, Christian Brabandt cbli...@256bit.org wrote:
 Hi rameo!

 On Fr, 17 Jun 2011, rameo wrote:



  On Jun 17, 1:31 pm, Christian Brabandt cbli...@256bit.org wrote:
   Hi rameo!

   On Fr, 17 Jun 2011, rameo wrote:

This doesn't seem to work (or I did something wrong).

p.e. command 1 = :%s/foo/bar/g

let command_1 = ':%s/foo/bar/g'
an 98.002Edit\ Menu.Do\ command\ 2\:command_1  ??

   You need to evaluate the variable first. This is done using the :exe
   command.

   See also this question from the 
   faq:http://vimhelp.appspot.com/vim_faq.txt.html#faq-25.13

   regards,
   Christian

  I can't make this work.

  This is my command:
  let deletematches1 = ':call SIDCopyMatchesLines(%,)CR:let @c =
  CR:g/C-r//d CCR:let @*=@cCR'

  this is my menu:
  an 98.002Edit\ Menu.Delete\ Matches\:exe
  deletematches1 ??

  Tried everything without success

 You should use :exe 'an 98.002Edit\ Menu.Delete\ Matches' deletematches1

 regards,
 Christian
 --
 Kunst: Eine andere Natur, auch geheimnisvoll, aber
 verst ndlicher; denn sie entspringt aus dem Verstande.
 -- Goethe, Maximen und Reflektionen, Nr. 1144

Still doesn't work.
Something wrong with my variable declaration (let
deletematches1.)?

The command is correct (works when I add it to the menu) but maybe I
have to change something inside the variable declaration. (Can I use
CR inside the declaration?)

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim: reference to another menu line command

2011-06-17 Thread rameo
Yes it gives the output what I want (in the commandline) but not the
output what I want as it gave before. Can't find the reason. I send
you my function also:

  function! s:CopyMatchesLines(type,kind)
   let posinit = getpos(.)

   if a:type == ','
let StartPosition = line(')
let EndPosition = line(')
   else
let StartPosition = 1
let EndPosition = line($)
call cursor(1,1)
   endif

   let cnt = 0
   let hits = []
   let snum = search(@/, 'cW')
   while snum  0
let enum = search(@/, 'ceW')
if snum = StartPosition  enum = EndPosition
 call extend(hits, getline(snum, enum))
 let cnt += 1
 normal! $
endif
let snum = search(@/, 'W')
   endwhile

   if cnt  0
if a:kind == 
 let @+ = join(hits, \n) . \n
elseif a:kind == append
 let @+ .= join(hits, \n) . \n
elseif a:kind == register
 let @B = @+
endif
   endif

   call cursor(posinit[1], posinit[2])
   if cnt == 0
echomsg No hits
   else
if a:kind == 
 echomsg cnt 'lines copied to clipboard.'
elseif a:kind == append
 echomsg cnt 'lines appended to clipboard.'
elseif a:kind == register
 echomsg cnt 'lines appended to Register B.'
endif
   endif
  endfunction

Can you please give it a try?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax coloring

2011-04-16 Thread rameo
On Apr 15, 10:42 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 00:32:32 16 April 2011, Saturday
 by rameo:

  Is this the correct one?

  augroup SaveRestoreSessions
  autocmd!
  autocmd VimEnter * nested source D:\Session.vim
  autocmd VimLeave * call ClearArgs()
  autocmd VimLeave * nested mksession! D:\Session.vim
  augroup END

  function! ClearArgs()
    if argc() != 0
     argdel *
    endif
  endfunction

 Previous variant was also correct (working), but strange. It is better, but 
 why
 don't you use this instead:

     let sesfile='D:\Session.vim'
     augroup SaveRestoreSessions
         autocmd!
         autocmd VimEnter * nested :source `=sesfile`
         autocmd VimLeave * :if argc() | argdel * | endif | mksession! 
 `=sesfile`
     augroup END

 Original message:







  On Apr 15, 10:02 pm, ZyX zyx@gmail.com wrote:
   Reply to message «Re: syntax coloring»,
   sent 23:29:29 15 April 2011, Friday

   by rameo:
I found a new way to integrate argdel:

augroup SaveRestoreSessions
autocmd!
autocmd VimEnter * nested source $VIM\vimfiles\sessions\Session.vim
autocmd VimLeave * call MakeSession()
autocmd VimLeave * nested mksession! $VIM\vimfiles\sessions
\Session.vim
augroup END

function! MakeSession()
  if argc() != 0
    execute 'argdel *'
  endif
endfunction

   You are doing a strange things again:
   1. You should either rename `MakeSession' to `ClearArgs' (because
   `MakeSession' will confuse somebody (maybe even you) who will read you
   code as it does not makes any sessions) or, better, move `mksession!'
   call inside a function. 2. Why are you again writing `execute'?
   3. You don't need `nested' for mksession, you need it only for VimEnter.
   4. Never write anything user-specific to application folder, it may be
   purged by application update, removed by the package manager (if any) or
   uninstaller, or you may have to create more then one user on the
   machine.

   Original message:
On Apr 15, 9:14 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 23:02:40 15 April 2011, Friday

 by rameo:
  Tnx.. this is what I added:
  autocmd VimLeave * if argc() != 0 | 'argdel *' endif

 Reread help. This is false: you should not use strikes around `argdel
 *' and you should have bar before `endif' just like you have before
 `argdel'.

  I noted that (even after a buffer delete :bd) certain buffers do
  remain in session.vim
  I had no troubles anymore after removing argdel * and troubles
  again after having changed the script as above.

 I know this issue. In this case you should have `argdel' before
 mksession, I don't get why you have it *after*.

 Original message:
  On Apr 15, 8:55 pm, ZyX zyx@gmail.com wrote:
   Reply to message «Re: syntax coloring»,
   sent 21:39:21 15 April 2011, Friday

   by rameo:
Still have a little problem.
I had also a VimLeave argdel command in my _vimrc.

Is this correct?:

augroup SaveRestoreSessions
autocmd!
autocmd VimEnter * nested source D:\session.vim
autocmd VimLeave * nested mksession! D:\session.vim
autocmd VimLeave *  if argc() != 0 | exe 'argdel *'
augroup END

btw tnx. for your script.

   1. Missing endif.
   2. You don't need `exe' here.
   3. I don't get why do you need this command at all.

   Original message:
On Apr 15, 5:43 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 19:13:18 15 April 2011, Friday

 by rameo:
  Please let me ask you one more question...
  How do you close this session and reopens a custom one
  (happens once in a while)?

 I don't use one continious vim session and don't load any
 sessions at vim startup (the `just the same error' meant that
 I used an autocommand in a similar way and got the same
 error, not that I used the same code). Instead I create a
 new session file almost each time when vim exits and load
 one of created sessions at vim startup: 1. due to virtual
 desktops I almost never close any of my projects' windows,
 2. I use vim to quickly edit something from command-line,
 loading any sessions will discard the most significant part
 of vim invocation arguments for this use-case.
 Saving session at vim exit is for the case when I have to
 reload vim (mostly plugin or kernel updates).
 Here is my code:

     ▶2 mksession
     if has('mksession')
         function s:InitSes()
             let sesdir=expand('~/.vimsessions')
             if !isdirectory(sesdir)
                 call mkdir(expand(sesdir), , 0700)
             endif
             let sesfile=os

syntax coloring

2011-04-15 Thread rameo
When I start VIM it shows my tabs and reloads my buffers from the last
time.

I use a session to do this.

au VimEnter * exe so d:\\Session.vim
au VimLeave * exe 'mksession! d:\\Session.vim'

My reopened files do not have syntax coloring.
I have to do :e in every file where I need syntax coloring to view
syntax coloring.

I know that I can add localoptions in sessionoptions but this slows
down my vim (I noted that it uses 20-25% more CPU). Without
localoptions my vim is much faster.

How do you resolve this?
Don't you use sessions?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax coloring

2011-04-15 Thread rameo

On Apr 15, 11:17 am, Tony Mechelynck antoine.mechely...@gmail.com
wrote:
 On 15/04/11 09:06, rameo wrote:





  When I start VIM it shows my tabs and reloads my buffers from the last
  time.

  I use a session to do this.

  au VimEnter * exe so d:\\Session.vim
  au VimLeave * exe 'mksession! d:\\Session.vim'

  My reopened files do not have syntax coloring.
  I have to do :e in every file where I need syntax coloring to view
  syntax coloring.

  I know that I can add localoptions in sessionoptions but this slows
  down my vim (I noted that it uses 20-25% more CPU). Without
  localoptions my vim is much faster.

  How do you resolve this?
  Don't you use sessions?

 try adding either

         syntax on

 or (near the top)

         runtime vimrc_example.vim

 (it's not necessary to use both) to your vimrc (or make one if you don't
 yet have one, using

         :e ~/_vimrc

 inside Vim).

 Best regards,
 Tony.
 --
 Dimensions will always be expressed in the least usable term.
 Velocity, for example, will be expressed in furlongs per fortnight.

Hello Tony,

I already had syntax on near the top of my _vimrc file.

...
I noted that vim doesn't detect filetypes at startup when files are
restored (by sourcing a session).

I have
filetype on
filetype plugin on
written in my _vimrc

Best regards,
Rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax coloring

2011-04-15 Thread rameo


On Apr 15, 11:31 am, rameo rai...@gmail.com wrote:
 On Apr 15, 11:17 am, Tony Mechelynck antoine.mechely...@gmail.com
 wrote:





  On 15/04/11 09:06, rameo wrote:

   When I start VIM it shows my tabs and reloads my buffers from the last
   time.

   I use a session to do this.

   au VimEnter * exe so d:\\Session.vim
   au VimLeave * exe 'mksession! d:\\Session.vim'

   My reopened files do not have syntax coloring.
   I have to do :e in every file where I need syntax coloring to view
   syntax coloring.

   I know that I can add localoptions in sessionoptions but this slows
   down my vim (I noted that it uses 20-25% more CPU). Without
   localoptions my vim is much faster.

   How do you resolve this?
   Don't you use sessions?

  try adding either

          syntax on

  or (near the top)

          runtime vimrc_example.vim

  (it's not necessary to use both) to your vimrc (or make one if you don't
  yet have one, using

          :e ~/_vimrc

  inside Vim).

  Best regards,
  Tony.
  --
  Dimensions will always be expressed in the least usable term.
  Velocity, for example, will be expressed in furlongs per fortnight.

 Hello Tony,

 I already had syntax on near the top of my _vimrc file.

 ...
 I noted that vim doesn't detect filetypes at startup when files are
 restored (by sourcing a session).

 I have
 filetype on
 filetype plugin on
 written in my _vimrc

 Best regards,
 Rameo

I restore my sessions using VimEnter/VimLeave -- see 1st message.

I just checked what it does when I do it manually..
Syntax works. (maybe because it uses the sessionoptions localoptions
or options)


-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax coloring

2011-04-15 Thread rameo
On Apr 15, 1:43 pm, ZyX zyx@gmail.com wrote:
 Reply to message «syntax coloring»,
 sent 11:06:33 15 April 2011, Friday
 by rameo:

  When I start VIM it shows my tabs and reloads my buffers from the last
  time.

  I use a session to do this.

  au VimEnter * exe so d:\\Session.vim
  au VimLeave * exe 'mksession! d:\\Session.vim'

 You have made just the same mistake as me some time ago: all filetype-related
 files are loaded using an autocommand, but by default no autocommands are
 allowed when you are executing an autocommand, so you should add `nested' just
 after the pattern. By the way, why do you use `exe'? The following works as
 well:
     augroup SaveRestoreSessions
         autocmd!
         autocmd VimEnter * nested source D:\session.vim
         autocmd VimLeave * nested mksession! D:\session.vim
     augroup END

 See `:h autocmd-nested' for more details.

 Original message:



  When I start VIM it shows my tabs and reloads my buffers from the last
  time.

  I use a session to do this.

  au VimEnter * exe so d:\\Session.vim
  au VimLeave * exe 'mksession! d:\\Session.vim'

  My reopened files do not have syntax coloring.
  I have to do :e in every file where I need syntax coloring to view
  syntax coloring.

  I know that I can add localoptions in sessionoptions but this slows
  down my vim (I noted that it uses 20-25% more CPU). Without
  localoptions my vim is much faster.

  How do you resolve this?
  Don't you use sessions?



  signature.asc
  1KViewDownload

Great! It does work.
Thanks a lot!

Please let me ask you one more question...
How do you close this session and reopens a custom one (happens once
in a while)?

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: syntax coloring

2011-04-15 Thread rameo
On Apr 15, 8:55 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 21:39:21 15 April 2011, Friday
 by rameo:

  Still have a little problem.
  I had also a VimLeave argdel command in my _vimrc.

  Is this correct?:

  augroup SaveRestoreSessions
  autocmd!
  autocmd VimEnter * nested source D:\session.vim
  autocmd VimLeave * nested mksession! D:\session.vim
  autocmd VimLeave *  if argc() != 0 | exe 'argdel *'
  augroup END

  btw tnx. for your script.

 1. Missing endif.
 2. You don't need `exe' here.
 3. I don't get why do you need this command at all.

 Original message:







  On Apr 15, 5:43 pm, ZyX zyx@gmail.com wrote:
   Reply to message «Re: syntax coloring»,
   sent 19:13:18 15 April 2011, Friday

   by rameo:
Please let me ask you one more question...
How do you close this session and reopens a custom one (happens once
in a while)?

   I don't use one continious vim session and don't load any sessions at
   vim startup (the `just the same error' meant that I used an autocommand
   in a similar way and got the same error, not that I used the same code).
   Instead I create a new session file almost each time when vim exits
   and load one of created sessions at vim startup:
   1. due to virtual desktops I almost never close any of my projects'
   windows, 2. I use vim to quickly edit something from command-line,
   loading any sessions will discard the most significant part of vim
   invocation arguments for this use-case.
   Saving session at vim exit is for the case when I have to reload vim
   (mostly plugin or kernel updates).
   Here is my code:

       ▶2 mksession
       if has('mksession')
           function s:InitSes()
               let sesdir=expand('~/.vimsessions')
               if !isdirectory(sesdir)
                   call mkdir(expand(sesdir), , 0700)
               endif
               let sesfile=os#JoinPath(sesdir, '.sessions.lst')
               let sessions=[]
               if filereadable(sesfile)
                   let sessions+=readfile(sesfile, 'b')
                   while !empty(sessions)  empty(sessions[-1])
                       call remove(sessions, -1)
                   endwhile
               endif
               let sessplitted=map(copy(sessions),
                           \'split(v:val, ''\v%(\\@!%()*)@=,'')')
               let sesdirs=map(copy(sessplitted),
   '((empty(v:val))?():(v:val[0]))') let sesfiles=map(copy(sessplitted),
   '((empty(v:val))?([]):(v:val[1:]))') execute cd
   .fnameescape(resolve(fnamemodify('.', ':p'))) let
   curdir=escape(fnamemodify('.', ':p'), ',\')
               return [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]
           endfunction
           let s:_functions['s:InitSes']=function('s:InitSes')
           function s:MakeSession()
               let [sesdir, sesfile, sessions, sesdirs, sesfiles,
   curdir]=s:InitSes() let files=sort(map(filter(map(filter(range(1,
   bufnr('$')), \                        'getbufvar(v:val,
   bt)!=#help'), \                 'bufname(v:val)'),
                           \             'filereadable(v:val)'),
                           \    
    'escape(fnamemodify(resolve(fnamemodify(v:val, :p)), :~:.),
   ,\\)'))
               if empty(files)
                   return
               endif
               let sesstr=join([curdir]+files, ',')
               let sindex=index(sessions, sesstr)
               if sindex==-1
                   let sindex=index(sessions, '')
               endif
               if sindex==-1
                   let sesname=os#JoinPath(sesdir, len(sesdirs).'.vim')
                   call add(sessions, sesstr)
               else
                   let sesname=os#JoinPath(sesdir, sindex.'.vim')
                   let sessions[sindex]=sesstr
               endif
               execute 'mksession! '.fnameescape(sesname)
               call writefile(sessions, sesfile, 'b')
           endfunction
           let s:_functions['s:MakeSession']=function('s:MakeSession')
           function s:LoadSession(bang, ...)
               let [sesdir, sesfile, sessions, sesdirs, sesfiles,
   curdir]=s:InitSes() if a:0  string(+a:1)==#a:1  a:1len(sessions) 
   \!empty(sessions[a:1])
                   let dirsessions=[[+a:1, sesdirs[a:1], sessions[a:1]]]
               else
                   let dirsessions=filter(map(copy(sesdirs),
                               \              '[v:key, v:val,
   sessions[v:key]]'), \          'v:val[1]==#curdir'.
                               \                   ((a:0)?(' 
   v:val[2]=~?a:1'):(''))) endif
               if len(dirsessions)==1 || (!empty(dirsessions)  a:bang)
                   let sesid=dirsessions[0][0]
                   let sesname=os#JoinPath(sesdir, sesid.'.vim')
                   execute 'source '.fnameescape(sesname)
                   call delete(sesname)
                   if sesid==(len(sessions)-1)
                       call remove(sessions, -1

Re: syntax coloring

2011-04-15 Thread rameo
On Apr 15, 9:14 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 23:02:40 15 April 2011, Friday
 by rameo:

  Tnx.. this is what I added:
  autocmd VimLeave * if argc() != 0 | 'argdel *' endif

 Reread help. This is false: you should not use strikes around `argdel *' and 
 you
 should have bar before `endif' just like you have before `argdel'.

  I noted that (even after a buffer delete :bd) certain buffers do
  remain in session.vim
  I had no troubles anymore after removing argdel * and troubles again
  after having changed the script as above.

 I know this issue. In this case you should have `argdel' before mksession,
 I don't get why you have it *after*.

 Original message:



  On Apr 15, 8:55 pm, ZyX zyx@gmail.com wrote:
   Reply to message «Re: syntax coloring»,
   sent 21:39:21 15 April 2011, Friday

   by rameo:
Still have a little problem.
I had also a VimLeave argdel command in my _vimrc.

Is this correct?:

augroup SaveRestoreSessions
autocmd!
autocmd VimEnter * nested source D:\session.vim
autocmd VimLeave * nested mksession! D:\session.vim
autocmd VimLeave *  if argc() != 0 | exe 'argdel *'
augroup END

btw tnx. for your script.

   1. Missing endif.
   2. You don't need `exe' here.
   3. I don't get why do you need this command at all.

   Original message:
On Apr 15, 5:43 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 19:13:18 15 April 2011, Friday

 by rameo:
  Please let me ask you one more question...
  How do you close this session and reopens a custom one (happens
  once in a while)?

 I don't use one continious vim session and don't load any sessions at
 vim startup (the `just the same error' meant that I used an
 autocommand in a similar way and got the same error, not that I used
 the same code). Instead I create a new session file almost each time
 when vim exits and load one of created sessions at vim startup:
 1. due to virtual desktops I almost never close any of my projects'
 windows, 2. I use vim to quickly edit something from command-line,
 loading any sessions will discard the most significant part of vim
 invocation arguments for this use-case.
 Saving session at vim exit is for the case when I have to reload vim
 (mostly plugin or kernel updates).
 Here is my code:

     ▶2 mksession
     if has('mksession')
         function s:InitSes()
             let sesdir=expand('~/.vimsessions')
             if !isdirectory(sesdir)
                 call mkdir(expand(sesdir), , 0700)
             endif
             let sesfile=os#JoinPath(sesdir, '.sessions.lst')
             let sessions=[]
             if filereadable(sesfile)
                 let sessions+=readfile(sesfile, 'b')
                 while !empty(sessions)  empty(sessions[-1])
                     call remove(sessions, -1)
                 endwhile
             endif
             let sessplitted=map(copy(sessions),
                         \'split(v:val, ''\v%(\\@!%()*)@=,'')')
             let sesdirs=map(copy(sessplitted),
 '((empty(v:val))?():(v:val[0]))') let
 sesfiles=map(copy(sessplitted), '((empty(v:val))?([]):(v:val[1:]))')
 execute cd
 .fnameescape(resolve(fnamemodify('.', ':p'))) let
 curdir=escape(fnamemodify('.', ':p'), ',\')
             return [sesdir, sesfile, sessions, sesdirs, sesfiles,
 curdir] endfunction
         let s:_functions['s:InitSes']=function('s:InitSes')
         function s:MakeSession()
             let [sesdir, sesfile, sessions, sesdirs, sesfiles,
 curdir]=s:InitSes() let files=sort(map(filter(map(filter(range(1,
 bufnr('$')), \                        'getbufvar(v:val,
 bt)!=#help'), \                 'bufname(v:val)'),
                         \             'filereadable(v:val)'),
                         \    
  'escape(fnamemodify(resolve(fnamemodify(v:val, :p)), :~:.),
 ,\\)'))
             if empty(files)
                 return
             endif
             let sesstr=join([curdir]+files, ',')
             let sindex=index(sessions, sesstr)
             if sindex==-1
                 let sindex=index(sessions, '')
             endif
             if sindex==-1
                 let sesname=os#JoinPath(sesdir, len(sesdirs).'.vim')
                 call add(sessions, sesstr)
             else
                 let sesname=os#JoinPath(sesdir, sindex.'.vim')
                 let sessions[sindex]=sesstr
             endif
             execute 'mksession! '.fnameescape(sesname)
             call writefile(sessions, sesfile, 'b')
         endfunction
         let s:_functions['s:MakeSession']=function('s:MakeSession')
         function s:LoadSession(bang, ...)
             let

Re: syntax coloring

2011-04-15 Thread rameo
On Apr 15, 9:14 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 23:02:40 15 April 2011, Friday
 by rameo:

  Tnx.. this is what I added:
  autocmd VimLeave * if argc() != 0 | 'argdel *' endif

 Reread help. This is false: you should not use strikes around `argdel *' and 
 you
 should have bar before `endif' just like you have before `argdel'.

  I noted that (even after a buffer delete :bd) certain buffers do
  remain in session.vim
  I had no troubles anymore after removing argdel * and troubles again
  after having changed the script as above.

 I know this issue. In this case you should have `argdel' before mksession,
 I don't get why you have it *after*.

 Original message:







  On Apr 15, 8:55 pm, ZyX zyx@gmail.com wrote:
   Reply to message «Re: syntax coloring»,
   sent 21:39:21 15 April 2011, Friday

   by rameo:
Still have a little problem.
I had also a VimLeave argdel command in my _vimrc.

Is this correct?:

augroup SaveRestoreSessions
autocmd!
autocmd VimEnter * nested source D:\session.vim
autocmd VimLeave * nested mksession! D:\session.vim
autocmd VimLeave *  if argc() != 0 | exe 'argdel *'
augroup END

btw tnx. for your script.

   1. Missing endif.
   2. You don't need `exe' here.
   3. I don't get why do you need this command at all.

   Original message:
On Apr 15, 5:43 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 19:13:18 15 April 2011, Friday

 by rameo:
  Please let me ask you one more question...
  How do you close this session and reopens a custom one (happens
  once in a while)?

 I don't use one continious vim session and don't load any sessions at
 vim startup (the `just the same error' meant that I used an
 autocommand in a similar way and got the same error, not that I used
 the same code). Instead I create a new session file almost each time
 when vim exits and load one of created sessions at vim startup:
 1. due to virtual desktops I almost never close any of my projects'
 windows, 2. I use vim to quickly edit something from command-line,
 loading any sessions will discard the most significant part of vim
 invocation arguments for this use-case.
 Saving session at vim exit is for the case when I have to reload vim
 (mostly plugin or kernel updates).
 Here is my code:

     ▶2 mksession
     if has('mksession')
         function s:InitSes()
             let sesdir=expand('~/.vimsessions')
             if !isdirectory(sesdir)
                 call mkdir(expand(sesdir), , 0700)
             endif
             let sesfile=os#JoinPath(sesdir, '.sessions.lst')
             let sessions=[]
             if filereadable(sesfile)
                 let sessions+=readfile(sesfile, 'b')
                 while !empty(sessions)  empty(sessions[-1])
                     call remove(sessions, -1)
                 endwhile
             endif
             let sessplitted=map(copy(sessions),
                         \'split(v:val, ''\v%(\\@!%()*)@=,'')')
             let sesdirs=map(copy(sessplitted),
 '((empty(v:val))?():(v:val[0]))') let
 sesfiles=map(copy(sessplitted), '((empty(v:val))?([]):(v:val[1:]))')
 execute cd
 .fnameescape(resolve(fnamemodify('.', ':p'))) let
 curdir=escape(fnamemodify('.', ':p'), ',\')
             return [sesdir, sesfile, sessions, sesdirs, sesfiles,
 curdir] endfunction
         let s:_functions['s:InitSes']=function('s:InitSes')
         function s:MakeSession()
             let [sesdir, sesfile, sessions, sesdirs, sesfiles,
 curdir]=s:InitSes() let files=sort(map(filter(map(filter(range(1,
 bufnr('$')), \                        'getbufvar(v:val,
 bt)!=#help'), \                 'bufname(v:val)'),
                         \             'filereadable(v:val)'),
                         \    
  'escape(fnamemodify(resolve(fnamemodify(v:val, :p)), :~:.),
 ,\\)'))
             if empty(files)
                 return
             endif
             let sesstr=join([curdir]+files, ',')
             let sindex=index(sessions, sesstr)
             if sindex==-1
                 let sindex=index(sessions, '')
             endif
             if sindex==-1
                 let sesname=os#JoinPath(sesdir, len(sesdirs).'.vim')
                 call add(sessions, sesstr)
             else
                 let sesname=os#JoinPath(sesdir, sindex.'.vim')
                 let sessions[sindex]=sesstr
             endif
             execute 'mksession! '.fnameescape(sesname)
             call writefile(sessions, sesfile, 'b')
         endfunction
         let s:_functions['s:MakeSession']=function('s:MakeSession')
         function s:LoadSession(bang, ...)
             let

Re: syntax coloring

2011-04-15 Thread rameo
On Apr 15, 5:43 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 19:13:18 15 April 2011, Friday
 by rameo:

  Please let me ask you one more question...
  How do you close this session and reopens a custom one (happens once
  in a while)?

 I don't use one continious vim session and don't load any sessions at
 vim startup (the `just the same error' meant that I used an autocommand
 in a similar way and got the same error, not that I used the same code).
 Instead I create a new session file almost each time when vim exits
 and load one of created sessions at vim startup:
 1. due to virtual desktops I almost never close any of my projects' windows,
 2. I use vim to quickly edit something from command-line, loading any sessions
    will discard the most significant part of vim invocation arguments
    for this use-case.
 Saving session at vim exit is for the case when I have to reload vim
 (mostly plugin or kernel updates).
 Here is my code:

     ▶2 mksession
     if has('mksession')
         function s:InitSes()
             let sesdir=expand('~/.vimsessions')
             if !isdirectory(sesdir)
                 call mkdir(expand(sesdir), , 0700)
             endif
             let sesfile=os#JoinPath(sesdir, '.sessions.lst')
             let sessions=[]
             if filereadable(sesfile)
                 let sessions+=readfile(sesfile, 'b')
                 while !empty(sessions)  empty(sessions[-1])
                     call remove(sessions, -1)
                 endwhile
             endif
             let sessplitted=map(copy(sessions),
                         \'split(v:val, ''\v%(\\@!%()*)@=,'')')
             let sesdirs=map(copy(sessplitted), 
 '((empty(v:val))?():(v:val[0]))')
             let sesfiles=map(copy(sessplitted), 
 '((empty(v:val))?([]):(v:val[1:]))')
             execute cd .fnameescape(resolve(fnamemodify('.', ':p')))
             let curdir=escape(fnamemodify('.', ':p'), ',\')
             return [sesdir, sesfile, sessions, sesdirs, sesfiles, curdir]
         endfunction
         let s:_functions['s:InitSes']=function('s:InitSes')
         function s:MakeSession()
             let [sesdir, sesfile, sessions, sesdirs, sesfiles, 
 curdir]=s:InitSes()
             let files=sort(map(filter(map(filter(range(1, bufnr('$')),
                         \                        'getbufvar(v:val, 
 bt)!=#help'),
                         \                 'bufname(v:val)'),
                         \             'filereadable(v:val)'),
                         \      'escape(fnamemodify(resolve(fnamemodify(v:val, 
 :p)),
 :~:.), ,\\)'))
             if empty(files)
                 return
             endif
             let sesstr=join([curdir]+files, ',')
             let sindex=index(sessions, sesstr)
             if sindex==-1
                 let sindex=index(sessions, '')
             endif
             if sindex==-1
                 let sesname=os#JoinPath(sesdir, len(sesdirs).'.vim')
                 call add(sessions, sesstr)
             else
                 let sesname=os#JoinPath(sesdir, sindex.'.vim')
                 let sessions[sindex]=sesstr
             endif
             execute 'mksession! '.fnameescape(sesname)
             call writefile(sessions, sesfile, 'b')
         endfunction
         let s:_functions['s:MakeSession']=function('s:MakeSession')
         function s:LoadSession(bang, ...)
             let [sesdir, sesfile, sessions, sesdirs, sesfiles, 
 curdir]=s:InitSes()
             if a:0  string(+a:1)==#a:1  a:1len(sessions) 
                         \!empty(sessions[a:1])
                 let dirsessions=[[+a:1, sesdirs[a:1], sessions[a:1]]]
             else
                 let dirsessions=filter(map(copy(sesdirs),
                             \              '[v:key, v:val, sessions[v:key]]'),
                             \          'v:val[1]==#curdir'.
                             \                   ((a:0)?('  
 v:val[2]=~?a:1'):('')))
             endif
             if len(dirsessions)==1 || (!empty(dirsessions)  a:bang)
                 let sesid=dirsessions[0][0]
                 let sesname=os#JoinPath(sesdir, sesid.'.vim')
                 execute 'source '.fnameescape(sesname)
                 call delete(sesname)
                 if sesid==(len(sessions)-1)
                     call remove(sessions, -1)
                 else
                     let sessions[sesid]=
                 endif
                 call writefile(sessions, sesfile, 'b')
             endif
         endfunction
         let s:_functions['s:LoadSession']=function('s:LoadSession')
         function s:PrintSessions()
             let [sesdir, sesfile, sessions, sesdirs, sesfiles, 
 curdir]=s:InitSes()
             call map(sessions,
                         \'printf(%'.len(len(sessions)-1).'u %s, v:key, 
 v:val)')
             echo join(sessions, \n)
         endfunction
         let s:_functions['s:PrintSessions']=function('s:PrintSessions

Re: syntax coloring

2011-04-15 Thread rameo
On Apr 15, 10:02 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 23:29:29 15 April 2011, Friday
 by rameo:

  I found a new way to integrate argdel:

  augroup SaveRestoreSessions
  autocmd!
  autocmd VimEnter * nested source $VIM\vimfiles\sessions\Session.vim
  autocmd VimLeave * call MakeSession()
  autocmd VimLeave * nested mksession! $VIM\vimfiles\sessions
  \Session.vim
  augroup END

  function! MakeSession()
    if argc() != 0
      execute 'argdel *'
    endif
  endfunction

 You are doing a strange things again:
 1. You should either rename `MakeSession' to `ClearArgs' (because 
 `MakeSession'
 will confuse somebody (maybe even you) who will read you code as it does not
 makes any sessions) or, better, move `mksession!' call inside a function.
 2. Why are you again writing `execute'?
 3. You don't need `nested' for mksession, you need it only for VimEnter.
 4. Never write anything user-specific to application folder, it may be purged 
 by
 application update, removed by the package manager (if any) or uninstaller, or
 you may have to create more then one user on the machine.

 Original message:







  On Apr 15, 9:14 pm, ZyX zyx@gmail.com wrote:
   Reply to message «Re: syntax coloring»,
   sent 23:02:40 15 April 2011, Friday

   by rameo:
Tnx.. this is what I added:
autocmd VimLeave * if argc() != 0 | 'argdel *' endif

   Reread help. This is false: you should not use strikes around `argdel *'
   and you should have bar before `endif' just like you have before
   `argdel'.

I noted that (even after a buffer delete :bd) certain buffers do
remain in session.vim
I had no troubles anymore after removing argdel * and troubles again
after having changed the script as above.

   I know this issue. In this case you should have `argdel' before
   mksession, I don't get why you have it *after*.

   Original message:
On Apr 15, 8:55 pm, ZyX zyx@gmail.com wrote:
 Reply to message «Re: syntax coloring»,
 sent 21:39:21 15 April 2011, Friday

 by rameo:
  Still have a little problem.
  I had also a VimLeave argdel command in my _vimrc.

  Is this correct?:

  augroup SaveRestoreSessions
  autocmd!
  autocmd VimEnter * nested source D:\session.vim
  autocmd VimLeave * nested mksession! D:\session.vim
  autocmd VimLeave *  if argc() != 0 | exe 'argdel *'
  augroup END

  btw tnx. for your script.

 1. Missing endif.
 2. You don't need `exe' here.
 3. I don't get why do you need this command at all.

 Original message:
  On Apr 15, 5:43 pm, ZyX zyx@gmail.com wrote:
   Reply to message «Re: syntax coloring»,
   sent 19:13:18 15 April 2011, Friday

   by rameo:
Please let me ask you one more question...
How do you close this session and reopens a custom one (happens
once in a while)?

   I don't use one continious vim session and don't load any
   sessions at vim startup (the `just the same error' meant that I
   used an autocommand in a similar way and got the same error, not
   that I used the same code). Instead I create a new session file
   almost each time when vim exits and load one of created sessions
   at vim startup: 1. due to virtual desktops I almost never close
   any of my projects' windows, 2. I use vim to quickly edit
   something from command-line, loading any sessions will discard
   the most significant part of vim invocation arguments for this
   use-case.
   Saving session at vim exit is for the case when I have to reload
   vim (mostly plugin or kernel updates).
   Here is my code:

       ▶2 mksession
       if has('mksession')
           function s:InitSes()
               let sesdir=expand('~/.vimsessions')
               if !isdirectory(sesdir)
                   call mkdir(expand(sesdir), , 0700)
               endif
               let sesfile=os#JoinPath(sesdir, '.sessions.lst')
               let sessions=[]
               if filereadable(sesfile)
                   let sessions+=readfile(sesfile, 'b')
                   while !empty(sessions)  empty(sessions[-1])
                       call remove(sessions, -1)
                   endwhile
               endif
               let sessplitted=map(copy(sessions),
                           \'split(v:val,
   ''\v%(\\@!%()*)@=,'')') let sesdirs=map(copy(sessplitted),
   '((empty(v:val))?():(v:val[0]))') let
   sesfiles=map(copy(sessplitted),
   '((empty(v:val))?([]):(v:val[1:]))') execute cd
   .fnameescape(resolve(fnamemodify('.', ':p'))) let
   curdir=escape(fnamemodify('.', ':p'), ',\')
               return [sesdir, sesfile, sessions, sesdirs, sesfiles,
   curdir] endfunction
           let s:_functions['s:InitSes']=function('s:InitSes')
           function s:MakeSession()
               let

Re: SID or s: - General questions about functions

2011-04-13 Thread rameo
Thank you very much Tony and ZyX.

My functions names do only contains letters, digits and underscores.
If I've understood you well, I can now unify all my functions and

change s: --- SID
change function! --- fun!
change endfunction! -- endfun!

Is that correct?

and can I change also this:
s/\\d\\{2,}/\\=s:MyFunctionName(submatch(0))/g
in:
s/\\d\\{2,}/\\=SIDMyFunctionName(submatch(0))/g

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


SID or s: - General questions about functions

2011-04-12 Thread rameo
After a half year of use of VIM, I still don't understand what is, and
if there is a difference between SID and s:. (even after reading
the help file)

Can they be exchanged?

Fun!, fun!, Function! and function!
is the same isn't?
Endfunction, endfunction, Endfun, endfun also?

I often Titlecase functionnames.
Is this the same?:
fun! s:Myfunction() -- :call s:Myfunction() -- call
SIDMyfunction()
fun! s:myfunction() -- :call s:myfunction() -- call
SIDmyfunction()
fun! s:MYFUNCTION() -- :call s:MYFUNCTION() -- call
SIDMYFUNCTION()

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: menu.vim overwritten

2011-04-10 Thread rameo
On Apr 9, 10:54 am, Andy Wokula anw...@yahoo.de wrote:
 Am 05.04.2011 16:59, schrieb rameo:

  Actually I use windows gvim 7.3 version.
  All my files and plugins are in my user directory vimfiles

  I noted that these 2 files has to be in the vim73 (program directory):
  - _vimrc
  - menu.vim

 That is wrong, you should never place/change files in the program dir.
 I wonder why that vimrc ever gets sourced.

 Check for appropriated places for the vimrc file:
      :h vimrc

 You can prevent loading the $VIMRUNTIME/menu.vim at all:
      :h 'go-M
      :set go+=M

       also remove the empty toolbar:
      :set go+=M go-=T

  When I install a new vim version, the installer asks if it has to
  create a new _vimrc file but it doesn't so for menu.vim.
  Last time my menu.vim was overwritten.

 see above

  I was happy that I created a backup 2 days before.

  How can I resolve this problem?
  Is there no way to place menu.vim in Vimfiles?
  Another idea is to let the installer ask also if it has to create a
  new menu.vim file.

 --
 Andy

Hello Andy,

Thank you for writing.
I tried to use the set go+=M command in _vimrc but menu.vim is still
loading. What did I wrong?

I tried also to remove the menu.vim (from vim73 directory) and put it
in vimfiles but that gave an error. Gvim couldn't find the menu.vim
file.

I tried also to move my _vimrc file to vimfiles but that gave an error
also starting Gvim.

I would like to put both files (menu.vim and _vimrc) in vimfiles and
prevent Gvim to load both files in the vim73 dictionary.

Rameo

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


  1   2   3   >