vimtips Profile
vimtips

@vimtips

Followers
21K
Following
0
Media
0
Statuses
1K

Like VI or VIM? So do I! Use it more effectively with daily tips. Catch them all at http://t.co/ty7XLqgePG.

Indiana
Joined August 2008
Don't wanna be here? Send us removal request.
@vimtips
vimtips
9 years
gq{movement} to wrap text, or just gq while in visual mode. gqap will format the current paragraph.
1
20
54
@vimtips
vimtips
9 years
g< CTRL-G > to see technical information about the file, such as how many words are in it, or how many bytes it is.
1
23
63
@vimtips
vimtips
9 years
:%s/[.!?]\_s\+\a/\U&\E/g will uppercase the first letter of each sentence (except the very first one).
3
14
35
@vimtips
vimtips
9 years
:g/_pattern_/s/^/#/g will comment out lines containing _pattern_ (if '#' is your comment character/sequence) (via @vrybas_).
0
18
81
@vimtips
vimtips
9 years
:vimgrep /stext/ **/*.txt | :copen.searches for stext recursively in *.txt files and show results in separate window (via @danechkin).
0
17
56
@vimtips
vimtips
9 years
%s/^ \ n/ / to delete all empty lines (remove spaces from command!) (via @marekkubis).
2
10
42
@vimtips
vimtips
9 years
ggVG= will auto-format the entire document.
6
22
65
@vimtips
vimtips
9 years
In gvim, change the cursor depending on what mode you are in (normal, insert, etc):
1
5
25
@vimtips
vimtips
9 years
To search for a URL without backslashing, search backwards! Example: ?
1
5
22
@vimtips
vimtips
9 years
CTRL-w | and CTRL-W _ maximize your current split vertically and horizontally, respectively. CTRL-W = equalizes 'em.
1
19
55
@vimtips
vimtips
9 years
Basic commands 'f' and 't' (like first and 'til) are very powerful. See :help t or :help f.
1
17
26
@vimtips
vimtips
9 years
:tabo will close all open tabs except the active one.
3
17
38
@vimtips
vimtips
9 years
/\%>80v.\+ with search highlighting (:set hlsearch) will highlight any text after column 80.
2
10
24
@vimtips
vimtips
9 years
/< CTRL-r >< CTRL-w > will pull the word under the cursor into search.
2
16
50
@vimtips
vimtips
9 years
"+y to copy to the X11 (or Windows) clipboard. "+p to paste from it.
2
13
35
@vimtips
vimtips
9 years
ga will display the ASCII, hex, and octal value of the character under the cursor.
0
22
46
@vimtips
vimtips
9 years
[I (that's bracket-open, capital-i) shows lines containing the word under the cursor (via @nvie).
3
18
74
@vimtips
vimtips
9 years
% matches brackets {} [] (), and with matchit.vim, also matches def/end, < ?php/?>, < p>/< /p>, etc.
1
9
31
@vimtips
vimtips
9 years
:40,50m30 will move lines 40 through 50 to line 30. Most visual mode commands can be used w/ line numbers.
1
16
46
@vimtips
vimtips
9 years
In your ~/.vimrc, `set clipboard=unnamed`. Now all operations work with the OS clipboard. No need for "+, "* (via @panozzaj).
3
61
175