Skip to content

Visual selection moving lines of more than 3 lines does not keep selection #1906

@tuero

Description

@tuero

Checklist

  • Using a stable version of Neovim (i.e. not neovim nightly)
  • :AstroUpdate
  • Restarted AstroNvim

Operating system/version

Ubuntu 22.10

Terminal/GUI

Windows terminal

AstroNvim Health

==============================================================================
astronvim: require("astronvim.health").check()

AstroNvim ~

  • AstroNvim Version: v3.11.1
  • Neovim Version: v0.9.0
  • OK Using stable Neovim >= 0.8.0
  • OK git is installed: Used for core functionality such as updater and plugin management
  • OK xdg-open is installed: Used for gx mapping for opening files with system opener (Optional)
  • WARNING lazygit is not installed: Used for mappings to pull up git TUI (Optional)
  • OK node is installed: Used for mappings to pull up node REPL (Optional)
  • WARNING gdu is not installed: Used for mappings to pull up disk usage analyzer (Optional)
  • WARNING btm is not installed: Used for mappings to pull up system monitor (Optional)
  • OK python is installed: Used for mappings to pull up python REPL (Optional)

Describe the bug

When trying to move a selection of more than 3 lines and keeping the selection after the move, the lines are moved but the selection does not keep. I've provided a screen grab from someone in the discord server showing this behaviour. It works for a selection of 2 lines, but not 3 or more.

The keybind in user/mappings.lua is

v = {
    ["<A-k>"] = {":m '<-2<CR>gv=gv", desc = "move line up"},
    ["<A-j>"] = {":m '>+1<CR>gv=gv", desc = "move line down"},
  },

I've confirmed these keybinds (:vnoremap <A-k> :m '<-2<CR>gv=gv) work when no configuration is loaded nvim --clean. It also works with 2 lines selected, but no more than that.

Steps to Reproduce

  1. Clean install of astrovim
  2. Use the following keymappings or :vnoremap <A-k> :m '<-2<CR>gv=gv
  3. Try to move a selection of 3 or more lines

Expected behavior

A selection of more than 3 lines should move and keep the selection, similar to the behaviour of using 2 lines.

Screenshots

Screenshare_-_2023-05-16_1_54_52_PM.mp4

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions