I'm using one of Vim distribution called SpaceVim and everything is good enough except some details. How do I make spacevim to preserve column position when moving between lines? For instance - move from first line and 10 column (1:10) to second line without any columns (2:1) and then get back (all using j and k keys). Now you are on 1:1 position instead of 1:10 as expected and how nvim behaves by default. What option or toggle is responsible for column position preserving? Thanks.

  • 2
    why don't you ask on the spacevim issue tracker? as you said, preserving the column is how vim works already
    – Mass
    Commented Mar 1, 2018 at 20:06
  • @Mass I just think there is a kind of general toggle, which disable that behavior and which is enabled by default in spacevim. Also I've asked for this in spaceim glitter chat.
    – aryndin
    Commented Mar 1, 2018 at 20:22
  • 1
    No, there is no such option. Please fill a bug at spacevims issue tracker, that is clearly a bug Commented Mar 3, 2018 at 20:43
  • What SpaceVim config are you using? Does nunmap j | nunmap k fix the problem? If so, what SpaceVim behaviour have you lost, and do you care about that?
    – Rich
    Commented Mar 5, 2018 at 15:58
  • You can also check if there is an autocmd responsible for this. Check if there's anything suspicious in the output of :autocmd CursorMoved
    – tommcdo
    Commented Mar 7, 2018 at 3:20

2 Answers 2


As author of SpaceVim, I can not reproduce this issue in master branch. and we do not map j and k in spacevim.

I think you should check result of :verbose map j or :verbose map k, this command will show what and where j and k is mapped.

if the result is empty, you need to check autocmd like CursorMoved via :au CursorMoved, the output will what autocmd will be called when move cursor.

  • thx for ur support. I've created the issue on github github.com/SpaceVim/SpaceVim/issues/1464. The problem has already gone as it was problem of my installation.
    – aryndin
    Commented Mar 26, 2018 at 13:35
  • nice! If you encounter other issue , you can use spacevim tag in this channel
    – Eric Wong
    Commented Mar 29, 2018 at 14:57

I am learning light vimscripting, so I am not sure if this will work. But put these in your .vimrc:

function! NextLine()
  let c = col(".")
  execute "normal! j" . c . "|"
function! PreviousLine()
  let c = col(".")
  execute "normal! k" . c . "|"
nnoremap j :call NextLine()
nnoremap k :call PreviousLine()

These will not give you native vim experience because if you go down to a line of zero column, then the next line will also be on the zeroth column, not the column of the previous column. This would require, I think, another function for checking if any h or l has been pressed in between the function calls to preserve intelligent column number preservation.

But I think it should get the job done for now.

  • The not "native vim experience" you describe seems to be exactly the behaviour the OP wants to fix?
    – Rich
    Commented Mar 5, 2018 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.