Get Emacs to jump to the start of a word after isearchHow can I configure incremental search to put my cursor at the start of whitespace rather than the end?Customize isearch to start from buffer startMake forward-word not to jump over newline characterGet word at pointSelecting (i.e., as the region) the current match in incremental searchisearch but don't move the cursor until I ask to searchclear highlighted matches of an isearchMake isearch commands search only at the beginning of wordsJump to word in another window
Are professors obligated to accept supervisory role? If not, how does it work?
Would scoring well on a non-required GRE Mathematics Subject Test make me more competitive?
More than three domains hosted on the same IP address
I won a car in a poker game. How is that taxed in Canada?
Do aarakocra have arms as well as wings?
When calculating averages, why can we treat exploding die as if they're independent?
What makes things real?
How to plot two curves with the same area under?
How can faith be maintained in a world of living gods?
Why did Tony's Arc Reactor do this?
Did "Dirty Harry" feel lucky?
Supervisor wants me to support a diploma-thesis SW tool after I graduated
What is the purpose of the rotating plate in front of the lock?
Dragons and gems
What's the biggest difference between these two photos?
How to finish my PhD?
The Green Glass Door, Revisited
Bacteria vats to generate edible biomass, require intermediary species?
How strong is aircraft-grade spruce?
How is the phase of 120V AC established in a North American home?
Word for something that used to be popular but not anymore
Why is it that I have to play this note on the piano as A sharp?
How do we create our own symbolisms?
What precisely does the commonly reported network hash rate refer to?
Get Emacs to jump to the start of a word after isearch
How can I configure incremental search to put my cursor at the start of whitespace rather than the end?Customize isearch to start from buffer startMake forward-word not to jump over newline characterGet word at pointSelecting (i.e., as the region) the current match in incremental searchisearch but don't move the cursor until I ask to searchclear highlighted matches of an isearchMake isearch commands search only at the beginning of wordsJump to word in another window
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
If I use isearch to search for the word "accommodating" in my document, I have to type acc before the cursor jumps to the word. When I press enter the cursor is on the the second "c" as in acCommodating. This strikes me as rather unintuitive because I have to go back two characters to begin editing the word. In Vim, search puts the cursor at the start of the word. Can I replicate this behaviour in Emacs?
isearch words
add a comment |
If I use isearch to search for the word "accommodating" in my document, I have to type acc before the cursor jumps to the word. When I press enter the cursor is on the the second "c" as in acCommodating. This strikes me as rather unintuitive because I have to go back two characters to begin editing the word. In Vim, search puts the cursor at the start of the word. Can I replicate this behaviour in Emacs?
isearch words
add a comment |
If I use isearch to search for the word "accommodating" in my document, I have to type acc before the cursor jumps to the word. When I press enter the cursor is on the the second "c" as in acCommodating. This strikes me as rather unintuitive because I have to go back two characters to begin editing the word. In Vim, search puts the cursor at the start of the word. Can I replicate this behaviour in Emacs?
isearch words
If I use isearch to search for the word "accommodating" in my document, I have to type acc before the cursor jumps to the word. When I press enter the cursor is on the the second "c" as in acCommodating. This strikes me as rather unintuitive because I have to go back two characters to begin editing the word. In Vim, search puts the cursor at the start of the word. Can I replicate this behaviour in Emacs?
isearch words
isearch words
edited 10 hours ago
Drew
51.2k4 gold badges65 silver badges115 bronze badges
51.2k4 gold badges65 silver badges115 bronze badges
asked 11 hours ago
devcomdevcom
801 silver badge8 bronze badges
801 silver badge8 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
As Drew pointed in his answer you can also end the search with another key such as M-b
or M-f
, which for words boundaries works good, but my solution is kind of more general: define a key to put the cursor at the beginning (or end) of the pattern I'm searching:
(use-package isearch
:bind (:map isearch-mode-map
("C-<return>" . isearch-done-opposite))
:init (defun isearch-done-opposite (&optional nopush edit)
"End current search in the opposite side of the match."
(interactive)
(funcall #'isearch-done nopush edit)
(when isearch-other-end (goto-char isearch-other-end))))
Basically, map C-Ret
to another function isearch-done-opposite
which checks the variable isearch-other-end
which is defined in isearch.el
as:
(defvar isearch-other-end nil) ; Start (end) of match if forward (backward).
This will work with forward and backward searches.
add a comment |
There's really nothing to replicate, I think. You somehow have to tell Isearch that you're done typing text for the search string - you have to hit some key to tell it that. So at a minimum you have C-s acc <SOME KEY>
.
You can end Isearch with any key that is not already bound to something in isearch-mode-map
. (And even then, you can rebind any keys that are already bound.) And the key that ends Isearch can do whatever you like, including move back to a word beginning.
So you can end it with M-b
(that key isn't bound for Isearch, by default), which goes back to the beginning of the current word:
C-s acc M-b
That's not so hard. Whether you find it "intuitive" probably has to do with what you're already used to. There are a zillion use cases for Isearch, only one of which is wanting to move to the beginning of a matching word.
C-h k M-b
tells you:
M-b
runs the commandbackward-word
(found inglobal-map
), which is an
interactive compiled Lisp function insimple.el
.
It is bound to
M-b
,ESC left
.
(backward-word &optional ARG)
Move backward until encountering the beginning of a word.
With argument
ARG
, do this that many times.
IfARG
is omitted ornil
, move point backward one word.
The word boundaries are normally determined by the buffer’s
syntax table and character script (according to
char-script-table
), butfind-word-boundary-function-table
,
such as set up bysubword-mode
, can change that. If a Lisp
program needs to move by words determined strictly by the syntax
table, it should usebackward-word-strictly
instead. See Info
node (elisp) Word Motion for details.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "583"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f52549%2fget-emacs-to-jump-to-the-start-of-a-word-after-isearch%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As Drew pointed in his answer you can also end the search with another key such as M-b
or M-f
, which for words boundaries works good, but my solution is kind of more general: define a key to put the cursor at the beginning (or end) of the pattern I'm searching:
(use-package isearch
:bind (:map isearch-mode-map
("C-<return>" . isearch-done-opposite))
:init (defun isearch-done-opposite (&optional nopush edit)
"End current search in the opposite side of the match."
(interactive)
(funcall #'isearch-done nopush edit)
(when isearch-other-end (goto-char isearch-other-end))))
Basically, map C-Ret
to another function isearch-done-opposite
which checks the variable isearch-other-end
which is defined in isearch.el
as:
(defvar isearch-other-end nil) ; Start (end) of match if forward (backward).
This will work with forward and backward searches.
add a comment |
As Drew pointed in his answer you can also end the search with another key such as M-b
or M-f
, which for words boundaries works good, but my solution is kind of more general: define a key to put the cursor at the beginning (or end) of the pattern I'm searching:
(use-package isearch
:bind (:map isearch-mode-map
("C-<return>" . isearch-done-opposite))
:init (defun isearch-done-opposite (&optional nopush edit)
"End current search in the opposite side of the match."
(interactive)
(funcall #'isearch-done nopush edit)
(when isearch-other-end (goto-char isearch-other-end))))
Basically, map C-Ret
to another function isearch-done-opposite
which checks the variable isearch-other-end
which is defined in isearch.el
as:
(defvar isearch-other-end nil) ; Start (end) of match if forward (backward).
This will work with forward and backward searches.
add a comment |
As Drew pointed in his answer you can also end the search with another key such as M-b
or M-f
, which for words boundaries works good, but my solution is kind of more general: define a key to put the cursor at the beginning (or end) of the pattern I'm searching:
(use-package isearch
:bind (:map isearch-mode-map
("C-<return>" . isearch-done-opposite))
:init (defun isearch-done-opposite (&optional nopush edit)
"End current search in the opposite side of the match."
(interactive)
(funcall #'isearch-done nopush edit)
(when isearch-other-end (goto-char isearch-other-end))))
Basically, map C-Ret
to another function isearch-done-opposite
which checks the variable isearch-other-end
which is defined in isearch.el
as:
(defvar isearch-other-end nil) ; Start (end) of match if forward (backward).
This will work with forward and backward searches.
As Drew pointed in his answer you can also end the search with another key such as M-b
or M-f
, which for words boundaries works good, but my solution is kind of more general: define a key to put the cursor at the beginning (or end) of the pattern I'm searching:
(use-package isearch
:bind (:map isearch-mode-map
("C-<return>" . isearch-done-opposite))
:init (defun isearch-done-opposite (&optional nopush edit)
"End current search in the opposite side of the match."
(interactive)
(funcall #'isearch-done nopush edit)
(when isearch-other-end (goto-char isearch-other-end))))
Basically, map C-Ret
to another function isearch-done-opposite
which checks the variable isearch-other-end
which is defined in isearch.el
as:
(defvar isearch-other-end nil) ; Start (end) of match if forward (backward).
This will work with forward and backward searches.
edited 5 hours ago
answered 5 hours ago
AnlerAnler
1695 bronze badges
1695 bronze badges
add a comment |
add a comment |
There's really nothing to replicate, I think. You somehow have to tell Isearch that you're done typing text for the search string - you have to hit some key to tell it that. So at a minimum you have C-s acc <SOME KEY>
.
You can end Isearch with any key that is not already bound to something in isearch-mode-map
. (And even then, you can rebind any keys that are already bound.) And the key that ends Isearch can do whatever you like, including move back to a word beginning.
So you can end it with M-b
(that key isn't bound for Isearch, by default), which goes back to the beginning of the current word:
C-s acc M-b
That's not so hard. Whether you find it "intuitive" probably has to do with what you're already used to. There are a zillion use cases for Isearch, only one of which is wanting to move to the beginning of a matching word.
C-h k M-b
tells you:
M-b
runs the commandbackward-word
(found inglobal-map
), which is an
interactive compiled Lisp function insimple.el
.
It is bound to
M-b
,ESC left
.
(backward-word &optional ARG)
Move backward until encountering the beginning of a word.
With argument
ARG
, do this that many times.
IfARG
is omitted ornil
, move point backward one word.
The word boundaries are normally determined by the buffer’s
syntax table and character script (according to
char-script-table
), butfind-word-boundary-function-table
,
such as set up bysubword-mode
, can change that. If a Lisp
program needs to move by words determined strictly by the syntax
table, it should usebackward-word-strictly
instead. See Info
node (elisp) Word Motion for details.
add a comment |
There's really nothing to replicate, I think. You somehow have to tell Isearch that you're done typing text for the search string - you have to hit some key to tell it that. So at a minimum you have C-s acc <SOME KEY>
.
You can end Isearch with any key that is not already bound to something in isearch-mode-map
. (And even then, you can rebind any keys that are already bound.) And the key that ends Isearch can do whatever you like, including move back to a word beginning.
So you can end it with M-b
(that key isn't bound for Isearch, by default), which goes back to the beginning of the current word:
C-s acc M-b
That's not so hard. Whether you find it "intuitive" probably has to do with what you're already used to. There are a zillion use cases for Isearch, only one of which is wanting to move to the beginning of a matching word.
C-h k M-b
tells you:
M-b
runs the commandbackward-word
(found inglobal-map
), which is an
interactive compiled Lisp function insimple.el
.
It is bound to
M-b
,ESC left
.
(backward-word &optional ARG)
Move backward until encountering the beginning of a word.
With argument
ARG
, do this that many times.
IfARG
is omitted ornil
, move point backward one word.
The word boundaries are normally determined by the buffer’s
syntax table and character script (according to
char-script-table
), butfind-word-boundary-function-table
,
such as set up bysubword-mode
, can change that. If a Lisp
program needs to move by words determined strictly by the syntax
table, it should usebackward-word-strictly
instead. See Info
node (elisp) Word Motion for details.
add a comment |
There's really nothing to replicate, I think. You somehow have to tell Isearch that you're done typing text for the search string - you have to hit some key to tell it that. So at a minimum you have C-s acc <SOME KEY>
.
You can end Isearch with any key that is not already bound to something in isearch-mode-map
. (And even then, you can rebind any keys that are already bound.) And the key that ends Isearch can do whatever you like, including move back to a word beginning.
So you can end it with M-b
(that key isn't bound for Isearch, by default), which goes back to the beginning of the current word:
C-s acc M-b
That's not so hard. Whether you find it "intuitive" probably has to do with what you're already used to. There are a zillion use cases for Isearch, only one of which is wanting to move to the beginning of a matching word.
C-h k M-b
tells you:
M-b
runs the commandbackward-word
(found inglobal-map
), which is an
interactive compiled Lisp function insimple.el
.
It is bound to
M-b
,ESC left
.
(backward-word &optional ARG)
Move backward until encountering the beginning of a word.
With argument
ARG
, do this that many times.
IfARG
is omitted ornil
, move point backward one word.
The word boundaries are normally determined by the buffer’s
syntax table and character script (according to
char-script-table
), butfind-word-boundary-function-table
,
such as set up bysubword-mode
, can change that. If a Lisp
program needs to move by words determined strictly by the syntax
table, it should usebackward-word-strictly
instead. See Info
node (elisp) Word Motion for details.
There's really nothing to replicate, I think. You somehow have to tell Isearch that you're done typing text for the search string - you have to hit some key to tell it that. So at a minimum you have C-s acc <SOME KEY>
.
You can end Isearch with any key that is not already bound to something in isearch-mode-map
. (And even then, you can rebind any keys that are already bound.) And the key that ends Isearch can do whatever you like, including move back to a word beginning.
So you can end it with M-b
(that key isn't bound for Isearch, by default), which goes back to the beginning of the current word:
C-s acc M-b
That's not so hard. Whether you find it "intuitive" probably has to do with what you're already used to. There are a zillion use cases for Isearch, only one of which is wanting to move to the beginning of a matching word.
C-h k M-b
tells you:
M-b
runs the commandbackward-word
(found inglobal-map
), which is an
interactive compiled Lisp function insimple.el
.
It is bound to
M-b
,ESC left
.
(backward-word &optional ARG)
Move backward until encountering the beginning of a word.
With argument
ARG
, do this that many times.
IfARG
is omitted ornil
, move point backward one word.
The word boundaries are normally determined by the buffer’s
syntax table and character script (according to
char-script-table
), butfind-word-boundary-function-table
,
such as set up bysubword-mode
, can change that. If a Lisp
program needs to move by words determined strictly by the syntax
table, it should usebackward-word-strictly
instead. See Info
node (elisp) Word Motion for details.
edited 10 hours ago
answered 10 hours ago
DrewDrew
51.2k4 gold badges65 silver badges115 bronze badges
51.2k4 gold badges65 silver badges115 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Emacs Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f52549%2fget-emacs-to-jump-to-the-start-of-a-word-after-isearch%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown