From c6765748e827c87c45cdd3ab432419a6ad47038b Mon Sep 17 00:00:00 2001 From: Cheri Date: Sat, 16 May 2020 23:23:07 +0300 Subject: [PATCH] properly added some other DOTfiles cause I'm dumb --- .bashrc | 156 +++++++++++++++++++++++++++++++++++++++++++++++++ .vimrc | 178 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 334 insertions(+) create mode 100644 .bashrc create mode 100644 .vimrc diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..140484b --- /dev/null +++ b/.bashrc @@ -0,0 +1,156 @@ +# +# ~/.bashrc +# + +[[ $- != *i* ]] && return + +export EDITOR=/usr/bin/vim +export TERMINAL=termite +colors() { + local fgc bgc vals seq0 + + printf "Color escapes are %s\n" '\e[${value};...;${value}m' + printf "Values 30..37 are \e[33mforeground colors\e[m\n" + printf "Values 40..47 are \e[43mbackground colors\e[m\n" + printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n" + + # foreground colors + for fgc in {30..37}; do + # background colors + for bgc in {40..47}; do + fgc=${fgc#37} # white + bgc=${bgc#40} # black + + vals="${fgc:+$fgc;}${bgc}" + vals=${vals%%;} + + seq0="${vals:+\e[${vals}m}" + printf " %-9s" "${seq0:-(default)}" + printf " ${seq0}TEXT\e[m" + printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" + done + echo; echo + done +} + +[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion + +# Change the window title of X terminals +case ${TERM} in + xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*) + PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"' + ;; + screen*) + PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"' + ;; +esac + +use_color=true + +# Set colorful PS1 only on colorful terminals. +# dircolors --print-database uses its own built-in database +# instead of using /etc/DIR_COLORS. Try to use the external file +# first to take advantage of user additions. Use internal bash +# globbing instead of external grep binary. +safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM +match_lhs="" +[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" +[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \ + && match_lhs=$(dircolors --print-database) +[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true + +if ${use_color} ; then + # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 + if type -P dircolors >/dev/null ; then + if [[ -f ~/.dir_colors ]] ; then + eval $(dircolors -b ~/.dir_colors) + elif [[ -f /etc/DIR_COLORS ]] ; then + eval $(dircolors -b /etc/DIR_COLORS) + fi + fi + + if [[ ${EUID} == 0 ]] ; then + PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' + else + PS1='\[\e[31m\]\W\[\e[m\] \[\e[32m\]>\[\e[m\] ' + fi + + alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' +else + if [[ ${EUID} == 0 ]] ; then + # show root@ when we don't have colors + PS1='\u@\h \W \$ ' + else + PS1='\u@\h \w \$ ' + fi +fi + +unset use_color safe_term match_lhs sh + +alias cp="cp -i" # confirm before overwriting something +alias df='df -h' # human-readable sizes +alias free='free -m' # show sizes in MB +alias np='nano -w PKGBUILD' +alias more=less + +xhost +local:root > /dev/null 2>&1 + +complete -cf sudo + +# Bash won't get SIGWINCH if another process is in the foreground. +# Enable checkwinsize so that bash will check the terminal size when +# it regains control. #65623 +# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11) +shopt -s checkwinsize + +shopt -s expand_aliases + +# export QT_SELECT=4 + +# Enable history appending instead of overwriting. #139609 +shopt -s histappend + +# +# # ex - archive extractor +# # usage: ex +ex () +{ + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xjf $1 ;; + *.tar.gz) tar xzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xf $1 ;; + *.tbz2) tar xjf $1 ;; + *.tgz) tar xzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1;; + *.7z) 7z x $1 ;; + *) echo "'$1' cannot be extracted via ex()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +# better yaourt colors +export YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35" + +# User added aliases + +alias gcloud-ssh-bot='gcloud beta compute --project "vibot-discord" ssh --zone "europe-west3-c" "redbot"' +alias gcloud-ssh-multipurpose='gcloud beta compute --project "multipurpose-vps-264707" ssh --zone "us-west2-c" "vibikim@halo" --ssh-flag="-p 22"' +alias gcloud-ssh-mc='gcloud beta compute --project "multipurpose-vps-264707" ssh --zone "europe-west3-c" "vibikim@minecraft" --ssh-flag="-p 22"' + #rclone syncs +alias rclone-up-projecte_drawings="rclone sync ~/Documents/Projecte\ drawings/ 'Main gDrive':/'Projecte drawings' -P" +alias rclone-up-music="rclone sync /run/media/vibikim/WAD/Music/ gdrive_music:/Music -P" + +alias rclone-down-projecte_drawings="rclone sync 'Main gDrive':/'Projecte drawings' ~/Documents/Projecte\ drawings/ -P" +alias rclone-down-music="rclone sync gdrive_music:/Music /run/media/vibikim/WAD/Music/ -P" diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..9a2d90f --- /dev/null +++ b/.vimrc @@ -0,0 +1,178 @@ + +" An example for a vimrc file. +" +" Maintainer: Bram Moolenaar +" Last change: 2019 Jan 26 + +" When started as "evim", evim.vim will already have done these settings, bail +" out. +if v:progname =~? "evim" + finish +endif + + + +" Get the defaults that most users want. +"source $VIMRUNTIME/defaults.vim + +" The default vimrc file. +" +" Maintainer: Bram Moolenaar +" Last change: 2019 Feb 18 + +" Bail out if something that ran earlier, e.g. a system wide vimrc, does not +" want Vim to use these default values. +if exists('skip_defaults_vim') + finish +endif + +" Use Vim settings, rather than Vi settings (much better!). +" This must be first, because it changes other options as a side effect. +" Avoid side effects when it was already reset. +if &compatible + set nocompatible +endif + +" When the +eval feature is missing, the set command above will be skipped. +" Use a trick to reset compatible only when the +eval feature is missing. +silent! while 0 + set nocompatible +silent! endwhile + +" Allow backspacing over everything in insert mode. +set backspace=indent,eol,start + +set history=200 " keep 200 lines of command line history +set ruler " show the cursor position all the time +set showcmd " display incomplete commands +set wildmenu " display completion matches in a status line +set number + +set ttimeout " time out for key codes +set ttimeoutlen=100 " wait up to 100ms after Esc for special key + +" Show @@@ in the last line if it is truncated. +set display=truncate + +" Show a few lines of context around the cursor. Note that this makes the +" text scroll if you mouse-click near the start or end of the window. +set scrolloff=5 + +" Do incremental searching when it's possible to timeout. +if has('reltime') + set incsearch +endif + +" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it +" confusing. +set nrformats-=octal + +" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries. +if has('win32') + set guioptions-=t +endif + +" Don't use Ex mode, use Q for formatting. +" Revert with ":unmap Q". +map Q gq + +" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, +" so that you can undo CTRL-U after inserting a line break. +" Revert with ":iunmap ". +inoremap u + +" In many terminal emulators the mouse works just fine. By enabling it you +" can position the cursor, Visually select and scroll with the mouse. +if has('mouse') + set mouse=a +endif + +" Switch syntax highlighting on when the terminal has colors or when using the +" GUI (which always has colors). +if &t_Co > 2 || has("gui_running") + " Revert with ":syntax off". + syntax on + + " I like highlighting strings inside C comments. + " Revert with ":unlet c_comment_strings". + let c_comment_strings=1 +endif + +" Only do this part when Vim was compiled with the +eval feature. +if 1 + + " Enable file type detection. + " Use the default filetype settings, so that mail gets 'tw' set to 72, + " 'cindent' is on in C files, etc. + " Also load indent files, to automatically do language-dependent indenting. + " Revert with ":filetype off". + filetype plugin indent on + + " Put these in an autocmd group, so that you can revert them with: + " ":augroup vimStartup | au! | augroup END" + augroup vimStartup + au! + + " When editing a file, always jump to the last known cursor position. + " Don't do it when the position is invalid, when inside an event handler + " (happens when dropping a file on gvim) and for a commit message (it's + " likely a different one than last time). + autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif + + augroup END + +endif + +" Convenient command to see the difference between the current buffer and the +" file it was loaded from, thus the changes you made. +" Only define it when not defined already. +" Revert with: ":delcommand DiffOrig". +if !exists(":DiffOrig") + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis + \ | wincmd p | diffthis +endif + +if has('langmap') && exists('+langremap') + " Prevent that the langmap option applies to characters that result from a + " mapping. If set (default), this may break plugins (but it's backward + " compatible). + set nolangremap +endif +"END OF defaults.vim + + + +if has("vms") + set nobackup " do not keep a backup file, use versions instead +else + set backup " keep a backup file (restore to previous version) + if has('persistent_undo') + set undofile " keep an undo file (undo changes after closing) + endif +endif + +if &t_Co > 2 || has("gui_running") + " Switch on highlighting the last used search pattern. + set hlsearch +endif + +" Put these in an autocmd group, so that we can delete them easily. +augroup vimrcEx + au! + + " For all text files set 'textwidth' to 78 characters. + autocmd FileType text setlocal textwidth=78 +augroup END + +" Add optional packages. +" +" The matchit plugin makes the % command work better, but it is not backwards +" compatible. +" The ! means the package won't be loaded right away but when plugins are +" loaded during initialization. +if has('syntax') && has('eval') + packadd! matchit +endif