Wednesday, June 24, 2015

errorformat Rhino js

let &makeprg='java -jar "rhino.jar" -strict -fatal-warnings "%:p"'
let &errorformat='%Ajs: "%f"\, line %l: %m,%Zjs: %p^,%C%.%#'

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino

--
--
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, June 23, 2015

Re: vim replace a string when a change occurred in another place

Erik,
Thanks for you comment....but it is solved. Now, another important thing....how to invoke it! Is it possible to have something like this:

if (getline(".")) startswith "Program"
au CursorMovedI call EdName()

i.e. calling a autocmd conditionally possible?

--
--
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 replace a string when a change occurred in another place

On 23.06.15 08:00, Rudra Banerjee wrote:
> function! Edname()
> python<<EOF
> import vim
> import fileinput
> with open("i.f90") as inp:
> for line in inp:
> if line.startswith("Program"):
> var = line.rsplit(' ', 1)[-1].strip()
> if line.startswith("End Program"):
> v2 = line.strip()
> print v2
> inp.close()
> STR="End Program "+var
> print STR
> for line in fileinput.input("i.f90", inplace=True):
> print line.replace(v2, STR).strip()
> EOF
> endfunction
>
> Now it is not working. It is printing the v2 and STR properly, but the
> file is NOT getting updated. Any clue?

Caveat: Yours is the first python program I've ever seen.
IIRC, it is the weird language which uses indentation
in place of brackets.

Tentative thoughts:
You have two file-reading loops, one of which appears to detect the
initial "foo", then print it. The second seems intended to make a single
replacement. If "inplace=True" ought to empower python to implicitly modify
the input file, then hopefully it is also implicitly printing the lines
you do not modify, or they must surely be lost? (Based solely on your
expectation that the input file should be modified, despite no explicit
mechanism to do that.)

Possible causes of failure:
Does the "i." indicate that file "f90" is opened for input? If so, then
how can you write to it? (Does python hide writing to a temp file, with
subsequent overwriting of the input file?) Is some form of
output.close() needed instead when closing for write? If python still
permits printing to stdout while "inplace=True", then you would need to
print to "f90", I expect, to modify the file instead. Are you relying
on the "endfunction" to implicitly invoke an ???.close() and that the
file will then be written?

I'm afraid that there's too much that is implicit in python for more
detailed guessing than that.

Erik

--
--
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: Problem with netrw and buftype

On Wed, Jun 24, 2015 at 02:25:03AM +0100, wednesday wrote:
> When I open up the explorer to put a new file into a split, once that new file
> is there the old one becomes unwritable due to buftype being set to nofile.
> This has been pretty frustrating and I have yet to find the answer. If this
> helps I'm using version 7.2.273 of Vim.
Pretty stupid of me, I think I just found the issue was having set autochdir in
my vimrc.

--
--
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: Search for character that doesn't have a combining character?

On Tuesday, June 23, 2015 at 4:20:32 PM UTC-5, ZyX wrote:
> 2015-06-24 0:02 GMT+03:00 Ben Fritz <fritzophrenic@gmail.com>:
> > On Tuesday, June 23, 2015 at 3:35:50 PM UTC-5, Ben Fritz wrote:
> >> I'm working on a custom command to add strikethrough to text, using the Unicode COMBINING LONG STROKE OVERLAY, 0x0336.
> >>
> >> In this command, I want to apply a strikethrough to a character, only if it is not already present.
> >>
> >> This pattern fails because it doesn't match *anything* with regexpengine set to 2, it does not match an unadorned character immediately before a struck-through base character, and it *does* match the last combining character in a word for some reason:
> >>
> >> [^\u0336]\%u0336\@!
> >>
> >> This pattern also fails, because it matches already struck-through base characters for some reason (although it does the same thing in both engines):
> >>
> >> [^\u0336][^\u0336]\@=
> >>
> >> What is the correct way to do this?
> >>
> >> Full command (attempted):
> >>
> >> '<,'>s;\%#=1\%V[^\u0336]\%u0336\@!;\=submatch(0)."\u0336";g
> >>
> >> Note, how I'm also limiting to a visual selection; so I'm trying to use the :s command for simplicity.
> >
> > My next attempt is to do two passes, first to remove the combining character from everywhere in the visual selection, and then to add it to the entire visual selection.
> >
> > But, my patterns for this task either don't match at all, or they remove the base character along with the combining character! Even this doesn't work, it removes the base character:
> >
> > echo join(split(getline('.'), "\u0336"),"")
>
> Though there is always one hack to get exactly one unicode codepoint
> from *valid* UTF-8 string:
>
> echo nr2char(char2nr(string[position :]))
>
> . You can use `len(nr2char(…))` to get the length of the first
> character and thus get to the second. I think this will allow you to
> construct needed \= expression, but the result would most likely be a
> definition of a new function due to its complexity.
>

