Saturday, January 29, 2011

[VIM]: Help with constructing error format string....

Hi,
My compiler produces single line error strings of the form
ID Rule Alias Severity
File Line Wt Message
e.g

[4FD9] ErrorType ErrorName Error /path/to/file.ext
332 10 error message

where 332 is the line number and 10 is error severity level
The Issue is that the formatting results in variable number of spaces
between each element.
I would like to Display just the error message in the status line in
quickfix mode
The error format written by me to capture the above string is

set efm=%W\[[0-9A-Z]*]\\s%#\\S%#\\s%#\\S%#\\s%#%f\\s%#%l\\s%#[0-9]s%#
%m

but this results in displaying the entire line without going to the
file in question.
Any Idea on what I am doing wrong?
Regards
Vijay
PS:

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

Friday, January 28, 2011

how to add all files found in :vimgrep to arglist?

I use Vim7.3.107, now when I use :vim command:
:vim /foo/ **.c

it no longer load all file into buffer list. it makes :vim command
faster, but now I can not use a single bufdo command to process all
these file. how to add these result file into some space to make I can
use a single xxxdo (maybe bufdo or argdo) to process all these file?

thx all guys 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

Re: Indpendant position marks for scripts ?

Ben Schmidt <mail_ben_schmidt@yahoo.com.au> [11-01-29 06:24]:
> On 29/01/11 3:42 PM, meino.cramer@gmx.de wrote:
> >
> >Hi,
> >
> >I want to process a text with script.
> >The text contains of two regions:
> >The first region contains of lines beginning with keyword_a
> >and the second one start with keyword_b.
> >I want to sort the first region using sort with pattern_a and
> >after that I want to sort the second region with pattern_b.
> >
> >I can set the start of the forst sort with
> >
> > : /keyword_a
> >
> >in the script. But I dont know how to limit the range of the first
> >sort so that only lines starting with keyword_a are sorted using
> >pattern_a. Same goes for the second region...
>
> Try something like
>
> :0/^a/,/^\(a\)\@!/sort
>
> It means loosely:
>
> : - perform an ex command
> 0 - from before the beginning of the file
> /^keyword_a/ - find a line beginning with 'keyword_a'
> , - and operate until
> / - we find
> ^ - the beginning of a line
> \(keyword_a\)\@! - where 'keyword_a' doesn't match
> /sort - with the sort command
>
> Ben.
>
>
>
> --
> 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
>

Hi Ben,

...got some problems here...may be due to a not-so-exact description
of what I need...

I will try to explain... ;)

The file in its original version looks like this ( there is additional
text following keyword_[ab], which I left out here, but makes the
final
sort /<pattern>/
necessary).

something
different
fnord
foo
baz
gnu
keyword_a
noordszki
looping
tatdat
drool
socket
pipe
Unix
tools
cryptic
other-pipe
other-Unix
other-tools
other-cryptic
keyword_a
keyword_a
keyword_a
keyword_b
keyword_b
keyword_a
keyword_a
keyword_a
keyword_b
keyword_a
keyword_a
keyword_a
keyword_b
keyword_a
keyword_b
keyword_b

after the file is loaded, my script does a

:gg
:/keyword_a
:.,$sort

this way the file becomes

something
different
fnord
foo
baz
gnu
keyword_a
noordszki
looping
tatdat
drool
socket
pipe
Unix
tools
cryptic
keyword_a
keyword_a
keyword_a
keyword_a
keyword_a
keyword_a
keyword_a
keyword_a
keyword_a
keyword_a
keyword_b
keyword_b
keyword_b
keyword_b
keyword_b
keyword_b

:/^keyword_a/,/^\(keyword_a\)\@!/sort /<pattern>/

This line triggers an error saying: E493 Backward range given.

I looked into the help, which says that start and end of the range are
swapped and -- if the command is preceeded with :silent the start and
end will be automagically swapped.
I did this.

Now no error is given anymore but the the script does not work --
the sort of the above line ignores its /<pattern>/.

I have simply no glue :) what is happening here...

Thank you very much in advance for any enlightment! :)

Best regards,
mcc


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

Re: Starting out with VIM and C++

> Hey Nick,
>
> If you are relatively new to vim, I suggest that you start using the
> inbuilt help (:help) as much as possible.
>
> There a couple of plugins that might make writing code a lot easier:
> 1. Nerd Tree
> 2. Nerd Commenter
> 3. Matchit
> 4. Surround.vim
> 5. Syntastic
> 6. Pyclewn
>
> (google for them, or search on vim's site)
>
> I have not used pyclewn myself; I am mostly into Ruby. It might be
> advantageous for you considering you are doing C++.
>
> P.S. : Have a look at Bram's article called "Seven Habbits of
> Effective Text Editing" [1] if you have some time.
>
> [1] http://www.moolenaar.net/habits.html

I don't use all of the following, but mentioning some more good ones,
so that it kind of documents itself (one could search the archive):
1. FuzzyFinder (must have :))
2. Fugitive
3. Command-T
4. pastie
5. camelcasemotion

