Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (6) </ 1 2 [3] 4 5 6 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Vim tips< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Dec. 12 2007,14:14 QUOTE

Some miscellaneous stuff that I've found useful on many occasions....

:split <filename>
Splits the window and opens filename.

:r!<command> add the output of command to the cursor location. It's not always pretty.

^
Move cursor to the first non-blank character of the current line (is better than Home/0 in many cases)

<number>gg
Go to the first non-blank character of line <number>.

When cursor is over a number, Ctrl+a increases the number, Ctrl+x decreases.

I'm sure there were more that I use a lot, and some more unusual, but I haven't waken up yet =op


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
lucky13 Offline





Group: Members
Posts: 1478
Joined: Feb. 2007
Posted: Dec. 12 2007,17:12 QUOTE

Quote
:r!<command> add the output of command to the cursor location. It's not always pretty.

That's my favorite way for making and editing playlists and other lists.

:r! find [appropriate flags/paths] | grep [content I want]

So for all my Schubert MP3s (my mp3s are all lower case)

:r! find ~/ | grep schubert

Then edit anything that needs to be fixed and save.


--------------
"It felt kind of like having a pitbull terrier on my rear end."
-- meo (copyright(c)2008, all rights reserved)
Back to top
Profile PM WEB 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Dec. 12 2007,18:12 QUOTE

Vim's power also has it's downside.  For example, I've found it difficult to correct a bug in a function when there's another copy of it pasted somewhere else in my code  :(
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Dec. 14 2007,14:22 QUOTE

Quote
I've found it difficult to correct a bug in a function when there's another copy of it pasted somewhere else in my code
I've read this a couple times, and I'm still not sure what you're saying. You're talking about vim functions?
In any case, I don't understand why you would have the same function twice in the same code anyway. The whole reason behind using functions is to prevent the need for duplicate code.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: Dec. 14 2007,20:33 QUOTE

Quote (mikshaw @ Dec. 14 2007,09:22)
Quote
I've found it difficult to correct a bug in a function when there's another copy of it pasted somewhere else in my code
I've read this a couple times, and I'm still not sure what you're saying. You're talking about vim functions?
In any case, I don't understand why you would have the same function twice in the same code anyway. The whole reason behind using functions is to prevent the need for duplicate code.

The point was that it's easy to inadvertantly push the "wrong" key during the process of coding, with unexpected results.  That happened to me recently.  After a half hour of trying to figure out why a simple function wouldn't work, I found a copy of it pasted way down in my code!
Back to top
Profile PM 
27 replies since Dec. 10 2007,08:11 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (6) </ 1 2 [3] 4 5 6 >/
reply to topic new topic new poll
Quick Reply: Vim tips

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code