Coder Social home page Coder Social logo

fielding / vim-chunkwm-navigator Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 0.0 8 KB

This plugin will allow you to navigate seamlessly between Vim/Neovim splits and native mac os windows managed by chunkwm using a consistent set of hotkeys.

Vim Script 100.00%
chunkwm vim

vim-chunkwm-navigator's Introduction

Vim Chunkwm Navigator

This plugin will allow you to navigate seamlessly between Vim/Neovim splits and native mac os windows managed by chunkwm using a consistent set of hotkeys. The secret sauce that allows this to work is the combination of Åsmund Vikane's chunkwm, a tiling window manager, and a hotkey daemon(e.g. khd or skhd).

This is oh so heavily based off Chris Toomey's vim-tmux-navigator. For educational purposes I have structured the code like vim-tmux-navigator due to my lack of vimscript experience. I have taken the time to implement everything as if it were from scratch in a progressive manner (as the need presented itself) for my educational benefit. In the end, I hope to have scratched my own itch, while deepening my vim knownledge.

IMPORTANT: This requires chunkwm, or similar window manager and your hacking on supplied scripts, and a third party hotkey daemon(e.g. khd or skhd)

Usage

This plugin provides the following mappings which allow you to move between Vim/Neovim pane splits and native macos windows seamlessly.

  • <ctrl-h> => Left
  • <ctrl-j> => Down
  • <ctrl-k> => Up
  • <ctrl-l> => Right

Note - Even if you use a modal hotkey daemon, you can bind these to the default mode.

If you want to use alternate key mappings, see the [configuration section below][].

Installation

Vim/Neovim

If you don't have a preferred installation method, I recommend using vim-plug. Assuming you have vim-plug installed and configured, the following steps will install the plugin:

Add the following line to your .vimrc or init.vim file

Plug 'fielding/vim-chunkwm-navigator'

Then run

:PlugInstall

readline

.inputrc

# allow chunkwm to pass through ctrl-h/j/k/l so that vim can switch panes without triggering shell escape characters
'"\C-l":'
'"\C-h":'
'"\C-j":'
'"\C-k":'

Hotkey Daemon or other third party key mapping method

To configure the chunkw side of this customization we must use a third party hotkey daemon(e.g. khd or skhd). I will try include configurations for any submitted by others.

skhd

For skhd edit any existing bindings to ctrl - h, ctrl - j, ctrl - k, and ctrl - l in ~/.skhdrc to match the following snippet:

ctrl - h ->         : if [[ "$(chunkc tiling::query --window name)" != *"vim"* ]]; then chunkc tiling::window --focus west; fi
ctrl - l ->         : if [[ "$(chunkc tiling::query --window name)" != *"vim"* ]]; then chunkc tiling::window --focus west; fi
ctrl - j ->         : if [[ "$(chunkc tiling::query --window name)" != *"vim"* ]]; then chunkc tiling::window --focus west; fi
ctrl - k ->         : if [[ "$(chunkc tiling::query --window name)" != *"vim"* ]]; then chunkc tiling::window --focus west; fi

TODO

  • Add previous to the list of binds/focus change options
  • Correct how it handles the wrapping around from window back in to vim/nvim
  • README: Finish!
    • add confguraton section
    • add khd configuration
    • add tidbit about terminal title

vim-chunkwm-navigator's People

Contributors

fielding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.