[vim] vim多窗口切换

需求

写代码的过程中,经常需要在不相邻窗口之间跳转。

方案

使用 neovim-window切换。

插件管理使用lazy.nvim

neovim配置

~/.config/nvim/lua/plugins/下增加文件window-picker.lua,内容为

lua 复制代码
return {
  {
    "yorickpeterse/nvim-window",
    name = "neovim-window-picker",
    event = "VeryLazy",
    version = "2.*",
    keys = {
      { "<leader>wp", "<cmd>lua require('nvim-window').pick()<cr>", desc = "nvim-window: Jump to window" },
    },
    config = function()
      require("nvim-window").setup({
        -- The characters available for hinting windows.
         chars = {
            'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
            'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
         },

        -- A group to use for overwriting the Normal highlight group in the floating
        -- window. This can be used to change the background color.
        normal_hl = "Normal",

        -- The highlight group to apply to the line that contains the hint characters.
        -- This is used to make them stand out more.
        hint_hl = "Bold",

        -- The border style to use for the floating window.
        border = "single",

        -- How the hints should be rendered. The possible values are:
        --
        -- - "float" (default): renders the hints using floating windows
        -- - "status": renders the hints to a string and calls `redrawstatus`,
        --   allowing you to show the hints in a status or winbar line
        render = "float",
      })
    end,
}

效果

相关推荐
天空'之城2 小时前
Linux 系统编程 22:五种 IO 模型全解
linux
小张成长计划..4 小时前
【Linux】10:冯·诺依曼体系结构和操作系统
linux·运维·服务器
悦儿遥遥雨17 小时前
PXE + Kickstart 无人值守批量部署系统
linux·javascript·nginx
Imagine Miracle7 小时前
【WSL】让WSL2后台持久运行不自动关闭的解决方案
linux·windows·wsl
兔C7 小时前
Linux 命令行入门学习资料 day_2
linux·运维·服务器
eggcode8 小时前
Linux命令基础与操作技巧
linux
二宝哥9 小时前
VMware Workstation 实战:CentOS 7.9 安装、桥接网络配置与克隆管理详解
linux·centos·vmware
AutumnWind042010 小时前
【4种打开Ubuntu(WSL)的方法】
linux·ubuntu
辞旧 lekkk11 小时前
【Qt系统相关】鼠标事件
linux·开发语言·qt·学习·计算机外设·萌新
是摆烂第一名呀11 小时前
【rk3506】U-Boot串口时钟未配置,导致串口彻底失效
linux·arm开发·驱动开发·嵌入式硬件