From a80b80db0caefe106aead06d0241f4e2b0b03d4d Mon Sep 17 00:00:00 2001 From: Dmitry Fedotov Date: Thu, 23 Jan 2020 02:35:26 +0300 Subject: [PATCH] Added init scripts for shell --- shell/.bash_profile.symlink | 24 ++++++++++++++++++++++++ shell/init_scripts/arango.mrc | 8 ++++++++ shell/init_scripts/bashrc.mrc | 29 +++++++++++++++++++++++++++++ shell/init_scripts/configs.mrc | 10 ++++++++++ shell/init_scripts/funcs.mrc | 21 +++++++++++++++++++++ shell/init_scripts/i3wm.mrc | 7 +++++++ shell/init_scripts/java.mrc | 2 ++ shell/init_scripts/mgmt.mrc | 10 ++++++++++ shell/init_scripts/nvm.mrc | 10 ++++++++++ shell/init_scripts/portage.mrc | 21 +++++++++++++++++++++ shell/init_scripts/prompt_power.mrc | 14 ++++++++++++++ shell/init_scripts/startx.mrc | 7 +++++++ shell/init_scripts/vpn.mrc | 9 +++++++++ vim/vimrc.symlink | 5 +++++ 14 files changed, 177 insertions(+) create mode 100644 shell/.bash_profile.symlink create mode 100644 shell/init_scripts/arango.mrc create mode 100644 shell/init_scripts/bashrc.mrc create mode 100644 shell/init_scripts/configs.mrc create mode 100644 shell/init_scripts/funcs.mrc create mode 100644 shell/init_scripts/i3wm.mrc create mode 100644 shell/init_scripts/java.mrc create mode 100644 shell/init_scripts/mgmt.mrc create mode 100644 shell/init_scripts/nvm.mrc create mode 100644 shell/init_scripts/portage.mrc create mode 100644 shell/init_scripts/prompt_power.mrc create mode 100644 shell/init_scripts/startx.mrc create mode 100644 shell/init_scripts/vpn.mrc diff --git a/shell/.bash_profile.symlink b/shell/.bash_profile.symlink new file mode 100644 index 0000000..5e1ef83 --- /dev/null +++ b/shell/.bash_profile.symlink @@ -0,0 +1,24 @@ +# __ __ _____ __ +# / /_ ____ ______/ /_ ____ _________ / __(_) /__ +# / __ \/ __ `/ ___/ __ \ / __ \/ ___/ __ \/ /_/ / / _ \ +# _ / /_/ / /_/ (__ ) / / / / /_/ / / / /_/ / __/ / / __/ +#(_)_.___/\__,_/____/_/ /_/_____/ .___/_/ \____/_/ /_/_/\___/ +# /_____/_/ +# +# /etc/skel/.bash_profile + +# This file is sourced by bash for login shells. The following line +# runs your .bashrc and is recommended by the bash info pages. + +export DOT_FILES="${HOME}/.dotfiles" +export DOT_FILES_TMUX="${DOT_FILES}/tmux" +export DOT_FILES_VIM="${DOT_FILES}/vim" +export DOT_FILES_VIM_C_DEV="${DOT_FILES_VIM}/c-dev" +export DOT_FILES_SHELL="${DOT_FILES}/shell" +export DOT_FILES_SHELL_INIT="${DOT_FILES_SHELL}/init_scripts" + +if [[ -d ${DOT_FILES_SHELL_INIT} ]]; then + for s in $(ls -a ${DOT_FILES_SHELL_INIT} | grep -v "\.$"); do + . ${DOT_FILES_SHELL_INIT}/$s + done +fi diff --git a/shell/init_scripts/arango.mrc b/shell/init_scripts/arango.mrc new file mode 100644 index 0000000..de639b5 --- /dev/null +++ b/shell/init_scripts/arango.mrc @@ -0,0 +1,8 @@ +# ____ __________ _____ ____ _____ +# / __ `/ ___/ __ `/ __ \/ __ `/ __ \ +# _/ /_/ / / / /_/ / / / / /_/ / /_/ / +#(_)__,_/_/ \__,_/_/ /_/\__, /\____/ +# /____/ + +alias arangor="sudo /etc/init.d/arangodb start" +alias arangos="sudo /etc/init.d/arangodb stop" diff --git a/shell/init_scripts/bashrc.mrc b/shell/init_scripts/bashrc.mrc new file mode 100644 index 0000000..2e20fa1 --- /dev/null +++ b/shell/init_scripts/bashrc.mrc @@ -0,0 +1,29 @@ +# __ __ +# / /_ ____ ______/ /_ __________ +# / __ \/ __ `/ ___/ __ \/ ___/ ___/ +# _ / /_/ / /_/ (__ ) / / / / / /__ +#(_)_.___/\__,_/____/_/ /_/_/ \___/ + +# Test for an interactive shell. There is no need to set anything +# past this point for scp and rcp, and it's important to refrain from +# outputting anything in those cases. +if [[ $- != *i* ]] ; then + # Shell is non-interactive. Be done now! + return +fi + +# Put your fun stuff here. + +LOCAL_BIN=${HOME}/.local/bin +if [[ -d ${LOCAL_BIN} ]]; then + export PATH=${LOCAL_BIN}:${PATH} +fi + +alias lla="ls -la" +alias ll="ls -l" +alias llr="ls -laRh" + +complete -cf sudo +complete -cf man + +export EDITOR=vim diff --git a/shell/init_scripts/configs.mrc b/shell/init_scripts/configs.mrc new file mode 100644 index 0000000..f944603 --- /dev/null +++ b/shell/init_scripts/configs.mrc @@ -0,0 +1,10 @@ +# _____ +# _________ ____ / __(_)___ ______ +# / ___/ __ \/ __ \/ /_/ / __ `/ ___/ +# _/ /__/ /_/ / / / / __/ / /_/ (__ ) +#(_)___/\____/_/ /_/_/ /_/\__, /____/ +# /____/ + +alias i3c="vi ${HOME}/.config/i3/config" +alias bsc="vi ${HOME}/.bashrc" +alias emc="vi ${HOME}/.emacs" diff --git a/shell/init_scripts/funcs.mrc b/shell/init_scripts/funcs.mrc new file mode 100644 index 0000000..ea52e22 --- /dev/null +++ b/shell/init_scripts/funcs.mrc @@ -0,0 +1,21 @@ +# ____ +# / __/_ ______ __________ +# / /_/ / / / __ \/ ___/ ___/ +# _ / __/ /_/ / / / / /__(__ ) +#(_)_/ \__,_/_/ /_/\___/____/ + +function cdd() { + font="System San Francisco Display" + root_dev_folder=~/dev + dev_folder_name=`ls -1 "${root_dev_folder}" | dmenu -fn "${font}" -i -p "Choose dev folder:"` + + if [[ ${dev_folder_name} ]]; then + dev_folder=${root_dev_folder}/${dev_folder_name} + + projects_count=`ls -1 "${dev_folder}" | wc -l` + project_name=`ls -1 "${dev_folder}" | dmenu -fn "${font}" -i -p "${dev_folder_name}" -l \ + "${projects_count}"` + + [ ${project_name} ] && cd ${dev_folder}/${project_name} + fi +} diff --git a/shell/init_scripts/i3wm.mrc b/shell/init_scripts/i3wm.mrc new file mode 100644 index 0000000..3554996 --- /dev/null +++ b/shell/init_scripts/i3wm.mrc @@ -0,0 +1,7 @@ +# _ _____ +# (_)__ / ______ ___ +# / / /_ < | /| / / __ `__ \ +# _ / /___/ / |/ |/ / / / / / / +#(_)_//____/|__/|__/_/ /_/ /_/ + +export TERMINAL=st diff --git a/shell/init_scripts/java.mrc b/shell/init_scripts/java.mrc new file mode 100644 index 0000000..ddccf05 --- /dev/null +++ b/shell/init_scripts/java.mrc @@ -0,0 +1,2 @@ +# /etc/skel/.javarc +export JAVA_HOME="/usr/lib/jvm/icedtea-bin-8" diff --git a/shell/init_scripts/mgmt.mrc b/shell/init_scripts/mgmt.mrc new file mode 100644 index 0000000..a00179d --- /dev/null +++ b/shell/init_scripts/mgmt.mrc @@ -0,0 +1,10 @@ +# __ +# ____ ___ ____ _____ / /_ +# / __ `__ \/ __ `/ __ \/ __/ +# _ / / / / / / /_/ / / / / /_ +#(_)_/ /_/ /_/\__, /_/ /_/\__/ +# /____/ + +alias shutdown="sudo shutdown" +alias shtd="shutdown -h now" +alias reboot="sudo reboot" diff --git a/shell/init_scripts/nvm.mrc b/shell/init_scripts/nvm.mrc new file mode 100644 index 0000000..c0f93a0 --- /dev/null +++ b/shell/init_scripts/nvm.mrc @@ -0,0 +1,10 @@ +# ____ _ ______ ___ +# / __ \ | / / __ `__ \ +# _ / / / / |/ / / / / / / +#(_)_/ /_/|___/_/ /_/ /_/ + +export NVM_DIR="$HOME/.nvm" +# This loads nvm +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +# This loads nvm bash_completion +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" diff --git a/shell/init_scripts/portage.mrc b/shell/init_scripts/portage.mrc new file mode 100644 index 0000000..ca75a7a --- /dev/null +++ b/shell/init_scripts/portage.mrc @@ -0,0 +1,21 @@ +# __ +# ____ ____ _____/ /_____ _____ ____ +# / __ \/ __ \/ ___/ __/ __ `/ __ `/ _ \ +# _ / /_/ / /_/ / / / /_/ /_/ / /_/ / __/ +#(_) .___/\____/_/ \__/\__,_/\__, /\___/ +# /_/ /____/ + +alias eqf='equery f' +alias equ='equery u' +alias eqh='equery h' +alias eqa='equery a' +alias eqb='equery b' +alias eql='equery l' +alias eqd='equery d' +alias eqg='equery g' +alias eqc='equery c' +alias eqk='equery k' +alias eqm='equery m' +alias eqy='equery y' +alias eqs='equery s' +alias eqw='equery w' diff --git a/shell/init_scripts/prompt_power.mrc b/shell/init_scripts/prompt_power.mrc new file mode 100644 index 0000000..04899d0 --- /dev/null +++ b/shell/init_scripts/prompt_power.mrc @@ -0,0 +1,14 @@ +# __ +# ____ _________ ____ ___ ____ / /_ ____ ____ _ _____ _____ +# / __ \/ ___/ __ \/ __ `__ \/ __ \/ __/ / __ \/ __ \ | /| / / _ \/ ___/ +# _ / /_/ / / / /_/ / / / / / / /_/ / /_ / /_/ / /_/ / |/ |/ / __/ / +#(_) .___/_/ \____/_/ /_/ /_/ .___/\__/_____/ .___/\____/|__/|__/\___/_/ +# /_/ /_/ /_____/_/ + +function _update_ps1() { + PS1=$(powerline-shell $?) +} + +if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then + PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" +fi diff --git a/shell/init_scripts/startx.mrc b/shell/init_scripts/startx.mrc new file mode 100644 index 0000000..e69484e --- /dev/null +++ b/shell/init_scripts/startx.mrc @@ -0,0 +1,7 @@ +# __ __ +# _____/ /_____ ______/ /__ __ +# / ___/ __/ __ `/ ___/ __/ |/_/ +# _ (__ ) /_/ /_/ / / / /__> < +#(_)____/\__/\__,_/_/ \__/_/|_| + +[[ ! ${DISPLAY} && $(tty) = /dev/tty1 ]] && exec startx diff --git a/shell/init_scripts/vpn.mrc b/shell/init_scripts/vpn.mrc new file mode 100644 index 0000000..37cdd22 --- /dev/null +++ b/shell/init_scripts/vpn.mrc @@ -0,0 +1,9 @@ +# _ ______ ____ +# | | / / __ \/ __ \ +# _| |/ / /_/ / / / / +#(_)___/ .___/_/ /_/ +# /_/ + +alias vpnr="sudo /etc/init.d/vpnagentd start" +alias vpns="sudo /etc/init.d/vpnagentd stop" +alias vpnui="/opt/cisco/anyconnect/bin/vpnui > /dev/null 2>&1 &" diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 52bc947..03d04aa 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -46,6 +46,11 @@ Plug 'preservim/nerdcommenter' call plug#end() endif +augroup project + autocmd! + autocmd BufRead,BufNewFile *.mrc set filetype=sh +augroup END + let g:deoplete#enable_at_startup = 1 set exrc -- 2.39.5