tmux

“python: can't open file 'manage.py': [Errno 2] No such file or directory” when running tmux shell script?

核能气质少年 提交于 2019-12-13 03:15:16
问题 I am trying to run a very simple tmux shell script called "split.sh" which splits the terminal windows. split.sh: #!/bin/bash ~/build/tmux-1.5/tmux split-window -h ~/build/tmux-1.5/tmux split-window -v ~/build/tmux-1.5/tmux split-window -h When I type the command "sh ~/build/tmux-1.5/split.sh", this shell script runs fine, splitting the terminal windows. However, when I set an aliases, alias sp='sh ~/build/tmux-1.5/split.sh' and then run "sp", the terminal gives me a wierd error: python: can

Tmux 使用教程

a 夏天 提交于 2019-12-13 00:41:10
Tmux 是一个终端复用器(terminal multiplexer),非常有用,属于常用的开发工具。 本文介绍如何使用 Tmux。 一、Tmux 是什么? 1.1 会话与进程 命令行的典型使用方式是,打开一个终端窗口(terminal window,以下简称"窗口"),在里面输入命令。 用户与计算机的这种临时的交互,称为一次"会话"(session) 。 会话的一个重要特点是,窗口与其中启动的进程是 连在一起 的。打开窗口,会话开始;关闭窗口,会话结束,会话内部的进程也会随之终止,不管有没有运行完。 一个典型的例子就是, SSH 登录 远程计算机,打开一个远程窗口执行命令。这时,网络突然断线,再次登录的时候,是找不回上一次执行的命令的。因为上一次 SSH 会话已经终止了,里面的进程也随之消失了。 为了解决这个问题,会话与窗口可以"解绑":窗口关闭时,会话并不终止,而是继续运行,等到以后需要的时候,再让会话"绑定"其他窗口。 1.2 Tmux 的作用 Tmux 就是会话与窗口的"解绑"工具,将它们彻底分离。 (1)它允许在单个窗口中,同时访问多个会话。这对于同时运行多个命令行程序很有用。 (2) 它可以让新窗口"接入"已经存在的会话。 (3)它允许每个会话有多个连接窗口,因此可以多人实时共享会话。 (4)它还支持窗口任意的垂直和水平拆分。 类似的终端复用器还有 GNU Screen

如何有效地在Vim中处理多个文件?

房东的猫 提交于 2019-12-12 18:09:28
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我已经开始使用Vim开发Perl脚本,并且开始发现它非常强大。 我喜欢的一件事是能够使用 vi main.pl maintenance.pl 例如一次打开多个文件,然后使用以下命令在它们之间跳转: :n :prev 并查看打开哪个文件 :args 要添加文件,我可以说: :n test.pl 我希望它将添加到我的文件列表中,但是它将清除当前文件列表,当我键入 :args 我只打开了 test.pl 那么如何将文件添加和删除到我的args列表中? #1楼 如果您使用的是osx,并且希望能够单击选项卡,请使用MouseTerm和SIMBL(从 此处获取 )。 另外,请查看此 相关讨论 。 #2楼 您可能需要使用 Vim全局标记 。 这样,您可以快速在文件之间跳动,甚至跳到文件中标记的位置。 而且,关键命令很简短: 'C 带我进入正在使用的代码, 'T 带我进入正在使用的单元测试。 当您更改位置时,重置标记也很快: mC 标记新的代码点, mT 标记新的测试点。 #3楼 尝试以下地图以方便编辑多个文件 分割窗户 nmap <leader>sh :leftabove vnew<CR> nmap <leader>sl :rightbelow vnew<CR> nmap <leader>sk :leftabove new

Tmux: Auto-hide panel when it loses focus

我是研究僧i 提交于 2019-12-12 17:25:07
问题 I've recently started using tmux for my Vim editing. In PyCharm, I used to have a terminal at the bottom which I could toggle in and out of the screen with a few keystrokes. I'd like to have the same ability with tmux: Edit code fullscreen in Vim, then when I need to run a command, go directly to a terminal pane at the bottom of the screen, then go back to fullscreen coding. Is there any way I can configure tmux to do that? 回答1: Tmux has an inbuilt 'zoom' feature. By default it is mapped to

