tune_nano_vim_bashrc

tune_nano_vim_bashrc(){
    clear
    f_banner
    echo -e "\e[34m---------------------------------------------------------------------------------------------------------\e[00m"
    echo -e "\e[93m[+]\e[00m Tunning bashrc, nano and Vim"
    echo -e "\e[34m---------------------------------------------------------------------------------------------------------\e[00m"
    echo ""

# Tune .bashrc
    echo "Tunning .bashrc......"
    spinner
    cp templates/bashrc-root /root/.bashrc
    cp templates/bashrc-user /home/$username/.bashrc
    chown $username:$username /home/$username/.bashrc
    echo "OK"
    say_done


# Tune Vim
    echo "Tunning Vim......"
    spinner
    tunning vimrc
    echo "OK"


# Tune Nano
    echo "Tunning Nano......"
    spinner
    tunning nanorc
    echo "OK"
}

La Función tune_nano_bashrc optimiza los bashrc, vim, y nano para un mejor funcionamiento y darle mas comodidad al usuario vía el uso de alias. Hace uso de las plantillas en templates/bashrc-root, bashrc-user, nanorc, vimrc. Hace ademas uso de la función tunning en helper.sh.

# Copy Local Config Files
function tunning() {
    whoapp=$1
    cp templates/$whoapp /root/.$whoapp
    cp templates/$whoapp /home/$username/.$whoapp
    chown $username:$username /home/$username/.$whoapp
    say_done
}

Veamos el contenido de los archivos:

bashrc-root

[ -z "$PS1" ] && return

HISTCONTROL=ignoredups:ignorespace

shopt -s histappend

HISTSIZE=1000
HISTFILESIZE=2000

shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac


force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls -lh --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF --color=auto'
alias la='ls -A --color=auto'
alias l='ls -CF --color=auto'
alias .='cd ..'
alias ls='ls -l --color=auto'
alias arestart='service apache2 restart'
alias sysupdate='apt-get update; apt-get upgrade -y'
alias doinstall='apt-get install'
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
alias mysql='mysql -uroot -p'
alias tree='tree --dirsfirst'


if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi


function md5 {
    php -r "echo md5('$1') . chr(10);"
}

bashrc-user

[ -z "$PS1" ] && return

HISTCONTROL=ignoredups:ignorespace

shopt -s histappend

HISTSIZE=1000
HISTFILESIZE=2000

shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls -lh --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF --color=auto'
alias la='ls -A --color=auto'
alias l='ls -CF --color=auto'
alias .='cd ..'
alias ls='ls -l --color=auto'
alias arestart='sudo service apache2 restart'
alias sysupdate='sudo apt-get update; sudo apt-get upgrade -y'
alias doinstall='sudo apt-get install'
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
alias mysql='mysql -uroot -p'
alias tree='tree --dirsfirst'

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

function md5 {
    php -r "echo . md5('$1') . chr(10);"
}

nanorc

set autoindent          " identación automática
unset backup            " no crear backups file~
set const               " muestra la posición del cursor en la barra de estado
set morespace           " usa la primera línea debajo del título para codear
set nowrap              " no wrapear el texto
set tabsize 4           " Identación de 4 espacios en blanco
set tabstospaces        " Convierte los tabulados a espacios

vimrc

runtime! debian.vim

if has("syntax")
  syntax on
endif

if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

if has("autocmd")
  filetype plugin indent on
endif


set showmatch        " Show matching brackets.
set ignorecase        " Do case insensitive matching
set hlsearch        " Resaltar la búsqueda
set incsearch        " Incremental search
set mouse=a            " Enable mouse usage (all modes)
set number          " Mostrar los números de línea
set textwidth=80    " Fijar ancho de línea en 80 caracteres
set softtabstop=4
set shiftwidth=4
set tabstop=4
set expandtab

"set showcmd        " Show (partial) command in status line.
"set smartcase        " Do smart case matching
"set autowrite        " Automatically save before commands like :next and :make
"set hidden         " Hide buffers when they are abandoned

if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif