I want to use something like :
is_active_window="#{==:#{active_window_index},#{window_index}}"
active_i="#[fg=$thm_bg,bg=$thm_orange] #I "
inactive_i="#[fg=$thm_bg,bg=$thm_blue] #I "
styled_i="#{?${is_active_window},${active_i},${inactive_i}}"
But when I do (for example) :
setw -g window-status-format "${styled_i}"
setw -g window-status-current-format "${styled_i}"
I got this :
It is possible to do this kind of stuff (the styled_i variable) in tmux or not ? If yes how ?
I am using neovim and tmux (with tmuxinator) with the ultimate goal of getting https://github.com/christoomey/vim-tmux-navigator setup on my M1 Macbook with iTerm2 or Warp (https://www.warp.dev/)
I have mapped my left option key to be my meta key in my terminal. I would like to use <M-h/j/k/l> in order to navigate between neovim splits and tmux panes. Mapping my left option key to meta and using it with h/j/k/l works as expected in neovim (including neovim in tmux - i.e. i can navigate neovim splits and go from neovim to a tmux terminal pane). However, in a tmux terminal pane it either does nothing in iTerm2 or brings up alternate text (˙∆˚¬ for hjkl to be specific) in Warp.
Below are my configurations which were from https://github.com/christoomey/vim-tmux-navigator and i just updated them to use meta instead of ctrl:
init.vim
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> <M-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <M-j> :TmuxNavigateDown<cr>
nnoremap <silent> <M-k> :TmuxNavigateUp<cr>
nnoremap <silent> <M-l> :TmuxNavigateRight<cr>
nnoremap <silent> <M-\> :TmuxNavigatePrevious<cr>
.tmux.conf
unbind M-h
unbind M-j
unbind M-k
unbind M-l
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys M-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'M-\' select-pane -l
How can i get this to work? I would be happy to get it working on either terminal.
I want to move in tmux copy mode with jkl; instead of hjkl.
How can I remap those key bindings?
I've tried:
unbind -T copy-mode-vi h;
unbind -T copy-mode-vi j;
unbind -T copy-mode-vi k;
unbind -T copy-mode-vi l;
bind -T copy-mode-vi j send-keys -X move-left;
bind -T copy-mode-vi k send-keys -X move-down;
bind -T copy-mode-vi l send-keys -X move-up;
bind -T copy-mode-vi \; send-keys -X move-right;
but it doesn't work. I suppose move-left, move-down, ... commands are not correct.
You are right about the move- commands being wrong, according to the tmux man page you want:
cursor-down
cursor-left
cursor-right
cursor-up
I try since few days to install Openstack (all-in-one) by using KAYOBE.
I follow all configuration steps described here https://docs.openstack.org/kayobe/latest/installation.html and here https://docs.openstack.org/kayobe/latest/configuration/scenarios/all-in-one/overcloud.html#configuration
Everything goes well until to the deployment of containers at step [Creating keystone database]
I get the following error:
TASK [Creating keystone database] *************************************************************************************************************************************************
task path: /home/myuser/KayobeFromSource-VICTORIA-000/venvs/kolla-ansible/share/kolla-ansible/ansible/roles/keystone/tasks/bootstrap.yml:2
<192.168.213.36> ESTABLISH SSH CONNECTION FOR USER: kolla
<192.168.213.36> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="kolla"' -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/bd8f57e3b9 192.168.213.36 '/bin/sh -c '"'"'echo ~kolla && sleep 0'"'"''
<192.168.213.36> (0, b'/home/kolla\n', b'')
<192.168.213.36> ESTABLISH SSH CONNECTION FOR USER: kolla
<192.168.213.36> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="kolla"' -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/bd8f57e3b9 192.168.213.36 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/kolla/.ansible/tmp `"&& mkdir "` echo /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826 `" && echo ansible-tmp-1610524125.732474-54781-193202051714826="` echo /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826 `" ) && sleep 0'"'"''
<192.168.213.36> (0, b'ansible-tmp-1610524125.732474-54781-193202051714826=/home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826\n', b'')
Using module file /home/myuser/KayobeFromSource-VICTORIA-000/venvs/kolla-ansible/share/kolla-ansible/ansible/library/kolla_toolbox.py
<192.168.213.36> PUT /home/myuser/.ansible/tmp/ansible-local-34087ubr5ng1m/tmpm3v5h_xa TO /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826/AnsiballZ_kolla_toolbox.py
<192.168.213.36> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="kolla"' -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/bd8f57e3b9 '[192.168.213.36]'
<192.168.213.36> (0, b'sftp> put /home/myuser/.ansible/tmp/ansible-local-34087ubr5ng1m/tmpm3v5h_xa /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826/AnsiballZ_kolla_toolbox.py\n', b'')
<192.168.213.36> ESTABLISH SSH CONNECTION FOR USER: kolla
<192.168.213.36> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="kolla"' -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/bd8f57e3b9 192.168.213.36 '/bin/sh -c '"'"'chmod u+x /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826/ /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826/AnsiballZ_kolla_toolbox.py && sleep 0'"'"''
<192.168.213.36> (0, b'', b'')
<192.168.213.36> ESTABLISH SSH CONNECTION FOR USER: kolla
<192.168.213.36> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="kolla"' -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/bd8f57e3b9 -tt 192.168.213.36 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-tbgufwaydrmyknjdvkvrkovocfzsrwaz ; /opt/kayobe/venvs/kolla-ansible/bin/python /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826/AnsiballZ_kolla_toolbox.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
Escalation succeeded
<192.168.213.36> (0, b'\r\n{"action": "mysql_db", "changed": false, "failed": true, "invocation": {"module_args": {"ca_cert": null, "client_cert": null, "client_key": null, "collation": "", "config_file": "/var/lib/ansible/.my.cnf", "connect_timeout": 30, "encoding": "", "ignore_tables": [], "login_host": "192.168.213.100", "login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "login_port": 3306, "login_unix_socket": null, "login_user": "root", "name": ["keystone"], "quick": true, "single_transaction": false, "state": "present", "target": null}}, "msg": "unable to find /var/lib/ansible/.my.cnf. Exception message: (1045, \\"Access denied for user \'root\'#\'controller0\' (using password: YES)\\")"}\r\n', b'Shared connection to 192.168.213.36 closed.\r\n')
<192.168.213.36> ESTABLISH SSH CONNECTION FOR USER: kolla
<192.168.213.36> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="kolla"' -o ConnectTimeout=10 -o ControlPath=/home/myuser/.ansible/cp/bd8f57e3b9 192.168.213.36 '/bin/sh -c '"'"'rm -f -r /home/kolla/.ansible/tmp/ansible-tmp-1610524125.732474-54781-193202051714826/ > /dev/null 2>&1 && sleep 0'"'"''
<192.168.213.36> (0, b'', b'')
fatal: [controller0 -> 192.168.213.36]: FAILED! => {
"action": "mysql_db",
"changed": false,
"invocation": {
"module_args": {
"ca_cert": null,
"client_cert": null,
"client_key": null,
"collation": "",
"config_file": "/var/lib/ansible/.my.cnf",
"connect_timeout": 30,
"encoding": "",
"ignore_tables": [],
"login_host": "192.168.213.100",
"login_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"login_port": 3306,
"login_unix_socket": null,
"login_user": "root",
"name": [
"keystone"
],
"quick": true,
"single_transaction": false,
"state": "present",
"target": null
}
},
"msg": "unable to find /var/lib/ansible/.my.cnf. Exception message: (1045, \"Access denied for user 'root'#'controller0' (using password: YES)\")"
For information, I am using VMWare Workstation 16 with a VM with CentOS 8.
I tried to Google and find possible fixes but without success.
Any idea and help will be much appreciated !
Thank you.
Finally I found. The issue was that I tried several times to install openstack and each time I deleted files and docker images. but I never deleted docker volumes. When I deleted them and reinstall openStack with Kayobe, everything worked fine.
I'm trying to get rid of Oh-my-zsh and currently my biggest challenge is getting incremental history search working. I've acked and grepped my way through the code and there's no clues in site. I get this error :
No such widget 'histrory-beginning-search-backward'
EDIT:
I've tried this with the absolute least possible code, it still doesn't work. here's the reduced test case:
# key bindings
bindkey -v
function zle-line-init zle-keymap-select {
RPS1="${${KEYMAP/vicmd/NORMAL}/(main|viins)/INSERT}"
RPS2=$RPS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
bindkey -M vicmd '^R' histrory-beginning-search-backward
bindkey -M viins '^R' histrory-beginning-search-backward
Here's my config, taken from the zsh config wizzard, my current zshrc and oh-my-zsh:
autoload zkbd
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'zstyle ':completion:*' verbose true
zstyle :compinstall filename '/home/jonathan/.zshrc'
zstyle ':completion:*' list-colors ''
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $HOME/.cache/zsh
#load colorstuff
autoload -Uz compinit
autoload -U colors && colors
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt extendedglob
unsetopt beep nomatch notify
# End of lines configured by zsh-newuser-install
setopt completealiases
# Ignore boring stuff
zstyle ':completion:*:*:*:users' ignored-patterns \
adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
usbmux uucp vcsa wwwrun xfs '_*'
zstyle ':completion:*:functions' ignored-patterns '_*'
# Completion dots
expand-or-complete-with-dots() {
echo -n "\e[31m......\e[0m"
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots
# Prompt stuff *truncated*
# key bindings
bindkey -v
function zle-line-init zle-keymap-select {
RPS1="${${KEYMAP/vicmd/NORMAL}/(main|viins)/INSERT}"
RPS2=$RPS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
bindkey -M vicmd '^R' histrory-beginning-search-backward
bindkey -M viins '^R' histrory-beginning-search-backward
function run-again {
zle up-history
zle accept-line
}
zle -N run-again
bindkey -M viins '^W' run-again
bindkey -M vicmd '^W' run-again
bindkey -M viins ' ' magic-space # [Space] - do history expansion
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
if [[ "${terminfo[kcbt]}" != "" ]]; then
bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
fi
dirstackfile="$HOME/.cache/zsh/dirs"
if [[ -f dirstackfile ]] && [[ $#dirstack -eq 0 ]]; then
dirstack=( ${(f)"$(< $dirstackfile)"} )
[[ -d $dirstack[1] ]] && builtin cd $dirstack[1]
fi
chpwd() {
print -l $PWD ${(u)dirstack} > $dirstackfile
}
dirstacksize=20
setopt autopushd pushdsilent pushdtohome
# remove duplicate entries
setopt pushdignoredups
#revert plus and minus operators.
setopt pushdminus
#PATH info truncated
What am I doing wrong?
Whoops... I had a typo, now I feel dumb. I had it as histrory, when it should be history..