[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,
}

效果

相关推荐
信号处理学渣7 分钟前
Git命令行中vim的操作
git·编辑器·vim
星霜旅人11 分钟前
【Linux】Vim文本编辑器
linux
難釋懷36 分钟前
Shell脚本-for循环应用案例
linux·运维·服务器·bash
昊昊昊昊昊明1 小时前
10天学会嵌入式技术之51单片机-day-7
linux·运维·网络
达斯维达的大眼睛1 小时前
如何在Linux用libevent写一个聊天服务器
linux·运维·服务器·网络
末央&1 小时前
【Linux】gdb工具,Linux 下程序调试的 “透视眼”
linux·运维·服务器
绵绵细雨中的乡音1 小时前
Linux进程学习【进程状态】
linux
Lzc7742 小时前
Linux的基础指令
linux·linux的基础指令
电脑玩家粉色男孩3 小时前
2、Ubuntu 环境下安装RabbitMQ
linux·rabbitmq
爬菜3 小时前
卸载rpm包
linux