iTerm2 – scroll less output with mouse

前端 未结 6 624
梦谈多话
梦谈多话 2021-01-31 02:43

I just switched from OSX Terminal to iTerm2, and I seem to have lost one piece of functionality. In Terminal, I could scroll through output of the less comm

6条回答
  •  青春惊慌失措
    2021-01-31 03:33

    Not the OP's question, but for anyone here trying to get this to work in tmux, with credit to choco via this github comment here's a snippet to add to your tmux.conf to get it to handle alternate screens (e.g. less, vim) correctly:

    # Check if copy-mode or any mouse flags, then send mouse events
    # or check if we're in alternate screen end send navigation keys (up, down)
    
    bind -n WheelUpPane if-shell -Ft='#{?pane_in_mode,1,#{mouse_any_flag}}' \
            'send -Mt=' 'if-shell -Ft= "#{alternate_on}" \
            "send -t= Up" "copy-mode -et= ; send -Mt="'
    bind -n WheelDownPane if-shell -Ft= '#{?pane_in_mode,1,#{mouse_any_flag}}' \
            'send -Mt=' 'if-shell -Ft= "#{alternate_on}" \
            "send -t= Down" "send -Mt="'
    

    Note, this doesn't require the Iterm preference change mentioned in other answers, but it also isn't hurt by it.

提交回复
热议问题