Saturday, December 31, 2016

Re: 'maxfuncdepth' ignored

On Saturday, December 31, 2016 at 12:23:10 PM UTC-6, ZyX wrote:
> 2016-12-30 20:09 GMT+03:00 Brett Stahlman <brettstahlman@gmail.com>:
> > Consider the following recursive user function...
> >
> > fu! Fun(count)
> > if a:count > 0
> > call Fun(a:count - 1)
> > endif
> > endfu
> >
> > :h 'maxfuncdepth' describes the option's purpose as follows:
> >
> > Maximum depth of function calls for user functions. This normally
> > catches endless recursion. When using a recursive function with
> > more depth, set 'maxfuncdepth' to a bigger number.
> >
> > So I would expect to be able to make the following recursive call with no error:
> > :set maxfuncdepth=1000
> > :call Fun(500)
> >
> > But I get the following error after slightly less than 200 recursive calls:
> > E169: Command too recursive
> >
> > The documentation for E169 states the following:
> >
> > This happens when an Ex command executes an Ex command that executes an Ex
> > command, etc. This is only allowed 200 times. When it's more there probably
> > is an endless loop. Probably a |:execute| or |:source| command is involved.
> >
> > It's as though the :call (Ex command) is triggering the error long
> > before the number of calls to the user function Fun() has reached
> > 'maxfuncdepth'. But if this is the way it's supposed to work, what's
> > the point of 'maxfuncdepth'? Don't all calls to user functions involve
> > an Ex command (since both `call' and `let' are Ex commands)? Is there
> > a way to permit more than 200 recursive calls to Fun() without
> > triggering the error?
>
> I tried lambdas, but they also catch this error due to the way they
> are implemented. Unlike (until you consider their internal
> implementation) lambdas regular functions are lists of Ex commands, so
> this is not surprising. Note that by default &maxfuncdepth is 100
> which is lesser then 200.

Hmm... Perhaps Bram will weigh in on this, but effectively limiting 'maxfuncdepth' to 200 feels like an unintended consequence, rather than design intent - especially since the help on 'maxfuncdepth' makes no mention of the limit. The documentation on E169 suggests that the purpose of the 200 limit is to detect certain types of recursion involving :source and :execute commands. If it was meant to apply to function calls generally, why even have a separate option for function calls, especially if you can't increase its value to something that would permit meaningful recursion?

Since there's no option governing the E169 limit, perhaps it could be changed to the maximum of 200 and 'maxfuncdepth'. Or perhaps it could take into account the type of Ex command (i.e., source/execute vs call/let). Or perhaps there could be a 'maxmemfunc' option (analogous to 'maxmempattern'), which would limit function call recursion by stack space consumed (or some rough approximation thereof) rather than # of calls.

I noticed this because I'm running a tree processing algorithm that is inherently recursive. I had intended to compute 'maxfuncdepth' as a function of another option, but discovered that my choice was silently ignored for anything over 200. Although the depth of the trees can exceed 200 in extreme cases, the depth is bounded and known, so it made sense simply to boost 'maxfuncdepth' long enough to recurse the tree. If there's no way around the 200 maximum, I'll probably have to rewrite the algorithm to use breadth-first traversals, rather than the much more natural (and simple) tree recursion.

Thanks,
Brett Stahlman

>
> >
> > Thanks,
> > Brett Stahlman
> >
> > --
> > --
> > 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+unsubscribe@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: 'maxfuncdepth' ignored

2016-12-30 20:09 GMT+03:00 Brett Stahlman <brettstahlman@gmail.com>:
> Consider the following recursive user function...
>
> fu! Fun(count)
> if a:count > 0
> call Fun(a:count - 1)
> endif
> endfu
>
> :h 'maxfuncdepth' describes the option's purpose as follows:
>
> Maximum depth of function calls for user functions. This normally
> catches endless recursion. When using a recursive function with
> more depth, set 'maxfuncdepth' to a bigger number.
>
> So I would expect to be able to make the following recursive call with no error:
> :set maxfuncdepth=1000
> :call Fun(500)
>
> But I get the following error after slightly less than 200 recursive calls:
> E169: Command too recursive
>
> The documentation for E169 states the following:
>
> This happens when an Ex command executes an Ex command that executes an Ex
> command, etc. This is only allowed 200 times. When it's more there probably
> is an endless loop. Probably a |:execute| or |:source| command is involved.
>
> It's as though the :call (Ex command) is triggering the error long
> before the number of calls to the user function Fun() has reached
> 'maxfuncdepth'. But if this is the way it's supposed to work, what's
> the point of 'maxfuncdepth'? Don't all calls to user functions involve
> an Ex command (since both `call' and `let' are Ex commands)? Is there
> a way to permit more than 200 recursive calls to Fun() without
> triggering the error?

I tried lambdas, but they also catch this error due to the way they
are implemented. Unlike (until you consider their internal
implementation) lambdas regular functions are lists of Ex commands, so
this is not surprising. Note that by default &maxfuncdepth is 100
which is lesser then 200.

>
> Thanks,
> Brett Stahlman
>
> --
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Pasting from wrong register(?)

I'm setting clipboard to unnamed. I can't claim to fully understand yet how this (and related) options work so I played around a bit and found that it works when I have the `exclude:` part of the default clipboard value (not /etc/vimrc). That explains why it was working on the other machine (with the same configuration) - there was no X server to share a clipboard with.

To me, it seems like the best solution is to set the clipboard to `unnamedplus` and change the map to replace the `+`-register instead of the `"`-register - using the plus instead of the star register because the star register gets overwritten when selecting the text I'm trying to replace.

Thanks and a happy new year everyone!

On 31 December 2016 at 11:54, Christian Brabandt <cblists@256bit.org> wrote:
On Fr, 30 Dez 2016, Fabian Furger wrote:

> A while ago I found a convenient map to get around that by replacing the
> content of the default register:
>
> `vnoremap P p:call setreg('"', getreg('0'))<CR>`
>
> That worked fine in terminal vim 7.3 (the version in Ubuntu 14.04 LTS) but
> doesn't seem to work on my own machine (terminal vim 8 on ArchLinux).
> Checking with `:reg "`, I see that it does indeed contain the right content,
> but when pasting, it appears that the contents of the last selection register
> `"*` is used instead - I'd need to explicitly paste from the unnamed register
> `""p`.
>
> Do I misunderstand something or am I doing something wrong?

What is your 'clipboard' setting?

Best,
Christian
--
Objektivität: Alles hat zwei Seiten. Aber erst wenn man erkennt, daß
es drei sind, erfaßt man die Sache.
                -- Heimito von Doderer

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/FfKUA2Xgx_Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Pasting from wrong register(?)

On Fr, 30 Dez 2016, Fabian Furger wrote:

> A while ago I found a convenient map to get around that by replacing the
> content of the default register:
>
> `vnoremap P p:call setreg('"', getreg('0'))<CR>`
>
> That worked fine in terminal vim 7.3 (the version in Ubuntu 14.04 LTS) but
> doesn't seem to work on my own machine (terminal vim 8 on ArchLinux).
> Checking with `:reg "`, I see that it does indeed contain the right content,
> but when pasting, it appears that the contents of the last selection register
> `"*` is used instead - I'd need to explicitly paste from the unnamed register
> `""p`.
>
> Do I misunderstand something or am I doing something wrong?

What is your 'clipboard' setting?

Best,
Christian
--
Objektivität: Alles hat zwei Seiten. Aber erst wenn man erkennt, daß
es drei sind, erfaßt man die Sache.
-- Heimito von Doderer

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Pasting from wrong register(?)

On Friday, 30 December 2016 22:52:41 UTC+1, Bee wrote:
> Does the following work in both cases?
>
> vnoremap P "0P

Well, that kind of works even if it's not what I'm looking for - because after such a "replace" pasting with P in visual mode, I still lose the original content of the default register, so I can't do normal mode pasting (only visual mode).

I used to think that when not specifying the register, the default register is used - which apparently isn't the case like I described initially. Was this behavior changed at some point, is my thinking wrong, or may that be a bug?

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Friday, December 30, 2016

Re: Pasting from wrong register(?)

On Friday, December 30, 2016 at 12:28:49 PM UTC-8, Fabian Furger wrote:
> A while ago I found a convenient map to get around that by replacing the content of the default register:
>
> `vnoremap P p:call setreg('"', getreg('0'))<CR>`

Does the following work in both cases?

vnoremap P "0P

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pasting from wrong register(?)

Hi,

I frequently get bugged when pasting over a visually selected block of text and the default register contains the deleted text afterwards - chances are, I want to paste the same text multiple times.

A while ago I found a convenient map to get around that by replacing the content of the default register:

`vnoremap P p:call setreg('"', getreg('0'))<CR>`

That worked fine in terminal vim 7.3 (the version in Ubuntu 14.04 LTS) but doesn't seem to work on my own machine (terminal vim 8 on ArchLinux).
Checking with `:reg "`, I see that it does indeed contain the right content, but when pasting, it appears that the contents of the last selection register `"*` is used instead - I'd need to explicitly paste from the unnamed register `""p`.

Do I misunderstand something or am I doing something wrong?

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

'maxfuncdepth' ignored

Consider the following recursive user function...

fu! Fun(count)
if a:count > 0
call Fun(a:count - 1)
endif
endfu

:h 'maxfuncdepth' describes the option's purpose as follows:

Maximum depth of function calls for user functions. This normally
catches endless recursion. When using a recursive function with
more depth, set 'maxfuncdepth' to a bigger number.

So I would expect to be able to make the following recursive call with no error:
:set maxfuncdepth=1000
:call Fun(500)

But I get the following error after slightly less than 200 recursive calls:
E169: Command too recursive

The documentation for E169 states the following:

This happens when an Ex command executes an Ex command that executes an Ex
command, etc. This is only allowed 200 times. When it's more there probably
is an endless loop. Probably a |:execute| or |:source| command is involved.

It's as though the :call (Ex command) is triggering the error long
before the number of calls to the user function Fun() has reached
'maxfuncdepth'. But if this is the way it's supposed to work, what's
the point of 'maxfuncdepth'? Don't all calls to user functions involve
an Ex command (since both `call' and `let' are Ex commands)? Is there
a way to permit more than 200 recursive calls to Fun() without
triggering the error?

Thanks,
Brett Stahlman

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thursday, December 29, 2016

Re: Opening new line above or below Perl comment line

On Thursday, December 29, 2016 at 4:47:11 PM UTC-8, $Bill wrote:
> When typing a Perl comment, I have no problem with vim starting the next line
> with a '#' for me when the line wraps in insert mode, but in command mode
> when I type 'o' OR 'O' to start a new line, I don't want the new line to
> be a comment line just because the line above or below was a comment and
> I'd like vim to assume the new line is code and do normal Perl indenting.
>
> Please help me with an option change or some syntax or indent file change
> or whatever that will stop assuming a new comment on o/O commands.
>
> TIA, Bill

Nevermind, after some more searching, I found the answer in another thread.

I took the 'o' out of formatoptions by adding a :set formatoptions in my rc file.


--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Opening new line above or below Perl comment line

On 2016-12-29, $Bill wrote:
> When typing a Perl comment, I have no problem with vim starting the next line
> with a '#' for me when the line wraps in insert mode, but in command mode
> when I type 'o' OR 'O' to start a new line, I don't want the new line to
> be a comment line just because the line above or below was a comment and
> I'd like vim to assume the new line is code and do normal Perl indenting.
>
> Please help me with an option change or some syntax or indent file change
> or whatever that will stop assuming a new comment on o/O commands.

The reason for this is that some filetype plugins, including
ftplugin/perl.vim, add the 'o' flag to 'formatoptions'. To fix that
for all filetype plugins, I have this in my ~/.vimrc:

au FileType * setlocal formatoptions-=o

I'm not positive, but I think that that line has to come _after_
":filetype plugin on" so that that :setlocal command will be
executed after any commands in a filetype plugin.

You can fix the problem for just Perl by replacing the * above with
the name perl, or you can create a file named (assuming Unix)
~/.vim/after/ftplugin/perl.vim containing the line:

setlocal formatoptions-=o

Regards,
Gary

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Opening new line above or below Perl comment line

When typing a Perl comment, I have no problem with vim starting the next line
with a '#' for me when the line wraps in insert mode, but in command mode
when I type 'o' OR 'O' to start a new line, I don't want the new line to
be a comment line just because the line above or below was a comment and
I'd like vim to assume the new line is code and do normal Perl indenting.

Please help me with an option change or some syntax or indent file change
or whatever that will stop assuming a new comment on o/O commands.

TIA, Bill

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Vim ... after new line start at possition and after start

On 2016-12-29, Martin Lindkvist wrote:
> Hello guys,
> I have tried to figure this out now for a while and is getting crazy.
>
> I need vim to put the marker 7spaces in when i push enter for a new line.
>
> _______|text goes here...
>
> And i need vim to start counting the tabs from that position as well.
>
> _______|<-tab-><-tab-><-tab->
>
> For now i get it to make tabs 4space but then the tabs after the marker gets placed 1 space wrong.
> like so.
> _______| <tb><tb><tb>
> <tb><tb> <tb><tb><tb>
>
>
> This is because i am programming cobol :/ and the first 7 chars is used for other things than code.
>
>
>
> I want it to be as this:
> _______|<return>
> _______|
>
> _______|some text <return>
> _______|
>
>
> for now i have this :
> set tabstop=4
> set expandtab
> set shiftwidth=4
> set autoindent
> set colorcolumn=7
>
> But it makes the first tabs to start at one space wrong
>
> Here is some cobol if you see my problem better that way :)
> ##########
> IDENTIFICATION DIVISION.
> * This is a comment
> 000001 PROGRAM-ID. YOUR-PROGRAM-NAME.
> 000002 DATA DIVISION.
> FILE SECTION.
> WORKING-STORAGE SECTION.
> PROCEDURE DIVISION.
> MAIN-PROCEDURE.
> DISPLAY "Hello world"
> STOP RUN.
> END PROGRAM YOUR-PROGRAM-NAME.
> ##########

If you have 'tabstop' set to 4, and you open a new line with the
cursor in the first column, column 1, then typing Tab once will
move the cursor to column 5 and typing Tab again will move it to
column 9. It looks like you want to begin typing code at column 8.
To do that using tabs, you will need to set 'tabstop' to 7.

Alternatively, you could use the indent/cobol.vim plugin that comes
with Vim. It will take care of proper COBOL indentation for you.
Just have

filetype indent on

somewhere in your ~/.vimrc. See ":help filetype-indent-on".

Regards,
Gary

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Vim ... after new line start at possition and after start

> I need vim to put the marker 7spaces in when i push enter for a new line.
>

Enter text with the code beginning in column 1, then do a global
substitution inserting 6 characters at the start of the line when saving a
new file? (Numbering at that stage, if desired.) Autoindent should then
take care of new lines.

Another possibility is substituting "\n " for "\n".

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vim ... after new line start at possition and after start

Hello guys,
I have tried to figure this out now for a while and is getting crazy.

I need vim to put the marker 7spaces in when i push enter for a new line.

_______|text goes here...

And i need vim to start counting the tabs from that position as well.

_______|<-tab-><-tab-><-tab->

For now i get it to make tabs 4space but then the tabs after the marker gets placed 1 space wrong.
like so.
_______| <tb><tb><tb>
<tb><tb> <tb><tb><tb>


This is because i am programming cobol :/ and the first 7 chars is used for other things than code.



I want it to be as this:
_______|<return>
_______|

_______|some text <return>
_______|


for now i have this :
set tabstop=4
set expandtab
set shiftwidth=4
set autoindent
set colorcolumn=7

But it makes the first tabs to start at one space wrong

Here is some cobol if you see my problem better that way :)
##########
IDENTIFICATION DIVISION.
* This is a comment
000001 PROGRAM-ID. YOUR-PROGRAM-NAME.
000002 DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
MAIN-PROCEDURE.
DISPLAY "Hello world"
STOP RUN.
END PROGRAM YOUR-PROGRAM-NAME.
##########

(haha yeah yeah change language cobol is the problem....have heard that one..)

Best regards
Martin Lindkvist

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wednesday, December 28, 2016

Overlay content of buffer without changing original content

Hi,

I've got buffer content on which I want to overwrite some information text without changing the original content of the buffer.

I explain, this is the original buffer :

BEGIN
FOO
BAR
FOOBAR
BAR
FOODINABAR
FOODINABAR
END

And for example the content I want to see just visualy, virtualy
This is the mode in which I see my added informations:
BEGIN
FOO
BAR 1
FOOBAR
BAR 2
FOODINABAR 1
FOODINABAR 2
END

This is the mode in which informations disappear:
BEGIN
FOO
BAR
FOOBAR
BAR
FOODINABAR
FOODINABAR
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

---
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Get substring position function (multi byte)

How to get substring position in chars if string is a multi byte string?

I use match() function and it returns index as byte offset. It is a byteidx
function what return also byte offset for Nth char. I could not found reverse
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tuesday, December 27, 2016

Re: vim 8.0 file explorer restrictions

On Tuesday, 27 December 2016 20:22:34 UTC+2, DrChip wrote:
> Musat Eduard wrote:
> > hy, my question here is about the allowed locations in the new vim 8.0 file explorer netrw 156.
> >
> > i'm running vim 8.0 on a windows 7 system and i'm having this issue whenever i open gvim (the one that runs in a window as opposed to running in cmd) the default path in :pwd is c:\users\"user". if i use the :Explore command it brings up the file explorer showing all the files in there but i can only go up in file paths up to c:\users and that's it, i can't go any upper than that.
> >
> > more than that if i use the :cd command to go to a different drive (d:), it does change the directory successfully and it does show it if i use :pwd but if i use :Explore it doesn't show anything, instead it just does a split screen of the same file containing the same text i have in the initial file.
> >
> > more than that, if i create an asdasd.txt file in d:\ and open it with vim and then use :Explore again it does nothing, just goes back to the same line of text i was on in command mode, almost as if the program is looking for access to that directory or cancelling the command because of something like that.
> >
> > also, i used vim 7.4 before this and it would any of the commands mentioned as expected. any ideas what the problem might be? does it need any special configuration?
> >
> > thanks,
> > edi
> >
> I suspect most if not all of these issues have disappeared with v162h of
> netrw (http://www.drchip.org/astronaut/vim/index.html#NETRW). Please
> try it out and see if you're still having problems. I don't have a
> windows 7 system available to me at the moment to try this out, btw.
>
> Chip Campbell

holy shit, you're the guy who made the plugin :D
yeah, that did it. thanks a lot. :)

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Syntax match first word of line

Le mardi 27 décembre 2016 19:59:34 UTC+1, Shawn H Corey a écrit :
> On Tue, 27 Dec 2016 10:08:50 -0800
> Bryan Richter <b@chreekat.net> wrote:
>
> > p.s. Your search pattern is finding the first word that follows some
> > whitespace, since you used \s\+ ("ONE or more whitespace chars"). Is
> > that what you meant? If you wanted "the first word, no exceptions" you
> > would use \s* to find "ZERO or more whitespace chars".
>
> A better choice might be to use \W* instead. This will make non-word
> characters.
>
>
> --
> Don't stop where the ink does.
>
> Shawn H Corey

Ok it works well to highlight word just after non words with this pattern :
syn match s7Accumulator /^\(_\d\+:\)*\W*\zs\(POP\|ENT\)/

But on this sentence :
Entree_Word
it highlights 'Ent' too or I just want it match the only word
Ent or
ENT


--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Syntax match first word of line

On Tue, 27 Dec 2016 10:08:50 -0800
Bryan Richter <b@chreekat.net> wrote:

> p.s. Your search pattern is finding the first word that follows some
> whitespace, since you used \s\+ ("ONE or more whitespace chars"). Is
> that what you meant? If you wanted "the first word, no exceptions" you
> would use \s* to find "ZERO or more whitespace chars".

A better choice might be to use \W* instead. This will make non-word
characters.


--
Don't stop where the ink does.

Shawn H Corey

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: vim 8.0 file explorer restrictions

Musat Eduard wrote:
> hy, my question here is about the allowed locations in the new vim 8.0 file explorer netrw 156.
>
> i'm running vim 8.0 on a windows 7 system and i'm having this issue whenever i open gvim (the one that runs in a window as opposed to running in cmd) the default path in :pwd is c:\users\"user". if i use the :Explore command it brings up the file explorer showing all the files in there but i can only go up in file paths up to c:\users and that's it, i can't go any upper than that.
>
> more than that if i use the :cd command to go to a different drive (d:), it does change the directory successfully and it does show it if i use :pwd but if i use :Explore it doesn't show anything, instead it just does a split screen of the same file containing the same text i have in the initial file.
>
> more than that, if i create an asdasd.txt file in d:\ and open it with vim and then use :Explore again it does nothing, just goes back to the same line of text i was on in command mode, almost as if the program is looking for access to that directory or cancelling the command because of something like that.
>
> also, i used vim 7.4 before this and it would any of the commands mentioned as expected. any ideas what the problem might be? does it need any special configuration?
>
> thanks,
> edi
>
I suspect most if not all of these issues have disappeared with v162h of
netrw (http://www.drchip.org/astronaut/vim/index.html#NETRW). Please
try it out and see if you're still having problems. I don't have a
windows 7 system available to me at the moment to try this out, btw.

Chip Campbell

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: vim 8.0 file explorer restrictions

Musat Eduard wrote:
> hy, my question here is about the allowed locations in the new vim 8.0 file explorer netrw 156.
>
> i'm running vim 8.0 on a windows 7 system and i'm having this issue whenever i open gvim (the one that runs in a window as opposed to running in cmd) the default path in :pwd is c:\users\"user". if i use the :Explore command it brings up the file explorer showing all the files in there but i can only go up in file paths up to c:\users and that's it, i can't go any upper than that.
>
> more than that if i use the :cd command to go to a different drive (d:), it does change the directory successfully and it does show it if i use :pwd but if i use :Explore it doesn't show anything, instead it just does a split screen of the same file containing the same text i have in the initial file.
>
> more than that, if i create an asdasd.txt file in d:\ and open it with vim and then use :Explore again it does nothing, just goes back to the same line of text i was on in command mode, almost as if the program is looking for access to that directory or cancelling the command because of something like that.
>
> also, i used vim 7.4 before this and it would any of the commands mentioned as expected. any ideas what the problem might be? does it need any special configuration?
>
> thanks,
> edi
>
I suspect most if not all of these issues have disappeared with v162h of
netrw (http://www.drchip.org/astronaut/vim/index.html#NETRW). Please
try it out and see if you're still having problems. I don't have a
windows 7 system available to me at the moment to try this out, btw.

Chip Campbell

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Syntax match first word of line

On Tue, Dec 27, 2016 at 08:59:18AM -0800, Ni Va wrote:

> Hi,
>
> I would like to syntax match the first word but don't know the syntax
>
> syn match firstWordMatch /^\s\+\w\+/
>
> How to map just the \(\w\+\) pattern inside global pattern ?

Add \zs, which specifies where to start the match.

syn match firstWordMatch /^\s\+\zs\w\+/

:help /\zs

-Bryan

p.s. Your search pattern is finding the first word that follows some
whitespace, since you used \s\+ ("ONE or more whitespace chars"). Is
that what you meant? If you wanted "the first word, no exceptions" you
would use \s* to find "ZERO or more whitespace chars".

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Syntax match first word of line

Hi,


I would like to syntax match the first word but don't know the syntax

syn match firstWordMatch /^\s\+\w\+/


How to mapp just the \(\w\+\) pattern inside global pattern ?

Thanks

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Is there a key map conflict in my Vim?

On Saturday, December 24, 2016 at 7:36:55 AM UTC+8, Tony Mechelynck wrote:
> On Fri, Dec 23, 2016 at 2:22 AM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> > I use the two command below to map my `j` and `k`, the purpose of these command is that when the current line is too long, it will be wrapped in vim window, and you don't want to jump it when you press j or k. So ~
> > nnoremap <expr> j v:count == 0 ? 'gj' : 'j'
> > nnoremap <expr> k v:count == 0 ? 'gk' : 'k'
> >
> > It doesn't work when I enter vim, but it worked when I run the command
> >
> > `source $MYVIMRC`
> >
> > I check my vimrc file no key map conflict in it. It means that my plugin get some duplicated key map ?
> >
> > How to fix it ? I use gvim 8 on windows
>
> After entering Vim, at a point where the mapping "doesn't work", type
>
> :verbose map j
> :verbose map k
>
> If it answers "No mapping found" it means the mapping isn't known at
> that point. Otherwise it will tell you what each of these keys is
> mapped to, and by which script.
>
>
> Best regards,
> Tony.

Tnx fix it, the command is Truly useful . : )

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Monday, December 26, 2016

vim 8.0 file explorer restrictions

hy, my question here is about the allowed locations in the new vim 8.0 file explorer netrw 156.

i'm running vim 8.0 on a windows 7 system and i'm having this issue whenever i open gvim (the one that runs in a window as opposed to running in cmd) the default path in :pwd is c:\users\"user". if i use the :Explore command it brings up the file explorer showing all the files in there but i can only go up in file paths up to c:\users and that's it, i can't go any upper than that.

more than that if i use the :cd command to go to a different drive (d:), it does change the directory successfully and it does show it if i use :pwd but if i use :Explore it doesn't show anything, instead it just does a split screen of the same file containing the same text i have in the initial file.

more than that, if i create an asdasd.txt file in d:\ and open it with vim and then use :Explore again it does nothing, just goes back to the same line of text i was on in command mode, almost as if the program is looking for access to that directory or cancelling the command because of something like that.

also, i used vim 7.4 before this and it would any of the commands mentioned as expected. any ideas what the problem might be? does it need any special configuration?

thanks,
edi

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Friday, December 23, 2016

Re: Is there a key map conflict in my Vim?

On Fri, Dec 23, 2016 at 2:22 AM, Zhe Lee <imlegendlzz@gmail.com> wrote:
> I use the two command below to map my `j` and `k`, the purpose of these command is that when the current line is too long, it will be wrapped in vim window, and you don't want to jump it when you press j or k. So ~
> nnoremap <expr> j v:count == 0 ? 'gj' : 'j'
> nnoremap <expr> k v:count == 0 ? 'gk' : 'k'
>
> It doesn't work when I enter vim, but it worked when I run the command
>
> `source $MYVIMRC`
>
> I check my vimrc file no key map conflict in it. It means that my plugin get some duplicated key map ?
>
> How to fix it ? I use gvim 8 on windows

After entering Vim, at a point where the mapping "doesn't work", type

:verbose map j
:verbose map k

If it answers "No mapping found" it means the mapping isn't known at
that point. Otherwise it will tell you what each of these keys is
mapped to, and by which script.


Best regards,
Tony.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thursday, December 22, 2016

Is there a key map conflict in my Vim?

I use the two command below to map my `j` and `k`, the purpose of these command is that when the current line is too long, it will be wrapped in vim window, and you don't want to jump it when you press j or k. So ~
nnoremap <expr> j v:count == 0 ? 'gj' : 'j'
nnoremap <expr> k v:count == 0 ? 'gk' : 'k'

It doesn't work when I enter vim, but it worked when I run the command

`source $MYVIMRC`

I check my vimrc file no key map conflict in it. It means that my plugin get some duplicated key map ?

How to fix it ? I use gvim 8 on windows


--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to fold or hide the comment in vimrc file?

On Tuesday, December 20, 2016 at 12:23:59 AM UTC+8, Gary Johnson wrote:
> On 2016-12-19, Zhe Lee wrote:
> > On Friday, December 16, 2016 at 10:42:07 PM UTC+8, Gary Johnson wrote:
> > > On 2016-12-16, Nikolay Aleksandrovich Pavlov wrote:
> > > > 2016-12-16 5:41 GMT+03:00 Zhe Lee
> > > > > I want to fold or hide the comment in the vimrc file.
> > > > > I Google it and find mainly the 2 solution below but none of them worked.
> > > > >
> > > > >
> > > > > syn match comment "\v(^\s*\".*\n)+" fold
> > > > >
> > > > > set foldmethod=expr foldexpr=getline(v:lnum)=~'^\s*"'
> > > > >
> > > > >
> > > > > My Vimrc file is like this, when I enter the 2 commands above nothing happens.
> > > >
> > > > First solution is incomplete (and probably will work only if you
> > > > disable syntax highlighting or modify syntax/vim.vim file, not sure),
> > > > second solution is incorrect: while it clearly was supposed to set
> > > > `&foldexpr` to `getline(v:lnum)=~'^\s*"'`, it really sets it to
> > > > `getline(v:lnum)=~'^s`: missing proper escaping results in `\s`
> > > > transformed into `s` (backslash needs to be escaped) and `"` starting
> > > > a comment (needs to be escaped too). In addition to this it is using
> > > > :set setting global values alongside with local while it should use
> > > > :setlocal to set only local values. Proper second variant is
> > > >
> > > > let &l:foldexpr='getline(v:lnum)=~#'.string('^\s*"')
> > >
> > > Setting 'foldexpr' doesn't have to be that complicated. Simply
> > > fixing the escaping of the backslash and the double-quote will fix
> > > the problem.
> > >
> > > setlocal foldmethod=expr foldexpr=getline(v:lnum)=~'^\\s*\"'
> > >
> > > Regards,
> > > Gary
> >
> > I have tried this command `setlocal foldmethod=expr
> > foldexpr=getline(v:lnum)=~'^\\s*\"'` in my vimrc file should the
> > line start with " be folded? Nothing happened in my vimrc file.
> > Why is that ?
>
> It could be that you have 'foldlevel' set to a high value. Try
> typing
>
> zM
>
> in normal mode or
>
> :set foldlevel=0
>
> from the command line and see if those lines become folded.
>
> Regards,
> Gary

Yeah, it worked ~ I haven't read the doc about the `fold` my bad, tnx ~

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Moving a file

Sorry for the late reply (to my own thread).

On Sun, Dec 11, 2016 at 1:36 PM, John Passaro <john.a.passaro@gmail.com> wrote:
> Vim normally offers a pretty lightweight bit of change detection and I think
> Shawn was only asking how to apply that to a new filename. In that context,
> ":saveas" seems to work:
>
> $ vim a
> :saveas b
> :! echo hello >> b
> W11: Warning: File "b" has changed since editing started
>

Yes, this is exactly what I meant, and yeah :saveas was what I was
looking for - thank y'all and sorry for the confusion.

> John Passaro
> (917) 678-8293
> http://riemann-summary.blogspot.com
> http://www.soundcloud.com/a-straight-john-at-last
>
> On Sun, Dec 11, 2016 at 12:42 PM, <arocker@vex.net> wrote:
>>
>>
>> > Shawn, what is it you're trying to do, exactly? The two parts of your
>> > question ("changing which file a buffer points to" and "get notified
>> > when a file is externally modified") are unrelated in vim.
>> >
>>
>> This is a vim-related list, but this does raise the question of whether
>> vim is even the appropriate tool? It sounds like some some sort of
>> monitoring effort.
>>
>> Vim is wonderful for a human creating or updating a text, then going away
>> to do something else. Operations involving multiple files, intermittent or
>> unpredictable events, and other situations fit other programs better.
>>
>> The programs in the *nix tool chest are all powerful and flexible. As a
>> result, sufficiently dedicated perversity can bend almost all of them to
>> do jobs wildly different from their designers' intentions. (Video games
>> written in sed, for example:https://github.com/aureliojargas/sokoban.sed
>> .) Just because it's possible doesn't make it advisable.
>>
>> --
>> --
>> 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+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

VIM 8.0.69 not honoring "backupdir" and "directory"

Hello,

I have been a vim and gvim user on Windows forever. I recently upgraded to VIM 8.0.69 and noticed it is creating backup and swap files in the same folder as the file I'm editing, even though I have both "backupdir" and "directory" set to a different location in "vimrc". I happen to be using Window 7 at my current client.

Any suggestions on what I might be doing wrong? Below are the settings I have in my vimrc if that helps.

if !isdirectory("c:\\temp\\vim_backups")
    call mkdir("c:\\temp\\vim_backups", "p")
endif

set lines=50      "screen height
set columns=180   "screen width
set nowrap
set number        "line numbers
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set ic          "ignore case

" How to treat backup and swap files
set bdir=c:\\temp\\vim_backups,.
set dir=c:\\temp\\vim_backups

set smartindent

" Remove this if there are tabbing problems
" May want to try cindent instead
set smartindent

" Turn 'Show file types' in Syntax menu
if has('gui_running')
  " Always show file types in menu
  :let do_syntax_sel_menu = 1|runtime! synmenu.vim|aunmenu &Syntax.&Show\ filetypes\ in\ menu
  :amenu T&abs.&NewTab<Tab>:tabnew :tabnew<CR>
  :amenu T&abs.&CloseTab<Tab>:tabc :tabc<CR>
  :amenu &Syntax.-SEP1- <nul>
  :amenu &Syntax.XAML<Tab>:XAML :cal SetSyn("xml")<CR>
  :amenu &Syntax.C#<Tab>:C# :cal SetSyn("cs")<CR>
  ":amenu &Syntax.PERL<Tab>:PERL :cal SetSyn("perl")<CR>
  :amenu &Syntax.JAVASCRIPT<Tab>:JAVASCRIPT :cal SetSyn("javascript")<CR>
  ":amenu &Syntax.makefile<Tab>:makefile :cal SetSyn("make")<CR>
  :amenu &Syntax.SQL<Tab>:sqlanywhere :cal SetSyn("sqlanywhere")<CR>
  ":amenu &Lang.&Espanol<Tab> :set spl=es spell<CR>
  ":amenu &Lang.English-&us<Tab> :set spl=en_us spell<CR>
  :amenu &Tools.SPELLes<Tab>:SPELLes :set spl=es spell<CR>
  :amenu &Tools.SPELLen_us<Tab>:SPELLen_us :set spl=en_us spell<CR>
endif

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Inconsistent json_encode() behaviors regarding empty (sub)strings

2016-12-22 9:20 GMT+03:00 Kay Zheng <l04m33@gmail.com>:
> Hi folks,
>
> I was trying out the new channel APIs, and found a little glitch in
> the built-in function json_encode():
>
> call assert_equal('', 'a'[1:0]) " pass
> call assert_equal('""', json_encode('')) "pass
> call assert_equal('""', json_encode('a'[1:0])) " fail,
> json_encode(...) returns 'null'
>
> I failed to see any content about the sub-string syntax str[a:b] in
> the documents, but it seems legit for sub-lists, so I've been using it
> all over my code, until encode_json('a'[1:0]) gave me 'null' as a
> result.
>
> I was running Vim version 8.0.134. Is this a bug?

This kind of failure is observed for NULL strings (e.g. like returned
by test_null_string()). Given that NULL strings are an optimization
for empty strings I consider this a bug. Neovim does not have it:
https://github.com/neovim/neovim/blob/aa4ef8966c12a6bd51d31ce32618e9844053aa04/test/functional/eval/json_functions_spec.lua#L763-L765,
https://github.com/neovim/neovim/blob/aa4ef8966c12a6bd51d31ce32618e9844053aa04/test/unit/eval/tricks_spec.lua#L21-L34.

>
> Regards,
> Kay. 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+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wednesday, December 21, 2016

Inconsistent json_encode() behaviors regarding empty (sub)strings

Hi folks,

I was trying out the new channel APIs, and found a little glitch in
the built-in function json_encode():

call assert_equal('', 'a'[1:0]) " pass
call assert_equal('""', json_encode('')) "pass
call assert_equal('""', json_encode('a'[1:0])) " fail,
json_encode(...) returns 'null'

I failed to see any content about the sub-string syntax str[a:b] in
the documents, but it seems legit for sub-lists, so I've been using it
all over my code, until encode_json('a'[1:0]) gave me 'null' as a
result.

I was running Vim version 8.0.134. Is this a bug?

Regards,
Kay. 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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Why make visual mode default? This editor is now useless to me.

On Wed, Dec 21, 2016 at 5:37 PM, Ervin Ruci <ervinruci@gmail.com> wrote:
> After your recent update the behavior of the mouse changed.
>
> Selecting some text with the mouse automatically enters visual mode. I rarely use the visual feature and when I use it I prefer using the v keyboard command.
>
> This new setting is pretty annoying and it is hard to turn off. Why did you break a previously functioning editor? You just wasted a few hours of my time for no good reason.

This question actually belongs in the vim_use group, please continue
it there. In addition it was quite recently answered.

The behaviour of the mouse depends on a number of options. See in particular:

:help 'mouse'
:help 'mousemodel'
:help 'selectmode'
:help :behave

and remember that

:verbose set mouse? mousemodel? selectmode?

will tell you the current values of these options, and, for each of
them, the latest script (if any) which set it.

Regards,
Tony.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tuesday, December 20, 2016

Re: swift.vim

On 2016-12-20, Pongthep Kulkrisada wrote:
> Hi Folks,
>
> May I ask a question? Apple swift language has been annouced for long. When
> will swift.vim be included in syntax folder. Thanks in advance.

Whenever someone with sufficient interest creates and submits it.

That could be you, if you're interested.

Regards,
Gary

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

swift.vim

Hi Folks,

May I ask a question? Apple swift language has been annouced for long. When will swift.vim be included in syntax folder. 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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Why the number of the yanked line is too many(may be over 22) the command line will not show if the line was copied ?

On Mon, 19 Dec 2016 21:32:59 -0600
Tim Chase <vim@tim.thechases.com> wrote:

> so I suspect that you have something interfering with that reporting.
>
> -tim

I'm running version 7.4 and I just tested it with 417 lines and it
reported 417 lines yanked.


--
Don't stop where the ink does.

Shawn H Corey

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Monday, December 19, 2016

Re: Why the number of the yanked line is too many(may be over 22) the command line will not show if the line was copied ?

On 2016-12-19 19:14, Zhe Lee wrote:
> I mean when I copy several line in the vim, the command line will
> show the lines has been yanked. But when number of yanked line is
> over 22(I test it), the command line will show nothing when the
> copy is done. But it becomes a little inconvenient for me that I
> don't know whether the copy is successful. How to set the vim to
> show the yank is successful when the copy is done?

Have you tested it without any plugins or extra stuff?

I just tried the following

$ vi -u NONE
:help 'report' " get to some place in the help
3Y " yank 3 lines
" correctly reports 3 lines yanked
yG " yank to the end of the document
" correctly reports 2698 lines yanked

so I suspect that you have something interfering with that reporting.

-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

---
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Why the number of the yanked line is too many(may be over 22) the command line will not show if the line was copied ?

I mean when I copy several line in the vim, the command line will show the lines has been yanked. But when number of yanked line is over 22(I test it), the command line will show nothing when the copy is done. But it becomes a little inconvenient for me that I don't know whether the copy is successful.
How to set the vim to show the yank is successful when the copy is done?

![1220111058.png](http://7xpvdr.com1.z0.glb.clouddn.com/1220111058.png)

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to fold or hide the comment in vimrc file?

On 2016-12-19, Zhe Lee wrote:
> On Friday, December 16, 2016 at 10:42:07 PM UTC+8, Gary Johnson wrote:
> > On 2016-12-16, Nikolay Aleksandrovich Pavlov wrote:
> > > 2016-12-16 5:41 GMT+03:00 Zhe Lee
> > > > I want to fold or hide the comment in the vimrc file.
> > > > I Google it and find mainly the 2 solution below but none of them worked.
> > > >
> > > >
> > > > syn match comment "\v(^\s*\".*\n)+" fold
> > > >
> > > > set foldmethod=expr foldexpr=getline(v:lnum)=~'^\s*"'
> > > >
> > > >
> > > > My Vimrc file is like this, when I enter the 2 commands above nothing happens.
> > >
> > > First solution is incomplete (and probably will work only if you
> > > disable syntax highlighting or modify syntax/vim.vim file, not sure),
> > > second solution is incorrect: while it clearly was supposed to set
> > > `&foldexpr` to `getline(v:lnum)=~'^\s*"'`, it really sets it to
> > > `getline(v:lnum)=~'^s`: missing proper escaping results in `\s`
> > > transformed into `s` (backslash needs to be escaped) and `"` starting
> > > a comment (needs to be escaped too). In addition to this it is using
> > > :set setting global values alongside with local while it should use
> > > :setlocal to set only local values. Proper second variant is
> > >
> > > let &l:foldexpr='getline(v:lnum)=~#'.string('^\s*"')
> >
> > Setting 'foldexpr' doesn't have to be that complicated. Simply
> > fixing the escaping of the backslash and the double-quote will fix
> > the problem.
> >
> > setlocal foldmethod=expr foldexpr=getline(v:lnum)=~'^\\s*\"'
> >
> > Regards,
> > Gary
>
> I have tried this command `setlocal foldmethod=expr
> foldexpr=getline(v:lnum)=~'^\\s*\"'` in my vimrc file should the
> line start with " be folded? Nothing happened in my vimrc file.
> Why is that ?

It could be that you have 'foldlevel' set to a high value. Try
typing

zM

in normal mode or

:set foldlevel=0

from the command line and see if those lines become folded.

Regards,
Gary

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to fold or hide the comment in vimrc file?

On Friday, December 16, 2016 at 12:28:20 PM UTC+8, ZyX wrote:
> 2016-12-16 5:41 GMT+03:00 Zhe Lee <imlegendlzz@gmail.com>:
> > I want to fold or hide the comment in the vimrc file.
> > I Google it and find mainly the 2 solution below but none of them worked.
> >
> >
> > syn match comment "\v(^\s*\".*\n)+" fold
> >
> > set foldmethod=expr foldexpr=getline(v:lnum)=~'^\s*"'
> >
> >
> > My Vimrc file is like this, when I enter the 2 commands above nothing happens.
>
> First solution is incomplete (and probably will work only if you
> disable syntax highlighting or modify syntax/vim.vim file, not sure),
> second solution is incorrect: while it clearly was supposed to set
> `&foldexpr` to `getline(v:lnum)=~'^\s*"'`, it really sets it to
> `getline(v:lnum)=~'^s`: missing proper escaping results in `\s`
> transformed into `s` (backslash needs to be escaped) and `"` starting
> a comment (needs to be escaped too). In addition to this it is using
> :set setting global values alongside with local while it should use
> :setlocal to set only local values. Proper second variant is
>
> let &l:foldexpr='getline(v:lnum)=~#'.string('^\s*"')
> setlocal foldmethod=expr
>
> First method lacks `foldmethod` setting.
>
> >
> > ```
> > if g:atCompany
> > " set tags+=D:/Ruchee/Files/code/self/ci/tags
> > " set tags+=D:/Ruchee/Files/code/self/laravel/tags
> > " set tags+=D:/Ruchee/Files/code/self/sf/tags
> > else
> > ```
> >
> > So how to hide the comments?
> >
> > -----------
> > Another question plz, how to edit the code format in this edit box? It's terriable that I can't post code here.
> >
> > --
> > --
> > 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+unsubscribe@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

You are one of the maintainer of the VAM? It is really amazing 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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to fold or hide the comment in vimrc file?

On Friday, December 16, 2016 at 12:28:20 PM UTC+8, ZyX wrote:
> 2016-12-16 5:41 GMT+03:00 Zhe Lee <imlegendlzz@gmail.com>:
> > I want to fold or hide the comment in the vimrc file.
> > I Google it and find mainly the 2 solution below but none of them worked.
> >
> >
> > syn match comment "\v(^\s*\".*\n)+" fold
> >
> > set foldmethod=expr foldexpr=getline(v:lnum)=~'^\s*"'
> >
> >
> > My Vimrc file is like this, when I enter the 2 commands above nothing happens.
>
> First solution is incomplete (and probably will work only if you
> disable syntax highlighting or modify syntax/vim.vim file, not sure),
> second solution is incorrect: while it clearly was supposed to set
> `&foldexpr` to `getline(v:lnum)=~'^\s*"'`, it really sets it to
> `getline(v:lnum)=~'^s`: missing proper escaping results in `\s`
> transformed into `s` (backslash needs to be escaped) and `"` starting
> a comment (needs to be escaped too). In addition to this it is using
> :set setting global values alongside with local while it should use
> :setlocal to set only local values. Proper second variant is
>
> let &l:foldexpr='getline(v:lnum)=~#'.string('^\s*"')
> setlocal foldmethod=expr
>
> First method lacks `foldmethod` setting.
>
> >
> > ```
> > if g:atCompany
> > " set tags+=D:/Ruchee/Files/code/self/ci/tags
> > " set tags+=D:/Ruchee/Files/code/self/laravel/tags
> > " set tags+=D:/Ruchee/Files/code/self/sf/tags
> > else
> > ```
> >
> > So how to hide the comments?
> >
> > -----------
> > Another question plz, how to edit the code format in this edit box? It's terriable that I can't post code here.
> >
> > --
> > --
> > 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+unsubscribe@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

tnx a lot for your reply. I am not quite familiar with the vim script syntax so I just paste your suggested command into the vim command line. Should the line start with " be folded? Nothing happened in my vimrc file.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: How to fold or hide the comment in vimrc file?

On Friday, December 16, 2016 at 10:42:07 PM UTC+8, Gary Johnson wrote:
> On 2016-12-16, Nikolay Aleksandrovich Pavlov wrote:
> > 2016-12-16 5:41 GMT+03:00 Zhe Lee
> > > I want to fold or hide the comment in the vimrc file.
> > > I Google it and find mainly the 2 solution below but none of them worked.
> > >
> > >
> > > syn match comment "\v(^\s*\".*\n)+" fold
> > >
> > > set foldmethod=expr foldexpr=getline(v:lnum)=~'^\s*"'
> > >
> > >
> > > My Vimrc file is like this, when I enter the 2 commands above nothing happens.
> >
> > First solution is incomplete (and probably will work only if you
> > disable syntax highlighting or modify syntax/vim.vim file, not sure),
> > second solution is incorrect: while it clearly was supposed to set
> > `&foldexpr` to `getline(v:lnum)=~'^\s*"'`, it really sets it to
> > `getline(v:lnum)=~'^s`: missing proper escaping results in `\s`
> > transformed into `s` (backslash needs to be escaped) and `"` starting
> > a comment (needs to be escaped too). In addition to this it is using
> > :set setting global values alongside with local while it should use
> > :setlocal to set only local values. Proper second variant is
> >
> > let &l:foldexpr='getline(v:lnum)=~#'.string('^\s*"')
>
> Setting 'foldexpr' doesn't have to be that complicated. Simply
> fixing the escaping of the backslash and the double-quote will fix
> the problem.
>
> setlocal foldmethod=expr foldexpr=getline(v:lnum)=~'^\\s*\"'
>
> Regards,
> Gary

I have tried this command `setlocal foldmethod=expr foldexpr=getline(v:lnum)=~'^\\s*\"'` in my vimrc file should the line start with " be folded? Nothing happened in my vimrc file. Why is that ?

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Fold-related bug and pointer to fix



On Fri, Dec 16, 2016 at 12:58 PM, Christian Brabandt <cblists@256bit.org> wrote:
Bram,
attached is a patch, that changes slightly how addresses are being
calculated when on a folded line and using an relative offset.


I couldn't manage to run the patch. patch -p0 gave me errors.  What am I doing 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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Saturday, December 17, 2016

Re: How to set the language of ui in gvim

On Thu, Dec 15, 2016 at 12:08 PM, Dominique Pellé
<dominique.pelle@gmail.com> wrote:
> Zhe Lee <imlegendlzz@gmail.com> wrote:
>
>> On Tuesday, December 13, 2016 at 10:02:16 PM UTC+8, Zhe Lee wrote:
>>> According to this link I already add the language setting code into my vimrc file.
>>> http://superuser.com/a/921446/609799
>>>
>>> "Set The Language Of The Vim"
>>> set langmenu=en_US
>>> let $LANG = 'en_US'
>>> source $VIMRUNTIME/delmenu.vim
>>> source $VIMRUNTIME/menu.vim
>>>
>>>
>>> But the language on the ui is still CN how to change that ?
>>
>> I use Vim8 and my os is windows
>>
>> According to the post here.
>> https://github.com/vim/vim/issues/1082 which is provided by Christian Brabandt.
>>
>> Seems the delete the lang folder is the only way that work for me.
>>
>> Again really appreciate everyone who give me a suggestion every one, I have tried.
>> TNX : )
>
>
> As was already said, valid languages depend
> on the platform.
>
> You can try completion to find valid languages:
>
> :language CTRL-D
>
> It works at least on Linux, but I'm not sure whether it's
> implemented on Windows.
>
> Regards
> Dominique
>

On Windows, AFAIK ":language messages en" (without _US) works. Maybe
also ":language messages English_United States" or ":language messages
English_United\ States", I don't know which. OTOH, the experiments
mentioned above seem to indicate that ":language messages en_US" is
not recognized on Windows.

Best regards,
Tony.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.