Thanks! I agree this needs to be better supported in Vim's regex and tr() function. For my purposes I can pretty much always assume any combining characters are the strikethrough characters, making the replacement function trivial to implement with a nr2char(char2nr(submatch(0))) hack, but obviously this is not a good general solution as it will strip off all other combining characters when adding or removing the one character I'm actually interested in. I guess I could loop through the input string as you suggest if I'm interested in making a general solution at some point.

--
--
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: Search for character that doesn't have a combining character?

2015-06-24 0:02 GMT+03:00 Ben Fritz <fritzophrenic@gmail.com>:
> On Tuesday, June 23, 2015 at 3:35:50 PM UTC-5, Ben Fritz wrote:
>> I'm working on a custom command to add strikethrough to text, using the Unicode COMBINING LONG STROKE OVERLAY, 0x0336.
>>
>> In this command, I want to apply a strikethrough to a character, only if it is not already present.
>>
>> This pattern fails because it doesn't match *anything* with regexpengine set to 2, it does not match an unadorned character immediately before a struck-through base character, and it *does* match the last combining character in a word for some reason:
>>
>> [^\u0336]\%u0336\@!
>>
>> This pattern also fails, because it matches already struck-through base characters for some reason (although it does the same thing in both engines):
>>
>> [^\u0336][^\u0336]\@=
>>
>> What is the correct way to do this?
>>
>> Full command (attempted):
>>
>> '<,'>s;\%#=1\%V[^\u0336]\%u0336\@!;\=submatch(0)."\u0336";g
>>
>> Note, how I'm also limiting to a visual selection; so I'm trying to use the :s command for simplicity.
>
> My next attempt is to do two passes, first to remove the combining character from everywhere in the visual selection, and then to add it to the entire visual selection.
>
> But, my patterns for this task either don't match at all, or they remove the base character along with the combining character! Even this doesn't work, it removes the base character:
>
> echo join(split(getline('.'), "\u0336"),"")

Though there is always one hack to get exactly one unicode codepoint
from *valid* UTF-8 string:

echo nr2char(char2nr(string[position :]))

. You can use `len(nr2char(…))` to get the length of the first
character and thus get to the second. I think this will allow you to
construct needed \= expression, but the result would most likely be a
definition of a new function due to its complexity.

>
> --
> --
> 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: Search for character that doesn't have a combining character?

2015-06-24 0:02 GMT+03:00 Ben Fritz <fritzophrenic@gmail.com>:
> On Tuesday, June 23, 2015 at 3:35:50 PM UTC-5, Ben Fritz wrote:
>> I'm working on a custom command to add strikethrough to text, using the Unicode COMBINING LONG STROKE OVERLAY, 0x0336.
>>
>> In this command, I want to apply a strikethrough to a character, only if it is not already present.
>>
>> This pattern fails because it doesn't match *anything* with regexpengine set to 2, it does not match an unadorned character immediately before a struck-through base character, and it *does* match the last combining character in a word for some reason:
>>
>> [^\u0336]\%u0336\@!
>>
>> This pattern also fails, because it matches already struck-through base characters for some reason (although it does the same thing in both engines):
>>
>> [^\u0336][^\u0336]\@=
>>
>> What is the correct way to do this?
>>
>> Full command (attempted):
>>
>> '<,'>s;\%#=1\%V[^\u0336]\%u0336\@!;\=submatch(0)."\u0336";g
>>
>> Note, how I'm also limiting to a visual selection; so I'm trying to use the :s command for simplicity.
>
> My next attempt is to do two passes, first to remove the combining character from everywhere in the visual selection, and then to add it to the entire visual selection.
>
> But, my patterns for this task either don't match at all, or they remove the base character along with the combining character! Even this doesn't work, it removes the base character:
>
> echo join(split(getline('.'), "\u0336"),"")

I was about to suggest to use tr(), but:

echo tr("o\u0336", "o", "t") is# "o\u0336"
echo tr("o\u0336", "\u0336", "t") is# "o\u0336"
echo tr("o\u0336", "o\u0336", "t") is# "t"

apparently tr() thinks that character is a unicode codepoint *with*
all of the following combining characters.

I would say here that

1. Regexp engines need proper `\p` support from Perl/PCRE. Or, at
least, the opposite of \Z which tells RE engine to treat all unicode
codepoints in the same way.
2. tr() must *always* use "one character is one unicode codepoint"
when &encoding is unicode. It is too low-level tool to care about
character classes, and especially to join codepoints together.

>
> --
> --
> 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.