GitXplorerGitXplorer
t

easy-i3-neovim-nav.py

public
12 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
c1da25b3b0c66c7702da98e1d61861d84f453858

Add notice about Rust version

ttom-anders committed a year ago
Verified
9b5fb21736bf2b3f77af88f91908fc598c18f923

Fix minor errors in Readme

ttom-anders committed 3 years ago
Unverified
ac0fc763ae796c3b97230f9d046bafbbcfc47f59

Initial commit

ttom-anders committed 3 years ago

README

The README file for this repository.

This project is not maintained anymore, please use the Rust version instead!

easy-i3-neovim-nav

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

This script is heavily inspired by

Here are the major advantages to the solutions listed above:

Installation

pip 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 --path-regex 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 resize -h
usage: easy_i3_neovim_nav.py resize [-h] {shrink,grow} {width,height} amount_vim amount_i3_px amount_i3_ppt

positional arguments:
  {shrink,grow}
  {width,height}
  amount_vim      will be passed as a count to vim's wincmd, see :h wincmd
  amount_i3_px    number of pixels by which to resize a floating window, for details see
                  https://i3wm.org/docs/userguide.html#resizingconfig
  amount_i3_ppt   percentage points by which to resize a tiled window, for details see
                  https://i3wm.org/docs/userguide.html#resizingconfig

optional arguments:
  -h, --help      show this help message and exit