1 个稳定版本
1.0.0 | 2023年3月25日 |
---|
#1944 在 命令行工具
13KB
241 行
easy-i3-neovim-nav
使用相同的快捷键快速导航和调整 i3wm 窗口和 Neovim 分割的大小
此应用深受以下应用启发
以下是上述解决方案的主要优势
- 也支持无缝调整 i3 窗口和 vim 分割的大小
- 不依赖于
xdotool
,从而避免了在切换窗口后您的修饰键可能卡住的问题,并提供了更好的性能 - 无需额外的 vim 插件,只需在您的
init.vim
中添加三条额外的命令
安装
cargo install easy-i3-neovim-nav
使用方法
Neovim 配置
将其添加到您的 init.vim
call serverstart(tempname())
let &titlestring="nvim %F -- [" . v:servername . "]"
set title
注意:
easy-i3-neovim-nav
使用窗口的标题字符串来提取用于与 Neovim 通信的服务器名称。默认正则表达式假设服务器名称位于您的titlestring
的末尾方括号内。要自定义此设置,请使用-
选项
i3wm 配置
以下是您 i3 配置的示例。根据您喜欢的当前快捷键进行调整
# Move focus
bindsym $mod+h exec --no-startup-id easy-i3-neovim-nav focus left
bindsym $mod+j exec --no-startup-id easy-i3-neovim-nav focus down
bindsym $mod+k exec --no-startup-id easy-i3-neovim-nav focus up
bindsym $mod+l exec --no-startup-id easy-i3-neovim-nav focus right
# Resizing
bindsym $mod+Shift+Left exec --no-startup-id easy-i3-neovim-nav resize shrink width 5 10 5
bindsym $mod+Shift+Down exec --no-startup-id easy-i3-neovim-nav resize shrink height 5 10 5
bindsym $mod+Shift+Up exec --no-startup-id easy-i3-neovim-nav resize grow height 5 10 5
bindsym $mod+Shift+Right exec --no-startup-id easy-i3-neovim-nav resize grow width 5 10 5
最后三个参数控制窗口调整大小的量
$ easy_i3_neovim_nav help resize
Usage: easy-i3-neovim-nav resize <ACTION> <DIMENSION> [AMOUNT_VIM] [AMOUNT_I3_PX] [AMOUNT_I3_PPT]
Arguments:
<ACTION> [possible values: shrink, grow]
<DIMENSION> [possible values: width, height]
[AMOUNT_VIM] Will be passed as a count to vim's wincmd, see :h wincmd [default: 5]
[AMOUNT_I3_PX] Number of pixels by which to resize a floating window, for details see https://i3wm.org/docs/userguide.html#resizingconfig [default: 10]
[AMOUNT_I3_PPT] Percentage points by which to resize a tiled window, for details see https://i3wm.org/docs/userguide.html#resizingconfig
依赖项
~4.5–6.5MB
~118K SLoC