Nov 26, 2014

fast switching to a specific window in a different tmux terminal-session

tmux and tmuxinator ( mux ) allow the usage of multiple shells in one
or more sessions.

The Terminal can be detached from the session and everything is still
running in the background.

If you have multiple sessions in tmux running ( perhaps configured with
tmuxinator ), you can switch between the sesssions with
<Ctrl>-<a><s> or <Host-Key><s>, which shows all sessions.

Per accident I found, that you can show all windows in a session by
moving the selection to the session an pressing the <right-Arrow-Key>
( left-Arrow-Key closes the view of the windows ).

After selecting the window in the session, you're directly put into this
shell.


Nov 19, 2014

Getting hg ( mercurial) completion in bash

On my Fedora 20 environment I'm using Mercurial ( hg ) beside svn & git for
version control.

This is a nice distributed version control system, which was the only one
available on Solaris/Linux/Windows, at the time I switched. Git was available
on windows only by using a cygwin environment.

Now git on my Fedora box has a nice little command/branch-name ...
completion.
When starting commands and typing <TAB> the suitable completion is
searched and shown, if there are multiple ones.


For hg I was missing this, because I install mercurial from source on my
fedora system.

The missing key part is to source in the completion file into .bashrc in the
homedirectory. The completion file is delivered in the source release of mercurial:

e.g.:

if [ -f /tools/DevTools/mercurial/latest/contrib/bash_completion ]; then
    . /tools/DevTools/mercurial/latest/contrib/bash_completion
fi

After resourcing the .bashrc the completion also works for hg

[ewer@lxewer hg-git]$ hg checkout<TAB>
0.1.0    0.2.2    0.2.5    0.3.1    0.3.4    0.6.0    master  
0.2.0    0.2.3    0.2.6    0.3.2    0.4.0    0.6.1    next    
0.2.1    0.2.4    0.3.0    0.3.3    0.5.0    default  tip     
[ewer@lxewer hg-git]$ hg checkout 0.<TAB>
0.1.0  0.2.1  0.2.3  0.2.5  0.3.0  0.3.2  0.3.4  0.5.0  0.6.1 
0.2.0  0.2.2  0.2.4  0.2.6  0.3.1  0.3.3  0.4.0  0.6.0 

Nov 12, 2014

Repeat command in bash and replacing arguments in Fedora 20

I'm running one command a lot again, but have to replace some
arguments.

e.g.

wo abcd > abcd.log 

Instead of retyping everything again you can :

!!:gs/abcd/efgh/

which results in the command
wo efgh > efgh.log 

being executed.
The '!!' repeat the last command executed from the history. See also '!-5' or
the absolute command nummber '!93' and the 'gs' for global substitution. 

There's also a simple version with just 's', but this does just one subsitution.


Nov 10, 2014

TAB-completion in bash on Fedora 20 escapes the $-Sign of the variable - how to prevent

I'm copying files on the bash command line on Fedora 20.

To deploy a war, I've set the JBOSS_HOME environmentvariable and
deploy the war with

cp target/service.war $JOBSS_HOME/sta

and do here a <TAB> to complete to standalone, but in this case the command line get to

cp target/service.war \$JBOSS_HOME/standalone 

For the next completion of deployment the $ must be unescaped.

I found a hint here.

One way is to enable directory expansion with

shopt -s direxpand

or to use 

<Ctrl>-<Alt>-<e>
 to expand. 

Since the setting of the shell option must be done everywhere, even when logging in to a different server, I tend 
to remember the <Ctrl>-<Alt>-<e> .