Tim Chase | 1 Dec 2010 01:17

Re: filter txt file based on start and ending marks

On 11/30/2010 04:01 PM, bboyjkang wrote:
>>     :g/interesting/sil! ?start?,/end/s/^/XXX/
>>     :v/^XXX/d
>>     :%s/^XXX
>
> Is the “start” and “end” something you have to add yourself? Is it
> possible to do this: Let’s say that once I find the pattern
> “interesting”, I’d like to select the line that contains
> “interesting”, or maybe include the line above and the line below that
> line that contains “interesting”, for a total of 3 lines, or perhaps
> the entire paragraph that contains “interesting”. Then, “start” is
> automatically put at the top of the paragraph/line(s), and “end” is
> put at the bottom of the paragraph/line(s). Now, I can do pattern
> matches or substitutions only on ranges between “start” and “end” that
> surround “interesting”.

(Rearranged to trimmed inline-quoting rather than top-posting, as 
is preferred on the mailing-list)

Yes, you can give other relative ranges.  Note that it breaks down as

   :g/pattern/action_to_perform_on_matching_lines

where action happens to be

   <range>s/foo/bar/

(prefixed with "sil!" as previously detailed) and where <range> 
happens to be "search backwards for pattern A, through searching 
forwards to pattern B".  For the line above/below version, you 
(Continue reading)

Tim Chase | 1 Dec 2010 01:21

Re: filter txt file based on start and ending marks

On 11/30/2010 04:01 PM, bboyjkang wrote:
> line that contains “interesting”, for a total of 3 lines, or perhaps
> the entire paragraph that contains “interesting”. Then, “start” is
> automatically put at the top of the paragraph/line(s), and “end” is
> put at the bottom of the paragraph/line(s).

Oh, I missed the paragraph bits...if they're blank-line separated 
paragraphs, you can use the range '{,'} as in

   g/interesting/sil! '{,'}s/^/XXX

You can read about those marks at

   :help '{
   :help '}

-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

Ken Arromdee | 1 Dec 2010 01:24
Picon

Re: Another question: forking

On Tue, 30 Nov 2010, Gary Johnson wrote:
>>>> gvim used to fork and run in the background.  7.2 doesn't seem to do this.
>>> Well, it does for most.  How are you invoking gvim?  I'd suspect an
>>> alias or script getting in the way.
>> Try
>> gvim -u NONE
>> That'll be a start at tracking down the cause of your difficulty.
> Also, you may want to use the full path name to gvim (e.g.,
> /usr/bin/gvim) to avoid local scripts, functions or aliases.

When I do that, it still doesn't fork (although I can tell I am not getting
local scripts because the font that is set in my .vimrc is no longer being
used.)

I managed to "solve" my problem by downloading gvim 7.3 and using that instead
of the 7.2.284 that comes with Mandriva.  When I download it myself and compile
it myself, it forks.

--

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

AK | 1 Dec 2010 04:26
Picon

How to find start/end of char-wise visual selection?


Hi, this is for Vim7.3.. Looking up docs for line(), it says that
arg='.' will give you cursor position, and 'v' will give you beginning
of visual selection when in visual mode, and '.' will give you the end
of it. For column, col() should be used, but there's no 'v' arg for it.

So, how can I do this? Let's say I have a char-wise selection from
column 10 to 20, how can I get numbers 10 and 20? -ak

--

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

Christian Brabandt | 1 Dec 2010 08:03

Re: How to find start/end of char-wise visual selection?

On Wed, December 1, 2010 4:26 am, AK wrote:
>
> Hi, this is for Vim7.3.. Looking up docs for line(), it says that
> arg='.' will give you cursor position, and 'v' will give you beginning
> of visual selection when in visual mode, and '.' will give you the end
> of it. For column, col() should be used, but there's no 'v' arg for it.

Yeah, I remember, I wondered about it too. I even thought about creating
a patch, but didn't so far, because you can easily get the column using
the getpos() function together with the marks '< for start and '> for end
of visual selection. For my plugin NrrwRgn, I use getpos("'>") for the line
and virtcol("'>") for the virtual column of the end of the visual selection
(and the same for the start of the visual selection).

> So, how can I do this? Let's say I have a char-wise selection from
> column 10 to 20, how can I get numbers 10 and 20? -ak

