Skip to content

Quickly navigate and resize i3wm windows and Neovim splits with the same keybindings

Notifications You must be signed in to change notification settings

tom-anders/easy-i3-neovim-nav

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easy-i3-neovim-nav

Quickly navigate and resize i3wm windows and Neovim splits with the same keybindings

This app is heavily inspired by

Here are the major advantages to the solutions listed above:

Installation

cargo install easy-i3-neovim-nav

Usage

Neovim configuration

Add this to your init.vim:

call serverstart(tempname())
let &titlestring="nvim %F -- [" . v:servername . "]"
set title

Note: easy-i3-neovim-nav uses the window's titlestring in order to extract the server name used for communicating with Neovim. The default regex assumes that the servername is contained in square brackets at the very end of your titlestring. To customize this, use the -e option

i3wm configuration

Here's an example configuration for your i3 config. Adapt this to your preferred current keybindings

# 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

The last three arguments control the amount by which windows are resized:

$ 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

About

Quickly navigate and resize i3wm windows and Neovim splits with the same keybindings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages