Find patterns in Gvim

17 праглядаў
Перайсці да першага непрачытанага паведамлення

Julius Hamilton

не прачытана,
9 вер 2021 г., 08:24:349.09.21
да v...@vim.org
Hey,

From trying it myself, it seems that the "find" menu option in Gvim does not allow entering patterns or regular expressions, such as a period to represent any character, or "\n" to represent a newline, but only literal, explicit text matching.

I was curious why this is and if there is any GUI / menu way to search for regular expression patterns or if you must use the Vim text-based command "/" for this.

Thank you very much,
Julius

Christian Brabandt

не прачытана,
9 вер 2021 г., 08:37:109.09.21
да v...@vim.org
Yes, I think the :promptfind and :promptreplace commands do a literal
search and replace only. If you want to use regexes, just use the `/`
(for finding) or `:%s` (for replacing) command.

Best,
Christian
--
Frau Weber liest in einem Gedichtband. Auf einmal ruft sie: "Du, Theo,
stell Dir vor, hier hat doch tatsächlich ein gewisser Rilke das
Gedicht abgeschrieben, das Du vor dreißig Jahren eigens für mich
geschrieben hast!"

Bram Moolenaar

не прачытана,
9 вер 2021 г., 13:42:519.09.21
да vim...@googlegroups.com,Julius Hamilton,v...@vim.org
This was an intentional choice. The idea is that the menu would be used
by beginners, who don't know the keyboard commands yet. These users
would also not know what characters need to be escaped in a pattern.

As Christian mentioned, once you know Vim a bit you would just use
"/pattern" and ":s/from/to".

--
hundred-and-one symptoms of being an internet addict:
16. You step out of your room and realize that your parents have moved and
you don't have a clue when it happened.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Адказаць усім
Адказаць аўтару
Наперад
0 новых паведамленняў