--
Anurag Priyam
http://about.me/yeban/

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

Re: Starting out with VIM and C++

> I just started an introductory course on C++, and I would like to take the
> time to use VIM as an IDE. What do I need to do to get colored syntax and
> make it more usable for C++ programming?

Hey Nick,

If you are relatively new to vim, I suggest that you start using the
inbuilt help (:help) as much as possible.

There a couple of plugins that might make writing code a lot easier:
1. Nerd Tree
2. Nerd Commenter
3. Matchit
4. Surround.vim
5. Syntastic
6. Pyclewn

(google for them, or search on vim's site)

I have not used pyclewn myself; I am mostly into Ruby. It might be
advantageous for you considering you are doing C++.

P.S. : Have a look at Bram's article called "Seven Habbits of
Effective Text Editing" [1] if you have some time.

[1] http://www.moolenaar.net/habits.html

--
Anurag Priyam
http://about.me/yeban/

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

Re: Typing numbers

On Fri, Jan 28, 2011 at 11:28:27PM EST, Ben Schmidt wrote:

>> [*] you can add more than one character, so if you wanted, you could
>> get fancy with something like
>>
>> 40i-=<esc>
>>
>> to get a nice row of 80 characters like "-=-=-=-...=-=-=-=" but again
>> you then have to do the math and divide down. Not grievous, but I can
>> count the real-world times I've done that on one hand.

This has a flavor of déja-vu, Tim.. The more I think about it, the more
it sounds like it was you who gave out this tip initially.. I thought..
nice.. and then was never able to remember it properly.

> Or you can start taking down a receipt number without pushing i, as I
> did last week. I typed 1011 before realising it hadn't appeared on the
> screen. So then I pushed i and typed the whole 13-digit number, and when
> I hit <Esc> I got 1011 copies of it, all running together as I had typed
> no spaces or newlines or anything. Brilliant! There's 12 KB right there!
>
> Was that too off-topic?

Well, the OP certainly appears to have lost interest.. if that's anything
to go by.. :-)

cj

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

Re: Typing numbers

On 01/28/2011 10:53 PM, Chris Jones wrote:
> On Fri, Jan 28, 2011 at 05:35:02PM EST, Tim Chase wrote:
>>> I concur that prefixing Vim normal mode commands with a count, such as
>>> '7dw' to delete the next seven words is ineffective.. Something like
>>> 'dw....' where you delete the next word (dw) and repeat the last command
>>> (.) a number of times is the way I normally do it because I don't have
>>> to count the words before I even start deleting. While I hit the dot (.)
>>> repeatedly, I can see what I'm deleting and I know when to stop.. And
>>> I can always hit 'u' for undo to bring back the words I deleted one at
>>> a time in the event I got carried away.
>>
>> This breaks when using t/T with ";" to repeat the motion as it just finds
>> the same one you just found. I have to break down and count for those :)
>
> Another reason why I don't use t/T (and don't care much for f/F either).
>
> There's only so much can fit under my skull.. and I prefer to stick with
> a limited subset of keyboard actions that may not be the quickest and
> most efficient for all occasions.. but that I can use without hesitation
> or incurring any overhead rememberiing. Namely that if the cursor is at
> the beginning of the line above and I want to get to the '..ii..' typo
> in 'rememberiing.', I find it considerably more effective when all is
> told to just hit 'w' till I get to the beginning of the word
> 'rememberiing'.. and either hit llll.. or hit 'e' to get to the end of
> the word and then 'hh' followed by 'x' to delete the last of the two

I used to do this and really hated it. I'm using ',' as leader for
mappings but if you don't, it's much easier, imho, to hit 'fi', then
hit ';' as many times as needed and then use ',' if you overshoot it.
Much fewer keystrokes than using 'w' in most cases.

But I mostly prefer to use a small function I wrote that jumps to 25%,
50% and 75% of current line (not including leading/trailing spaces) in
combination with motpat plugin mappings that make 'w' and 'b' commands
go to the next word ignoring punctuation. I use my function to jump
to closest spot to where I want to go and then it's either 'w', 'b', 'f'
or 't'. In 99% of cases I only need 2 keystrokes.

-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