How do I replace text in a selection?

前端 未结 11 1914
借酒劲吻你
借酒劲吻你 2021-01-29 19:10

I\'ve just started using Sublime Text 2, coming from emacs.

I have a region of text selected. Within that region, I\'d like to replace all text instances of \'0\' with \

相关标签:
11条回答
  • 2021-01-29 19:27

    First, select the portion of the text containing the bits you want to change. On Windows (sorry) it's Ctrl + H or Find > Replace... This opens up the Find/Replace boxes at the bottom of the file. Enter your details then click Replace All (or Ctrl + Alt + Enter)

    0 讨论(0)
  • 2021-01-29 19:29

    Some of the answers here haven't really helped.

    People are showing you how to find stuff, but now how to replace it.

    I just had a look, and it looks like it's Ctrl+H for replace, then you get the find dialog as well as a replace dialog. This worked for me.

    0 讨论(0)
  • 2021-01-29 19:35

    ST2 has a feature for changing multiple selections at once.

    1. Double click the first instance of 0 that you want to change.
    2. Press the key for Find->Quick Add Next* to select the next instance of 0, and repeat until you've selected all the instances of 0 that you want to change.
      If this method selects an instance that you want to skip, press the key for Find->Quick Skip Next.
    3. Verify that the multiple highlighted fields are what you want to replace. Next, type in '255' and it should modify all of the selected instances simultaneously.

    *Look at the Find menu on the menu bar to find the correct shortcut key for your system. For vanilla Windows, the menu tells you that Find->Quick Add Next is Ctrl+D and Find->Quick Skip Next is Ctrl+K,Ctrl+D.

    0 讨论(0)
  • 2021-01-29 19:37

    On a Mac you can can select the text that you are after then press: cmd + ctrl + G

    This will select every instance of your selected text within the same document. If you now start typing to replace your original highlighted text, you will replace all of the other occurrences at the same time.

    0 讨论(0)
  • 2021-01-29 19:40

    1) Ctrl + F (or Cmd + F on a Mac);
    2) Enter the string you want to find on the input at the bottom of the window.
    3) Press "Find All";

    All of the appearances are now selected. Do whatever you want.

    Aside

    There are a bunch of options at the left of the input that opens on Ctrl + F. There's one that says something like "Find in selected text". Select a bunch of text, check that option and repeat the same steps above starting from 2). Now, only matches belonging to that selection are selected.

    0 讨论(0)
提交回复
热议问题