我不知道这是在最近版本的byobu中是否有所改变,但现在当我创建一个新屏幕时,新屏幕与我当前窗口位于同一目录中.起初这不是太烦人,一个简单的"CD~"会让我到达我想要的地方.但我一直注意到奇怪的事情.在gem安装期间,如果我创建一个新窗口,我最终会在安装gem的目录中(当使用rbenv时).
我只想让它停下来.如何设置byobu/tmux以便在我的主目录中打开所有新窗口?
我查看了一些文件,但我似乎无法看到任何导致此问题的命令(例如错误的'chdir').
在Ubuntu中,我可以通过在$ {HOME} /.byobu/.tmuxrc中添加以下行来获得所需的行为:
set-option -g default-path $HOME
Run Code Online (Sandbox Code Playgroud)
此选项是tmux手册页中的文档:
Run Code Online (Sandbox Code Playgroud)set-option [-agoqsuw] [-t target-session | target-window] option value (alias: set) Set a window option with -w (equivalent to the set-window-option command), a server option with -s, otherwise a session option. If -g is specified, the global session or window option is set. With -a, and if the option expects a string, value is appended to the existing setting. The -u flag unsets an option, so a session inherits the option from the global options. It is not possible to unset a global option. The -o flag prevents setting an option that is already set. The -q flag suppresses the informational message (as if the quiet server option was set). Available window options are listed under set-window-option. value depends on the option and may be a number, a string, or a flag (on, off, or omitted to toggle). Available server options are: <snip> default-path path Set the default working directory for new panes. If empty (the default), the working directory is determined from the process running in the active pane, from the command line environment or from the working directory where the session was created. Otherwise the same options are available as for the -c flag to new-window.
我最初尝试过set-option -g default-path ~,但似乎tmux不理解别名.
更新:以上版本不适用于byobu 5.92(可能是其他版本)和tmux 1.9,因为tmux已删除该default-path选项.似乎byobu dev正在使用它来获取CWD中新窗口打开的行为,而我和提问者希望它默认在HOME目录中打开.在新的默认绑定中,/usr/share/byobu/keybindings/f-keys.tmux我发现了这个:
bind-key -n F2 new-window -c "#{pane_current_path}" \; rename-window "-"
bind-key -n C-F2 display-panes \; split-window -h -c "#{pane_current_path}"
bind-key -n S-F2 display-panes \; split-window -v -c "#{pane_current_path}"
Run Code Online (Sandbox Code Playgroud)
要获得始终在主目录中打开新屏幕的所需行为,请将以下内容添加到~/.byobu/keybindings.tmux:
bind-key -n F2 new-window -c "$HOME" \; rename-window "-"
bind-key -n C-F2 display-panes \; split-window -h -c "$HOME"
bind-key -n S-F2 display-panes \; split-window -v -c "$HOME"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1225 次 |
| 最近记录: |