vim-iterm2-navigator


Ⅰ. 插件描述

Seamlessly navigate vim split panes inside iterm2 split panes

Ⅱ. 基本信息

创建日期:  2013-09-27
使用用户:  5
Github星:  15
插件作者:  Tom Rees

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'zephod/vim-iterm2-navigator'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'zephod/vim-iterm2-navigator'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'zephod/vim-iterm2-navigator'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/zephod/vim-iterm2-navigator

Ⅳ. 文档说明

## Vim+iterm2 Seamless Navigation Plugin

Use Cmd+j, Cmd+k, Cmd+l, Cmd+h to seamlessly navigate between your split Vim panes and split iTerm2 panes while editing.

Based on the similar but different vim-tmux-navigator plugin. I wanted to do the same for my native split panes in iTerm, which means using AppleScript...

This plugin is for developers using cli-mode Vim (not MacVim) inside an iTerm2 window, dealing with lots of split panes.

To Install:

Add this repo to your bundles.

cd ~/.vim/bundle
git clone git://github.com/zephod/vim-iterm2/navigator

Now configure iTerm2's keyboard shortcuts. Cmd-J should be set to run coprocess. This coprocess is ~/.vim/bundle/vim-iterm2-navigator/switch.py j. Note the argument passed to the script. Screenshot of settings:

iterm2 config keys


Developer Note: This is how I created the applescript/* files:

osacompile -o iterm2_l.scpt -e "tell application \"System Events\" to key code 124 using {command down, option down}"
osacompile -o iterm2_h.scpt  -e "tell application \"System Events\" to key code 123 using {command down, option down}"
osacompile -o iterm2_k.scpt    -e "tell application \"System Events\" to key code 126 using {command down, option down}"
osacompile -o iterm2_j.scpt  -e "tell application \"System Events\" to key code 125 using {command down, option down}"
osacompile -o iterm2_getname.scpt -e "
  tell application \"iTerm\"
    activate
    tell the current terminal
      tell the current session
        get name 
      end tell
    end tell
  end tell"

添加新评论