moveline.nvim icon indicating copy to clipboard operation
moveline.nvim copied to clipboard

Can anyone help with setting up keyboard shortcuts?

Open DameerGamlet opened this issue 1 year ago • 3 comments

I'm not sure what is possible, but I would like to set the ALT+up/down combination for move line.up/down accordingly. How could I do that? (using neovim / lazy.nvim)

mappings.lua image

The root view of the files is as follows: image

DameerGamlet avatar Oct 03 '23 07:10 DameerGamlet

You should be able to use something like this:

n = { 
  ["<M-Up>"] = { function() require("moveline").up() end, "moveline: up"  },
  ["<M-Down"] = { function() require("moveline").down() end, "moveline: down" },
}

willothy avatar Oct 03 '23 07:10 willothy

Sorry, I still haven't figured out how to do this:(

I added, there are no errors, but nothing happens:(

DameerGamlet avatar Oct 04 '23 07:10 DameerGamlet

Hmm I'll look into that. I'm in the process of rewriting this plugin anyways though, I would recommend using one of the other line-moving plugins for now.

willothy avatar Oct 04 '23 07:10 willothy

Here's how I got my Alt-Up / Alt-Down to work:

-- .config/nvim/lua/plugins/moveline.lua
return {
  'willothy/moveline.nvim',
  build = 'make',
  lazy = false,
  config = function()
    local moveline = require('moveline')
    vim.keymap.set('n', '<a-Up>', moveline.up)
    vim.keymap.set('n', '<a-Down>', moveline.down)
    vim.keymap.set('v', '<as-Up>', moveline.block_up)
    vim.keymap.set('v', '<as-Down>', moveline.block_down)
  end
}

seanlowe avatar Oct 29 '24 17:10 seanlowe