开发者

What Vim plugins or native behaviour simulates these features? [closed]

开发者 https://www.devze.com 2023-03-19 03:42 出处:网络
It's difficult to tell what is bein开发者_C百科g asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. Fo
It's difficult to tell what is bein开发者_C百科g asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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?

  1. Global search of an entire project's source files for search term.
  2. Adding bookmarks to a file's source lines that i can jump to with a key press.
  3. Find all occurrences of word under cursor.
  4. Search and replace that lets me step through each for confirmation.
  5. Change line or selection to uppercase, lowercase, capitalize.
  6. 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 one
  • m* 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号