Gar*_*eth 54 linux bash command-line-interface dotfiles gnu-screen
基本上就像我在下面发布的一些我自己的一样。我正在寻找程序“屏幕”的附加功能。至少看看最后一行屏幕会话底部的一个很棒的“菜单栏”。
## gyaresu's .screenrc 2008-03-25
# http://delicious.com/search?p=screenrc
# Don't display the copyright page
startup_message off
# tab-completion flash in heading bar
vbell off
# keep scrollback n lines
defscrollback 1000
# Doesn't fix scrollback problem on xterm because if you scroll back
# all you see is the other terminals history.
# termcapinfo xterm|xterms|xs|rxvt ti@:te@
# These will let you use
bind -c selectHighs 0 select 10 #these three commands are
bind -c selectHighs 1 select 11 #added to the command-class
bind -c selectHighs 2 select 12 #selectHighs
bind -c selectHighs 3 select 13
bind -c selectHighs 4 select 14
bind -c selectHighs 5 select 15
bind - command -c selectHighs #bind the hyphen to
#command-class selectHighs
screen -t rtorrent 0 rtorrent
#screen -t tunes 1 ncmpc --host=192.168.1.4 --port=6600 #was for connecting to MPD music server.
screen -t stuff 1
screen -t irssi 2 irssi
screen -t dancing 4
screen -t python 5 python
screen -t giantfriend 6 these_are_ssh_to_server_scripts.sh
screen -t computerrescue 7 these_are_ssh_to_server_scripts.sh
screen -t BMon 8 bmon -p eth0
screen -t htop 9 htop
screen -t hellanzb 10 hellanzb
screen -t watching 3
#screen -t interactive.fiction 8
#screen -t hellahella 8 paster serve --daemon /home/gyaresu/downloads/hellahella/hella.ini
shelltitle "$ |bash"
# THIS IS THE PRETTY BIT
#change the hardstatus settings to give an window list at the bottom of the
##screen, with the time and date and with the current window highlighted
hardstatus alwayslastline
#hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
Run Code Online (Sandbox Code Playgroud)
Ham*_*ner 22
对于那些想要一种不太神秘的方式来设置漂亮屏幕的人,我可以衷心推荐byobu(以前称为屏幕配置文件)。它在屏幕底部为您提供了一组很好的默认内容 - 底行包含各种方便的状态信息,底行的第二行包含您的屏幕窗口列表。所有这些都可以通过按 F9 在一个非常简单的 ncurses 菜单中进行配置。
功能键映射到常用操作:
Byobu 从 karmic (9.10) 开始就在 ubuntu 存储库中。在 jaunty 中,它被称为屏幕配置文件。在此之前,它可以从这个下载页面的这个 ppa安装。它也被广泛打包用于其他最新的发行版。
它确实依赖于 python,但是一旦你按照自己的喜好设置了 byobu,你就可以让它生成一个 tar 球,其中包含使用byobu-export在另一台计算机上重新创建屏幕所需的所有内容。
ram*_*ion 12
我还使用了一个相当复杂的标题/硬状态行组合,来模拟下拉选项卡的效果(标题行是纯灰色,硬状态中的当前选项卡是相同的颜色)。
我还有我的 shell 告诉屏幕当前进程名称是什么以及我在哪个目录中,所以我的选项卡名称与我在每个选项卡中所做的事情保持同步。这对于记住我在何处做什么而不必浏览所有打开的标签至关重要。
# don't use the hardstatus line for system messages, use reverse video instead
# (we'll be using it for the list of tab windows - see hardstatus alwayslastline
# below)
hardstatus off
# use the caption line for the computer name, load, hstatus (as set by zsh), & time
# the caption line gets repeated for each window being displayed (using :split),
# so we'll use color cues to differentiate the caption of the current, active
# window, and the others.
# always - display the caption continuously. Since
# hardstatus is 'alwayslastline', it will be on the
# next to last line.
# "%?%F" - if (leading '%?') this region has focus ('%F')
# (e.g. it's the only region being displayed, or,
# if in split-screen mode, it's the currently active
# region)
# "%{= Kk}" - set the colorscheme to blac[k] on grey (bright blac[K]),
# with no other effects (standout, underline, etc.)
# "%:" - otherwise ('%:' between a pair of '%?'s)
# "%{=u kR}" - set the colorscheme to [R]ed on blac[k], and
# underline it, but no other effects (bold, standout, etc.)
# "%?" - end if (trailing '%?')
# " %h " - print two spaces, tthne the [h]ardstatus of the
# current tab window (as set by zsh - see zshrc) and
# then another space.
# "%-024=" - either pad (with spaces) or truncate the previous
# text so that the rest of the caption string starts
# 24 characters ('024') from the right ('-') edge of
# the caption line.
# NOTE: omitting the '0' before the '24' would pad
# or truncate the text so it would be 24% from the
# right.
# "%{+b} - add ('+') [b]old to the current text effects, but
# don't change the current colors.
# " %C:%s%a %D %d %M %Y" - print the [C]urrent time, a colon, the [s]econds,
# whether it's [a]m or pm, the [D]ay name, the [d]ay
# of the month, the [M]onth, and the [Y]ear.
# (this takes up 24 characters, so the previous
# pad/truncate command makes sure the clock doesn't
# get pushed off of the caption line)
# "%{= dd}" - revert to the [d]efault background and [d]efault
# foreground colors, respectively, with no ('= ')
# other effects.
# other things that might be useful later are
# " %H" - print a space, then the [H]ostname.
# "(%{.K}%l%{-}):" - print a '(', then change the text color to grey
# (aka bright blac[K]), and print the current system
# [l]oad. Then revert to the previous colorscheme
# ('%{-}') and print a close ')' and a colon.
# NOTE: the load is only updated when some other
# portion of the caption string needs to be changed
# (like the seconds in the clock, or if there were a
# backtick command)
# "%0`" - put the output of a backtick command in the line
# "%-024<" - don't pad, just truncate if the string is past 24
# characters from the right edge
# "%-=" - pad (with spaces) the previous text text so that
# the rest of the caption string is justified
# against the right edge of the screen.
# NOTE: doesn't appear to truncate previous text.
caption always "%?%F%{= Kk}%:%{=u kR}%? %h %-024=%{+b} %C%a %D %d %M %Y%{= db}"
# use the hardstatus line for the window list
# alwayslastline - always display the hardstatus as the last line of the
# terminal
# "%{= kR} %-Lw" - change to a blac[k] background with bright [R]ed text,
# and print all the tab [w]indow numbers and titles in
# the [L]ong format (ie with flags) upto ('-') the
# current tab window
# "%{=b Kk} %n%f %t " - change to grey (bright blac[K]) background with
# [b]old blac[k] text, with no other effects, and print
# the [n]umber of the current tab window, any [f]lags it
# might have, and the [t]itle of the current tab window
# (as set by zsh - see zshrc).
# NOTE: the color match with the caption line makes it
# appear as if a 'tab' is dropping down from the caption
# line, highlighting the number & title of the current
# tab window. Nifty, ain't it)
# "%{-}%+Lw " - revert to the previous color scheme (red on black)
# and print all the tab [w]indow numbers and titles in
# the [L]ong format (ie with flags) after ('+') the
# current tab window.
# "%=%{= dd}" - pad all the way to the right (since there is no text
# that follows this) and revert to the [d]efault
# background and [d]efault foreground colors, with no
# ('= ') other effects.
hardstatus alwayslastline "%{= kR} %-Lw%{=b Kk} %n%f %t %{-}%+Lw %=%{= dd}"
Run Code Online (Sandbox Code Playgroud)
所以这是我的 zshrc 设置,用于告诉屏幕我在每个选项卡中正在做什么。
# ~/.zshrc
# if using GNU screen, let the zsh tell screen what the title and hardstatus
# of the tab window should be.
if [[ $TERM == "screen" ]]; then
_GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^~$USER/~/"'
# use the current user as the prefix of the current tab title (since that's
# fairly important, and I change it fairly often)
TAB_TITLE_PREFIX='"`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
# when at the shell prompt, show a truncated version of the current path (with
# standard ~ replacement) as the rest of the title.
TAB_TITLE_PROMPT='$SHELL:t'
# when running a command, show the title of the command as the rest of the
# title (truncate to drop the path to the command)
TAB_TITLE_EXEC='$cmd[1]:t'
# use the current path (with standard ~ replacement) in square brackets as the
# prefix of the tab window hardstatus.
TAB_HARDSTATUS_PREFIX='"[`'$_GET_PATH'`] "'
# when at the shell prompt, use the shell name (truncated to remove the path to
# the shell) as the rest of the title
TAB_HARDSTATUS_PROMPT='$SHELL:t'
# when running a command, show the command name and arguments as the rest of
# the title
TAB_HARDSTATUS_EXEC='$cmd'
# tell GNU screen what the tab window title ($1) and the hardstatus($2) should be
function screen_set()
{
# set the tab window title (%t) for screen
print -nR $'\033k'$1$'\033'\\\
# set hardstatus of tab window (%h) for screen
print -nR $'\033]0;'$2$'\a'
}
# called by zsh before executing a command
function preexec()
{
local -a cmd; cmd=(${(z)1}) # the command string
eval "tab_title=$TAB_TITLE_PREFIX$TAB_TITLE_EXEC"
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX$TAB_HARDSTATUS_EXEC"
screen_set $tab_title $tab_hardstatus
}
# called by zsh before showing the prompt
function precmd()
{
eval "tab_title=$TAB_TITLE_PREFIX$TAB_TITLE_PROMPT"
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX$TAB_HARDSTATUS_PROMPT"
screen_set $tab_title $tab_hardstatus
}
fi
Run Code Online (Sandbox Code Playgroud)
小智 10
恕我直言,最有用的屏幕自定义是将修饰键更改为 Ca 以外的其他内容。这对于吃掉的键来说太重要了(在所有 readline 提示和 emacs 中转到行的开头)。我使用 Cz,因为与需要在行首编辑内容相比,我需要暂停应用程序的频率要低得多。
神奇的词是:
escape ^za
Run Code Online (Sandbox Code Playgroud)
我经常有 10 多个窗口在运行,并且想要一种选择它们的方法。我发现了如何配置 Ca Shift+0 到 9 来选择窗口 10 到 19。
bind ! select 11
bind @ select 12
bind \# select 13
bind $ select 14
bind % select 15
bind \^ select 16
bind & select 17
bind * select 18
bind ( select 19
bind ) select 10
Run Code Online (Sandbox Code Playgroud)
注意 # 和 ^ 上的转义符。
厌倦了像 vim 这样的全屏程序在关闭后仍留在回滚缓冲区中?如果它们像您不运行 screen 时那样完全消失,那不是很好吗?试着把它放在你的 ~/.screenrc 文件中...
altscreen on
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
113904 次 |
| 最近记录: |