echo "start at line " getpos("'<")[1] " column: " virtcol("'<")
echo "end at line " getpos("'>")[1] " column: " virtcol("'>")

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

Dotan Cohen | 1 Dec 2010 15:58
Picon
Gravatar

Change background colour to specific colour

I have been googling for a way to change the background colour of VIM
to a specific colour. For example, I'd like it to be #c6c0d7. Is there
no way to do such a thing? I only see references to using
already-configured colours in VIM.

Thanks.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--

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

Christian Brabandt | 1 Dec 2010 16:12

Re: Change background colour to specific colour

On Wed, December 1, 2010 3:58 pm, Dotan Cohen wrote:
> I have been googling for a way to change the background colour of VIM
> to a specific colour. For example, I'd like it to be #c6c0d7. Is there
> no way to do such a thing? I only see references to using
> already-configured colours in VIM.

For the gui version, this is possible. See :h gui-colors

So this should work:
:hi Normal guibg=#c6c0d7

For the terminal version, this depends on your terminal and vim has no
control over those settings.

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

Brett Stahlman | 1 Dec 2010 16:20
Picon

Re: Change background colour to specific colour


On Dec 1, 9:12 am, "Christian Brabandt" <cbli... <at> 256bit.org> wrote:
> On Wed, December 1, 2010 3:58 pm, Dotan Cohen wrote:
> > I have been googling for a way to change the background colour of VIM
> > to a specific colour. For example, I'd like it to be #c6c0d7. Is there
> > no way to do such a thing? I only see references to using
> > already-configured colours in VIM.
>
> For the gui version, this is possible. See :h gui-colors
>
> So this should work:
> :hi Normal guibg=#c6c0d7
>
> For the terminal version, this depends on your terminal and vim has no
> control over those settings.

Although you don't have as much control with a color terminal, you can
still use this basic mechanism: e.g.,
:hi Normal ctermbg=blue
You can also use color numbers.

:help cterm-colors
:help xterm-color

Brett Stahlman

>
> regards,
> Christian

(Continue reading)

Ben Fritz | 1 Dec 2010 16:34
Picon

Re: Problem with new line anchor in new syntax file


On Nov 30, 9:12 am, Kamil Libich <kamil.lib... <at> gmail.com> wrote:
> Hi,
>
> I'm using Vim 7.2 under XP x32
>
> I don't know why, the new line anchor seems not working in my syntax file
> which I'd like to prepare for myself.
>
> I want to highlight the 'Test' word which is at the beginning of the line.
> To do that I use:
>
> syn match tsTestName /^Test/
> highlight link tsTestName Special
>
> and it didn't highlight.
>
> Any suggestions?
>

1. Does Special have a highlight definition different than the
surrounding text?
2. Is this the only syntax rule you are applying? There are precedence
rules in :help :syn-priority

I have this mapping in my .vimrc to help debug syntax files:

  nmap <F10>
        \ :echo '<'.synIDattr(synIDtrans(synID(line('.'),col('.'),
1)),'name').'> from:' <bar>
(Continue reading)

Ben Fritz | 1 Dec 2010 16:37
Picon

Re: The 'default highlighting' after loading empty (each line commented) syntax file


On Nov 30, 12:30 pm, Kamil Libich <kamil.lib... <at> gmail.com> wrote:
> Hi,
>
> I'm writing my own syntax file. From the beginning I came across some
> problems. Whereas some of them I'm going to solve myself, one of the
> problems appears to be solved at the beginning.
>
> I created a syntax file in which I commented each line. Basically, that file
> looks like below:
>
> (BOF)
> " syn some text
> " syn some text
> " syn some text
> (...)
> " highlight some text
> (EOF)
>
> I named my syntax file as test01.vim and I put it into vim72\syntax folder.
>
> Then I opened my file with my language.
> Then I cleared syntax by executing :cal SetSyn(""). As a result of that I've
> got white text on the black background. That is fine.
> Then I called my syntax file by executing :cal SetSyn("test01.vim") and as a
> result of doing that a surprise: instead of having expected no change
> (becouse I didn't define anything in my syntax file) and still having white
> text on black background I've got some highighting in a two colors: yellow
> (words as 'on' and 'check') and purple (numbers and everything in  " ").
>
(Continue reading)


Gmane