Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/mayask/tern-vimnav. vim-tmux-navigator for Tern: ctrl+h/j/k/l across Neovim splits and Tern panes
Something went wrong. Try again.
Files
- Lua 100%
README.md
tern-vimnav #
vim-tmux-navigator for Tern: the same ctrl+h/j/k/l move between Neovim splits and Tern panes.
- In a pane running
nvimorvim, the key goes through to Vim, which moves between its own splits. - Anywhere else, Tern moves focus to the pane in that direction.
- At the edge of Vim's splits, Vim sets its title to
tern-nav:<left|down|up|right>; the plugin sees it and moves Tern's focus on.
Install #
tern plugin install github.com/mayask/tern-vimnav
Bind the keys in Tern's settings.json (~/Library/Application Support/Tern/settings.json on macOS):
"keybinds": {
"ctrl+h": "plugin.vimnav.left",
"ctrl+j": "plugin.vimnav.down",
"ctrl+k": "plugin.vimnav.up",
"ctrl+l": "plugin.vimnav.right"
}
Tern does not reread settings.json edited on disk; restart Tern after editing it.
Neovim #
With smart-splits.nvim (AstroNvim ships it with <C-h/j/k/l> mapped), copy nvim/tern-navigator.lua into your lazy.nvim plugin specs, e.g. ~/.config/nvim/lua/plugins/. It sets smart-splits' at_edge to hand off to Tern inside Tern and keeps wrapping elsewhere.
Without smart-splits, any mapping works that moves between windows and, when the window did not change, sets the title to tern-nav:<direction> and back (see tern_move in that file).
Notes #
- Bound keys no longer reach shells: zsh loses
ctrl+k(kill line) andctrl+j(accept line) in plain shell panes. - Movement is directional (
focus_pane:<dir>); at the outermost pane it stops instead of wrapping.