I've started using Vim for development and i'm really starting to like it a lot. But there are a few features of my usual editor (EditPlus) that i would like to have in Vim, maybe you can suggest ways of simulating or educating me on these?
- Global search of an entire project's source files for search term.
- Adding bookmarks to a file's source lines that i can jump to with a key press.
- Find all occurrences of word under cursor.
- Search and replace that lets me step through each for confirmation.
- Change line or selection to uppercase, lowercase, capitalize.
- Match brace/tag
P.S. I'm using Vim on Windows.
1. Global search of an entire project's source files for search term.
:vim
searches all files matching a wildcard.
2. Adding bookmarks to a file's source lines that i can jump to with a key press.
''
will swap your current cursor position and previous onem*
where * is a bookmark name (a-z) ,'*
jumps to the bookmark
3. Find all occurrences of word under cursor.
*
searches forward#
searches backward- use
:set hlsearch
to highlight your search
4. Search and replace that lets me step through each for confirmation.
c
flag to:substitute
.
5. Change line or selection to uppercase, lowercase, capitalize.
~
changes the case of the character under the cursor.
6. Match brace/tag
%
. Requires enabling macros/matchit.vim or something similar for HTML tags support.
Check out making your own _vimrc to set default behaviors. Have fun vimming!
To add to what phi said:
1) :vimgrep /pattern/ **/*.c
will search for pattern in all the .c files from the current directory down.
2) Use uppercase letters to set a mark that you can jump to from another file. e.g. mA
to set a mark in the current file, then when editing a different file 'A
will jump to the mark in the first file.
3) *
and #
search forward and backwards for the word under the cursor. n
and N
will repeat the previous search in the same or opposite direction. You can also use :g /pattern/
to see all the lines that match a pattern at once. There are also several plugins that will hide away (fold) all the lines that do not match a pattern.
5) gu<movement>
and gU<movement>
will change text to lower or upper case respectively. <movement>
can be any vim movement, e.g. gU$
to make text from the current cursor position to the end of the line uppercase. There is also g~<movement>
to switch the case of the text. Alternatively you can highlight the text and use u, U or ~ respectively.
精彩评论