Wednesday, August 15, 2012

vim settings / tricks i use


Here are some settings i personally use.
I will extend this post as soon as discover more.

/etc/vimrc
syntax on (syntax highlighting)
set number (line numbers)
set keywordprg=perldoc\ -f (shift-k opens perldoc for item under cursor )

to be continued

Saturday, August 11, 2012

Extended bash tab completion

Just install the package "bash-completion" in archlinux und you will get extended tab completion for the following programs: http://wklej.org/id/808581

*edit: Make sure  "/etc/bash.bashrc" is up-to-date otherwise it may not work.

Even tab completion for rsync and scp remote files structures works now.

Monday, July 30, 2012

Bash prompt shortener

Add this to your ~/.bashrc
# Bash shortener
_PS1 ()
{
    local PRE= NAME="$1" LENGTH="$2";
    [[ "$NAME" != "${NAME#$HOME/}" || -z "${NAME#$HOME}" ]] &&
        PRE+='~' NAME="${NAME#$HOME}" LENGTH=$[LENGTH-1];
    ((${#NAME}>$LENGTH)) && NAME="/...${NAME:$[${#NAME}-LENGTH+4]}";
    echo "$PRE$NAME"
}
PS1=' \[\e[0m\]\u\[\e[0;32m\]@\[\e[0m\]\h \[\e[0;32m\]$(_PS1 "$PWD" 30) \[\e[0m\]$ '
It will shorten the path in your bash prompt to 30 chars.

Saturday, January 7, 2012

Start applications with the default app from console

Its as simple as. Add this to your ~/.bashrc
alias open='nohup xdg-open >/dev/null 2>&1'
 Now you can start, for example a textfile, like this "open textfile.txt". Because of nohop in the alias you can even close the console session and the text editor stays open.

Wednesday, January 4, 2012

Eclipse shortcuts

Ctrl + d = delete line
Alt + up = current line up
Ctrl + Alt + Up = Copy current line
F3 = open declaration
Ctrl + shift + G = Find all references
Ctrl + 1 = Quick fix popup
Ctrl + i = fixes indent
Alt + shift + R = rename variable

Ctrl + shift + f = format code

"syso" & Ctrl + space = System.out.println("");
"main" & Ctrl + space = public static void main(String[] args){}

Thursday, November 17, 2011

Increase sudo timeout

There are two relevant values:

passwd_timeout  Number of minutes before the sudo password prompt times out, or 0 for no timeout.  The timeout may include a fractional component if minute granularity is insufficient, for example 2.5.  The default is 5.
timestamp_timeout Number of minutes that can elapse before sudo will ask for a passwd again.  The timeout may include a fractional component if minute granularity is insufficient, for example 2.5.  The default is 5.  Set this to 0 to always prompt for a password.  If set to a value less than 0 the user's timestamp will never expire.  This can be used to allow users to create or delete their own timestamps via sudo -v and sudo -k respectively.

I find i quit annoying when the prompt times out or you have to type in the password to often.

This are my values:
Defaults timestamp_timeout=30
Defaults passwd_timeout=0
Add them to your sudo conf with visudo.

Sunday, October 2, 2011

More speed (responsiveness) for the linux desktop

Ram and file system cache:
vm.swappiness=20
vm.vfs_cache_pressure=50
more info

Preload most used applications/libs:

preload 
more info


Mounting /tmp to RAM

add this to your fstab:

tmpfs /tmp tmpfs defaults,noatime,nodev,nosuid,mode=1777 0 0

more info


BFS Kernel
There is a set of kernel patches that increases the responsiveness of the linux desktop. This is not limited to archlinux btw.

There are two main ways to get it on archlinux:
Build it from AUR: yaourt -S linux-ck

Or us a repository with precompiled packages:

[repo-ck]
Server = http://repo-ck.com/$arch

more info