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 8735667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:07:00+00:00 2026-06-13T10:07:00+00:00

So I followed the instructions here: http://vimcasts.org/episodes/bubbling-text/ The idea is that I enter visual

  • 0

So I followed the instructions here: http://vimcasts.org/episodes/bubbling-text/

The idea is that I enter visual mode and select a few lines of text. Then I hit CTRL-k or CTRL-j to move the selected text up or down in my file. The mappings in my .vimrc file are as follows:

nmap <C-k> ddkP
nmap <C-j> ddp
vmap <C-k> xkP`[V`]
vmap <C-j> xp`[V`]

The first two mappings are for normal mode (nmap) and they work as expected. For going down, the dd command deletes a line and the p command moves the cursor down and inserts the line. For going up the dd command deletes the line, the k command moves the cursor up a line, and then the P command inserts the line above.

In visual mode, however, it doesn’t work. Take the case of moving several lines of selected text down. Once the text is selected the x command deletes it. But the p command inserts the text exactly where the cursor is. So if I have a file with the following contents:

one
two
three

and the cursor is on the “o” of one. I hit vj$ to select the first two lines. Then I hit x to delete them. Then I hit p to insert them below. The result looks like this:

tone
two
hree

Right before I hit p, there is a single line in the file and the cursor is sitting on the “t” in “three”. So the behavior makes sense to me. What I don’t understand is why the expert VimCast tutorial is expecting me to see different behavior. Also, I would like to get the behavior I would like.

  • 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-06-13T10:07:02+00:00Added an answer on June 13, 2026 at 10:07 am

    Those mappings work perfectly.

    If we take the <C-j> visual mode mapping:

    • x deletes the visual selection which puts the cursor on the line directly below the the delete lines.

    • p puts the deleted lines under the current line, that’s the intended effect.

    • `[ moves the cursor to the first character of the changed text, here it’s the first character of the lines that you moved.

    • V starts visual-line selection

    • `] extends the selection toward the last character of the moved text, ready for further moving.

    From your description, I think that your problem is twofold:

    1. You seem to be using the sequence of commands on the right hand of the mapping instead of the mapping itself.

    2. You are using v (visual mode, lowercase v, character-wise) instead of V (visual-line mode, capital v, line-wise). The purpose of these mappings is to “bubble” lines, not words so, if you really want the desired effect, you must use the right visual mode.

    The correct sequence of commands is:

    Vj<C-j>
    

    or, if you insist on not using Drew Neil’s mapping:

    Vjxp`[V`]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed the instructions here http://support.microsoft.com/kb/825532 After that when I preview my page, I
I'm wanting to create a remote NuGet server. I've followed the instructions here: http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds
I followed these instructions here: http://logback.qos.ch/consolePlugin.html I have the correct and found logback.xml, it
I have followed the instructions here: http://help.github.com/win-set-up-git/ to set up git on my windows
Is this possible? I've followed the instructions from here ( http://www.jetbrains.net/confluence/display/TCD4/Setting+up+an+External+Database#SettingupanExternalDatabase-MicrosoftSQLServer2005 ) but I
I'm new to IDEA, but very familiar with Eclipse. I followed the instructions here
I'm using compiled OpenSSL for an iPhone app. I followed the instructions here http://www.x2on.de/kontakt/
I've followed the instructions here http://msdn.microsoft.com/en-us/library/ms464040.aspx to the letter, when I run disco.exe I
Followed the instructions here and recreated certificates that I previously incorrectly created. Something has
Admob code can't see on device. I followed the instructions here: http://www.admob.com/docs/AdMob_Android_SDK_Instructions.pdf everything ok,

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.