Applied, thanks.

On Fri, Feb 22, 2013 at 08:10:34AM -0800, Aaron Jensen wrote:
>    Perfect. Works like a charm. Ship it? :)
>    For those who care, I was setting up a way to switch seamlessly between
>    tmux and vim panes:
>    in .tmux.conf:
>    bind -n ^H run "(tmux display-message -p '#{pane_current_command}' | grep
>    -iq vim && tmux send-keys ^H) || tmux select-pane -L"
>    bind -n ^J run "(tmux display-message -p '#{pane_current_command}' | grep
>    -iq vim && tmux send-keys ^J) || tmux select-pane -D"
>    bind -n ^K run "(tmux display-message -p '#{pane_current_command}' | grep
>    -iq vim && tmux send-keys ^K) || tmux select-pane -U"
>    bind -n ^L run "(tmux display-message -p '#{pane_current_command}' | grep
>    -iq vim && tmux send-keys ^L) || tmux select-pane -R"
>    in .vimrc:
>    if exists('$TMUX')
>      function! TmuxOrSplitSwitch(wincmd, tmuxdir)
>        let previous_winnr = winnr()
>        execute "wincmd " . a:wincmd
>        if previous_winnr == winnr()
>          " The sleep and & gives time to get back to vim so tmux's focus
>    tracking
>          " can kick in and send us our ^[[O
>          execute "silent !sh -c 'sleep 0.01; tmux select-pane -" . a:tmuxdir
>    . "' &"
>          redraw!
>        endif
>      endfunction
>      nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
>      nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
>      nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
>      nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
>    else
>      map <C-h> <C-w>h
>      map <C-j> <C-w>j
>      map <C-k> <C-w>k
>      map <C-l> <C-w>l
>    endif
> 
>    On Friday, February 22, 2013 at 7:53 AM, Nicholas Marriott wrote:
> 
>      Actually no you can't but try this and you can get it from formats using
>      eg display -p '#{pane_current_command}':
>      diff --git a/format.c b/format.c
>      index bd81799..993728c 100644
>      --- a/format.c
>      +++ b/format.c
>      @@ -377,6 +377,7 @@ format_window_pane(struct format_tree *ft, struct
>      window_pane *wp)
>      u_int i;
>      u_int idx;
>      const char *cwd;
>      + const char *cmd;
>      size = 0;
>      for (i = 0; i < gd->hsize; i++) {
>      @@ -410,6 +411,8 @@ format_window_pane(struct format_tree *ft, struct
>      window_pane *wp)
>      format_add(ft, "pane_start_path", "%s", wp->cwd);
>      if ((cwd = osdep_get_cwd(wp->fd)) != NULL)
>      format_add(ft, "pane_current_path", "%s", cwd);
>      + if ((cmd = osdep_get_name(wp->fd, wp->tty)) != NULL)
>      + format_add(ft, "pane_current_command", "%s", cmd);
>      format_add(ft, "cursor_x", "%d", wp->[1]base.cx);
>      format_add(ft, "cursor_y", "%d", wp->base.cy);
>      On Fri, Feb 22, 2013 at 07:39:59AM -0800, Aaron Jensen wrote:
> 
>        The active command is pulled out to be put in the window name, i'm
>        wondering if there is any way to access it from tmux otherwise?
>        Specifically, I'd like to have a tmux binding that does different
>        things
>        depending on what the active command is.
>        Thanks,
>        Aaron
> 
>        
> ------------------------------------------------------------------------------
>        Everyone hates slow websites. So do we.
>        Make your web apps faster with AppDynamics
>        Download AppDynamics Lite for free today:
>        [2]http://p.sf.net/sfu/appdyn_d2d_feb
> 
>        _______________________________________________
>        tmux-users mailing list
>        [3]tmux-users@lists.sourceforge.net
>        [4]https://lists.sourceforge.net/lists/listinfo/tmux-users
> 
> References
> 
>    Visible links
>    1. http://base.cx/
>    2. http://p.sf.net/sfu/appdyn_d2d_feb
>    3. mailto:tmux-users@lists.sourceforge.net
>    4. https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to