Skip to content

Neovim window mover that avoids moving side windows

License

Notifications You must be signed in to change notification settings

ycdzj/win-mover.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

win-mover.nvim

win-mover.nvim is a Neovim window mover that ignores side windows.

Demo

Features

  • Window Move Mode similar to WinShift.nvim
  • Ignore side windows (e.g. NvimTree) so they will not move
  • Simple implementation

Requirements

  • Neovim >= 0.8.0

Installation

Install it with your favorite plugin manager:

lazy

{
  'ycdzj/win-mover.nvim',
  lazy = false,
  opts = {}, -- configuration goes here
}

packer

use {
  'ycdzj/win-mover.nvim',
  config = function()
    local win_mover = require('win-mover')
    win_mover.setup({}) -- configuration goes here
  end,
}

vim-plug

  1. Add this to your config:
    Plug 'ycdzj/win-mover.nvim'
  2. Call require('win-mover').setup with your configuration before using this plugin.

Configuration

Defaults

{
  ignore = {
    enable = false,
    filetypes = {},
  },
  highlight = {
    color = '#2e3440',
    transparency = 60,
  },
  move_mode = {
    keymap = {},
  },
}

Example

This is an example configuration that:

  • Binds <leader>e for entering Move Mode.
  • h,j,k,l to move window in Move Mode.
  • q or <Esc> to quit Move Mode.
  • Ignores windows such as NvimTree, neo-tree, etc.
local win_mover = require('win-mover')
win_mover.setup({
  ignore = {
    enable = true,
    filetypes = { 'NvimTree', 'neo-tree', 'Outline', 'toggleterm' },
  },
  move_mode = {
    keymap = {
      h = win_mover.ops.move_left,
      j = win_mover.ops.move_down,
      k = win_mover.ops.move_up,
      l = win_mover.ops.move_right,

      H = win_mover.ops.move_far_left,
      J = win_mover.ops.move_far_down,
      K = win_mover.ops.move_far_up,
      L = win_mover.ops.move_far_right,

      q = win_mover.ops.quit,
      ['<Esc>'] = win_mover.ops.quit,
    },
  },
})
vim.keymap.set("n", "<leader>e", win_mover.enter_move_mode, { noremap = true, silent = true })

Commands

  • :WinMover

    Enter Window Move Mode

License

MIT License

About

Neovim window mover that avoids moving side windows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages