Browse Source

[#23] Convert terminal into a module

master
Sorin Ionescu 13 years ago
parent
commit
56f8f83d58
  1. 1
      init.zsh
  2. 4
      modules/terminal/init.zsh
  3. 2
      templates/zshrc

1
init.zsh

@ -49,7 +49,6 @@ autoload -Uz compinit && compinit -i
# Source files (the order matters). # Source files (the order matters).
source "${0:h}/helper.zsh" source "${0:h}/helper.zsh"
source "${0:h}/environment.zsh" source "${0:h}/environment.zsh"
source "${0:h}/terminal.zsh"
# Source modules defined in ~/.zshrc. # Source modules defined in ~/.zshrc.
for omodule in "$omodules[@]"; do for omodule in "$omodules[@]"; do

4
terminal.zsh → modules/terminal/init.zsh

@ -78,7 +78,7 @@ autoload -Uz add-zsh-hook
# Sets the tab and window titles before the prompt is displayed. # Sets the tab and window titles before the prompt is displayed.
function set-title-precmd { function set-title-precmd {
if zstyle -t ':omz:terminal' auto-title; then if zstyle -t ':omz:module:terminal' auto-title; then
if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then
# Set the current working directory in Apple Terminal. # Set the current working directory in Apple Terminal.
printf '\e]7;%s\a' "file://$HOST${PWD// /%20}" printf '\e]7;%s\a' "file://$HOST${PWD// /%20}"
@ -95,7 +95,7 @@ add-zsh-hook precmd set-title-precmd
# Sets the tab and window titles before command execution. # Sets the tab and window titles before command execution.
function set-title-preexec { function set-title-preexec {
if zstyle -t ':omz:terminal' auto-title; then if zstyle -t ':omz:module:terminal' auto-title; then
set-title-by-command "$2" set-title-by-command "$2"
fi fi
} }

2
templates/zshrc

@ -18,7 +18,7 @@ zstyle ':omz:*:*' case-sensitive 'no'
zstyle ':omz:*:*' color 'yes' zstyle ':omz:*:*' color 'yes'
# Auto set the tab and window titles. # Auto set the tab and window titles.
zstyle ':omz:terminal' auto-title 'yes' zstyle ':omz:module:terminal' auto-title 'yes'
# Set the Zsh modules to load (man zshmodules). # Set the Zsh modules to load (man zshmodules).
# zstyle ':omz:load' zmodule 'attr' 'stat' # zstyle ':omz:load' zmodule 'attr' 'stat'

Loading…
Cancel
Save