searching
For basic searching:/pattern - search forward for pattern ?pattern - search backward n - repeat forward search N - repeat backward
Some variables you might want to set:
:set ignorecase - case insensitive :set smartcase - use case if any caps used :set incsearch - show match as search proceeds :set hlsearch - search highlighting
More cool searching tricks:
* - search for word currently under cursor
g* - search for partial word under cursor
(repeat with n)
ctrl-o, ctrl-i - go through jump locations
[I - show lines with matching word under cursor
Search and replace...
:%s/search_for_this/replace_with_this/ - search whole file and replace :%s/search_for_this/replace_with_this/c - confirm each replace
text selection
V - selects entire lines v - selects range of text ctrl-v - selects columns gv - reselect block
After selecting the text, try d to delete, or y to copy, or :s/match/replace/, or :center, or !sort, or...
Here's one way to move selected text over a few spaces:
- select a chunk of code using capital V and the arrow keys (or j, k) - type colon - then type s/^/ / - hit returnWhat you've done is replace the beginning of each selected line (the ^ symbol means "the beginning of the line") with spaces.
PS Dit werkt echter niet in traditionele VI. Gebruik daar
mb : mark beginpunt
y'b : op het eindpunt, hiermee yank je text
handige link http://www.cs.swarthmore.edu/help/vim/home.html
Geen opmerkingen:
Een reactie posten