将文本粘贴到vim时关闭自动缩进

Deadly 提交于 2019-12-12 13:03:32
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我正在努力学习Vim。 当我从剪贴板将代码粘贴到我的文档中时,我会在每个新行的开头添加额外的空格: line line line 我知道你可以关闭自动缩进,但我无法让它工作,因为我有一些其他设置冲突或某事(在我的.vimrc中看起来非常明显,但是当我把它们取出时似乎并不重要)。 当我粘贴代码时如何关闭自动缩进但在编写代码时仍然有自动缩进? 这是我的 .vimrc 文件: set expandtab set tabstop=2 set shiftwidth=2 set autoindent set smartindent set bg=dark set nowrap #1楼 这适用于我(+寄存器的情况,我使用的像aps之间的交换缓冲区): imap <silent> <S-Insert> <C-O>:set noai<CR><C-R>+<C-O>:set ai<CR> #2楼 把它粘在你的〜/ .vimrc中并开心: " enables :Paste to just do what you want command Paste execute 'set noai | insert | set ai' 编辑:反思, :r !cat 是一个更好的方法,因为它很短,语义,并且不需要自定义vimrc。 改用它! #3楼

How to get stdout and stderr from a tmux session?

梦想的初衷 提交于 2019-12-12 12:27:39
问题 I am writing a sample python program in linux system. I am using tmux to create a session and execute another script within the tmux-session. I would like to get the stdout and stderr out of the tmux session to the parent script but that somehow does not work. Code snippet: cmd = "tmux new-session -d -s 'test' '/my_dir/fibonacci.py __name:=fibonacci_0'" proc = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) (stdout, stderr) = proc.communicate() print(stderr) I have came across answers to use

Have tmux windows inherit `activate`d anaconda environment

拜拜、爱过 提交于 2019-12-12 11:56:54
问题 For convenience and given that activate-ing an environment is crazy slow, I want to activate an environment and then start a tmux session. I want all new tmux windows to also have the environment activated. I want different tmux sessions to be able to support different anaconda environments. How do I go about this? Are there any gotchas such that this isn't supported by anaconda / miniconda ? 回答1: What I've done to address this problem is: In .tmux.conf , copy CONDA_DEFAULT_ENV environment

tmuxinator initialize pane with multiple commands

荒凉一梦 提交于 2019-12-12 08:27:16
问题 I am using Tmuxinator, and I was wondering is there anyway to initialize a Tmux pane using multiple commands? Example panes: - vim - workon project #activate virtualenv and .. ./manage.py runserver #run sever 回答1: This is supported from 0.6.6. name: sample root: ~/ windows: - stats: - ssh stats@example.com - tail -f /var/log/stats.log - logs: layout: main-vertical panes: - logs: - ssh logs@example.com - cd /var/logs - tail -f development.log Please refer to https://github.com/aziz/tmuxinator

Find tmux session that a PID belongs to

本秂侑毒 提交于 2019-12-12 08:05:54
问题 I am using htop so see what processes are taking up a lot of memory so I can kill them. I have a lot of tmux sessions and lots of similar processes. How can I check which tmux pane a PID is in so I can be sure I am killing stuff I want to kill? 回答1: Given that PID in the below line is the target pid number: $ tmux list-panes -a -F "#{pane_pid} #{pane_id}" | grep ^PID The above will identify the pane where the PID is running. The output will be two strings. The first number should be the same

How would I go about binding the HOME key as a tmux prefix?

爱⌒轻易说出口 提交于 2019-12-12 08:02:22
问题 Is there a way to do this in ~/.tmux.conf? 回答1: If everything else is configured correctly, it should be as simple as putting this in your .tmux.conf : set-option -g prefix Home Note: Unless you manually “source” your .tmux.conf , changes to the file will only take affect when the tmux server is restarted. Either cleanly exit all your panes, windows (thus closing all your sessions and letting the server exit), or use tmux kill-server , then start a fresh session. This will only work if your