## Copyright (c) 2012-2020 Robert Ryszard Paciorek ## ## MIT License ## ## Permission is hereby granted, free of charge, to any person obtaining a copy ## of this software and associated documentation files (the "Software"), to deal ## in the Software without restriction, including without limitation the rights ## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ## copies of the Software, and to permit persons to whom the Software is ## furnished to do so, subject to the following conditions: ## ## The above copyright notice and this permission notice shall be included in all ## copies or substantial portions of the Software. ## ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ## SOFTWARE. run-shell "tmux setenv -g TMUX_VER_MAJOR $(tmux -V | cut -f2 -d' ' | cut -f1 -d.)" run-shell "tmux setenv -g TMUX_VER_MINOR $(tmux -V | cut -f2 -d' ' | cut -f2 -d.)" # ustawienie zmiennej TERM setenv -g TERM_PARENT "$TERM" run-shell "tmux setenv -g TMUX_TERM screen$(echo $TERM | awk -F- 'NF==2 {printf(\"-%s\", $2)}')" if-shell '[ $TMUX_TERM != "" ]' 'set -g default-terminal "$TMUX_TERM"' # wygodniej używać Ctrl+x niż Ctrl+b (ale zostawiamy Ctrl+b) set -g prefix2 C-x bind-key C-x send-prefix -2 # definiowany przez uzytkownika tekst pomocy # bind-key C-h split-window "less ~/.help.txt" bind-key C-h run-shell "cat ~/.help.txt" # obsluga myszki set -g mouse off unbind m bind-key m set -w mouse # bardziej intuicyjne dzielenie okna bind h split-window -v bind-key H command-prompt -p "join pane from [session:window.pane]:" "join-pane -v -s '%%'" bind v split-window -h bind-key V command-prompt -p "join pane from [session:window.pane]:" "join-pane -h -s '%%'" bind-key ^ confirm-before -p "kill-pane #P? (y/n)" kill-pane # tryb bufora historii set-option -g history-limit 100000 set-option -g mode-keys vi bind Escape copy-mode bind P paste-buffer bind-key -T copy-mode-vi Escape send-keys -X cancel bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi c send-keys -X clear-selection bind-key -T copy-mode-vi y send-keys -X copy-selection unbind -T copy-mode-vi ':' unbind -T copy-mode-vi G bind-key -T copy-mode-vi g send-keys -X goto-line # zapis bufora historii bind-key C-s command-prompt -p 'save pane history to file:' -I '~/tmux.#I-#P.log' 'capture-pane -S -100000 ; save-buffer %1 ; delete-buffer' \; display-message " saved.". bind-key C-l command-prompt -p 'log pane to file:' -I '~/tmux.#I-#P.log' \; pipe-pane -o "exec cat >> %1" \; display-message " log enabled for THIS pane.". bind-key C-q if-shell 'win=`tmux display-message -p "#W"`; [ "$win" = "bash" ] && exit 0; exit 1' 'send-keys " clear" "Enter"' \; clear-history # szybkie przelaczanie okien i paneli bind-key -n M-PPage next-window bind-key -n M-NPage previous-window bind-key -n M-Up select-pane -U bind-key -n M-Down select-pane -D bind-key -n M-Left select-pane -L bind-key -n M-Right select-pane -R # aby tmux nie używał w powyższych sekwencjach ciągu klawiszy Escape, strzałka: set-option -g escape-time 0 # lock'owanie set-option -g lock-command vlock bind-key b lock-session # reload konfiguracji tmux'a ... bardzo przydatne przy tworzeniu konfigu bind-key r source-file ~/.tmux.conf \; display-message " Config reloaded..". # ustawienia paska statusu set-option -g status-bg colour8 set-option -g status-fg white set-option -g status-interval 1 set-option -g status-right-length 26 set-option -g status-right "#[bg=black,fg=red] %F %T %Z" set-option -g status-left-length 128 set-option -g status-left "#[bg=black,fg=yellow,bold]#S:#I.#P #[nobold]#( \ cc() { echo $(echo $1 | cut -c1-$2)...$(echo $1 | cut -c$3-); }; \ bb() { [ $2 -le $(( $3*2+3 )) ] && echo $1 || cc $1 $3 $(( $2 - $3 + 1 )); }; \ aa() { bb \"$1\" $(echo -n \"$1\" | wc -c) $(( ($2-54)/2 )); }; \ aa \"#T\" $( [ #{client_width} -gt 150 ] && echo 150 || echo #{client_width} );) " set-option -g status-justify centre # ustawianie tytulu okna xterm'a set-option -g set-titles on set-option -g set-titles-string '#T (tmux >> #S:#I.#P >> #W)' set-option -g automatic-rename on set-option -g allow-rename on # zegarek bind-key C-t split-window -l 9 'TIMESTAMP=`date +%s`; tmux set-option status off; TZ=Europe/Warsaw date -d @$TIMESTAMP +"%A, %Y-%m-%d %H:%M:%S %Z (%z)"; date -d @$TIMESTAMP --utc +"%A, %Y-%m-%d %H:%M:%S %Z (%z)"; echo "UNIX time: $TIMESTAMP seconds since the epoch"; date -d @$TIMESTAMP --utc +"DAY info: %u day of %V week, %j day of year (in UTC)"; sleep 3; tmux set-option status on; exit' bind-key C-c split-window -l 9 'tmux set-option status off; ncal -M3b; sleep 4; tmux set-option status on; exit' set-option -g clock-mode-colour red set-option -g clock-mode-style 24 # inne if-shell '[ $TMUX_VER_MAJOR -le 2 -a $TMUX_VER_MINOR -lt 3 ]' 'set-option -g utf8 on; set-option -g status-utf8 on' set-option -g alternate-screen on #set-option -g terminal-overrides 'xterm*:smcup@:rmcup@' set-option -g display-time 4000