Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6328561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:28:47+00:00 2026-05-24T17:28:47+00:00

Given the following sentence: This is one two three. When I move the cursor

  • 0

Given the following sentence:

This is one two three.

When I move the cursor to the space between one and two, I would like to replace two with XXX.
I know there is a way in vi so that I can mark two as the modified string so that when I finish entering the new string and the new string replaces the two in-place.

// Update-1 //

The corresponding command in vi is ‘cw’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:28:49+00:00Added an answer on May 24, 2026 at 5:28 pm

    I would probably just use M-d SPC X X X (if the SPC is necessary depends on wether the cursor is placed directly after “one” or before “two”) or M-f M-DEL X X X, but maybe that’s not what you’re looking for.

    Ok, you didn’t answer my comment, and didn’t vote up an answer, so I guessed what you might like and here is a little hack:

    (defun change-word (n)
      (interactive "p")
      (lexical-let ((old-window-configuration (current-window-configuration)))
        (clone-indirect-buffer "*edit-word*" t)
        (narrow-to-region (point) (save-excursion
                                    (forward-word n)
                                    (point)))
        (overwrite-mode 1)
        (local-set-key (kbd "C-c C-c")
                       (lambda ()
                         (interactive)
                         (widen)
                         (let ((end-of-edit (point)))
                           (kill-buffer)
                           (set-window-configuration old-window-configuration)
                           (goto-char end-of-edit))))))
    

    Invoke M-x change-word (or bind it to a key you like), edit the word, and type C-c C-c when you’re done. If you want to edit the next n words, give it a prefix argument (e.g. M-3 M-x change-word to change the next three words). It’s not exactly the same — You’ll edit in another buffer — but it comes close. Try and see if you like it. It is not a very elaborate solution. Maybe the best, and most emacs-style approach, would be to have something akin to isearch-mode, that highlights the changed region and so on. Note that you’ll have to (require 'cl) because of lexical-let.

    Another possibility would be something like this:

    (defun change-word ()
      (interactive)
      (dotimes (i (- (save-excursion (end-of-thing 'word)) (point)))
        (insert (read-char))
        (delete-char 1)))
    

    But this example is just a very crude hack — You won’t even be able to navigate while editing your word. Maybe one could write something modifying the command-loop behavior, but I didn’t look into that.

    I don’t know about any built-in functionality that does exactly what you seem to want, but of course there are Viper and other Vi emulation modes built in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following sentence: The is 10. way of doing this. And this is
Given this: Come Find me please. This is paragraph one.\n\nThis is paragraph two. Capture
Consider a sentence like: John Smith travelled to Washington. A name tagger would identify,
Given the following: List<List<Option>> optionLists; what would be a quick way to determine the
I am trying to do the following: A jumbled sentence is given and the
Given following HTML <select name="IBE1$IBE_NurFlug1$ddl_Abflughafen" id="IBE1_IBE_NurFlug1_ddl_Abflughafen" class="dropdownlist" style="width: 99%;"> <option value="Antalya;TR">Antalya</option> <option value="Berlin;DE">Berlin</option> <option
given following html <input id=IBE1_IBE_NurFlug1_RadioButtonList1_0 name=IBE1$IBE_NurFlug1$RadioButtonList1 value=Blue type=radio> <label for=IBE1_IBE_NurFlug1_RadioButtonList1_0>Blue</label> <input id=IBE1_IBE_NurFlug1_RadioButtonList1_1 name=IBE1$IBE_NurFlug1$RadioButtonList1 value=Green
I would like to know whether it a possible to detect whether a HTML
Lets say I have the following sentence: A quick brown fox jumped over a
Following on from this question , I'm totally stumped on getting LaTeX to give

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.