This commit is contained in:
bzoicas
2023-07-10 10:41:17 +03:00
commit dbb46eb92a
360 changed files with 13521 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

View File

@@ -0,0 +1,108 @@
# Current PS1:
tty -s && export PS1="[\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\h:\W]\\$ \[$(tput sgr0)\]"
# Env
export TERM=xterm-256color
export EDITOR=vim
# Don't add duplicate lines or lines beginning with a space to the history
HISTCONTROL=ignoreboth
# Set history format to include timestamps
HISTTIMEFORMAT="%Y-%m-%d %T "
# Command aliases
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias back='cd $OLDPWD'
alias c='clear'
alias cd..='cd ..'
alias diff='colordiff'
alias e="vim -O "
alias E="vim -o "
alias extip='curl icanhazip.com'
alias grep='grep --color=auto'
alias l.='ls -lhFa --time-style=long-iso --color=auto'
alias ll='ls'
alias ls='ls -lhF --time-style=long-iso --color=auto'
alias lsmount='mount |column -t'
alias mkdir='mkdir -pv'
alias ports='netstat -tulanp'
alias h='history'
alias j='jobs -l'
alias speedtest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -'
alias ssha='eval $(ssh-agent) && ssh-add'
alias svim='sudo vim'
alias tn='tmux new -s'
alias wget='wget -c'
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
# Safetynets
# do not delete / or prompt if deleting more than 3 files at a time #
alias rm='rm -I --preserve-root'
# confirmation #
alias mv='mv -i'
alias cp='cp -i'
alias ln='ln -i'
# Parenting changing perms on / #
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
# reload bash config
alias reload="source ~/.bashrc"
# package management
alias update='sudo apt-get update'
alias upgrade='sudo apt-get update && sudo apt-get dist-upgrade'
alias install='sudo apt-get install'
## Functions
# Make a directory, then go there
md() {
test -n "$1" || return
mkdir -p "$1" && cd "$1"
}
# "path" shows current path, one element per line.
# If an argument is supplied, grep for it.
path() {
test -n "$1" && {
echo $PATH | perl -p -e "s/:/\n/g;" | grep -i "$1"
} || {
echo $PATH | perl -p -e "s/:/\n/g;"
}
}
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjvf $1 ;;
*.tar.gz) tar xzvf $1 ;;
*.bz2) bzip2 -d $1 ;;
*.rar) unrar2dir $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip2dir $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*.ace) unace x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

View File

@@ -0,0 +1,3 @@
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

View File

@@ -0,0 +1,113 @@
# Initial setup
set -g default-terminal xterm-256color
set -g status-keys vi
# Set fish as the default shell
#set-option -g default-shell "/usr/bin/fish"
# use C-j and C-f for the prefix.
set-option -g prefix C-j
set-option -g prefix2 C-f
unbind-key C-j
bind-key C-j send-prefix
set -g base-index 1
# Easy config reload
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# Easy clear history
bind-key L clear-history
# Double press <prefix> to move to last window
bind-key C-f last-window
bind-key C-j last-window
# Lengthen the amount of time status messages are displayed
set-option -g display-time 2000
set-option -g display-panes-time 3000
# Set the base-index to 1 rather than 0
set -g base-index 1
set-window-option -g pane-base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# Key bindings for copy-paste
setw -g mode-keys vi
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Window activity monitor
setw -g monitor-activity on
set -g visual-activity on
# Set easier window split keys
bind-key v split-window -h
bind-key h split-window -v
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Allow the arrow key to be used immediately after changing windows.
set-option -g repeat-time 0
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Synchronize panes
bind-key y set-window-option synchronize-panes
# No delay for escape key press
set -sg escape-time 0
# Window activity monitor
setw -g monitor-activity on
set -g visual-activity on
# Mouse Mode
set -g mouse on
# Theme
set -g window-status-current-style bold,bg=colour247,fg=colour237
set -g window-status-activity-style bg=blue,fg=black
set-option -g message-style bg=colour237,fg=colour231
set-option -g pane-border-style fg=colour247
set-option -g pane-active-border-style fg=colour247
# Status Bar
set -g status-justify centre
set -g status-bg black
set -g status-fg white
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=colour237]#[bg=colour247,bold] #H #[bg=colour237] #[fg=colour247,nobold][#S] '
set -g status-right '#[bg=colour237]#[fg=colour247] #(cut -d " " -f 1-3 /proc/loadavg)#[default]#[bg=colour237] #[bg=colour247]#[fg=colour237,bold] %H:%M '

View File

@@ -0,0 +1,163 @@
" Set color scheme. Other good ones are bubblegum-256-dark, sorcerer, and zenburn
colorscheme xoria256
" keyboard shortcuts
let mapleader = ','
noremap <leader>b :CtrlPBuffer<CR>
nnoremap <leader>d :NERDTreeToggle<CR>
nnoremap <leader>f :NERDTreeFind<CR>
noremap <leader>p :CtrlP<CR>
noremap <leader>P :CtrlPClearCache<CR>:CtrlP<CR>
noremap <silent> <leader>r :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
" Switch buffers using ctrl+left or ctrl+right
map <C-left> <ESC>:bp<CR>
map <C-right> <ESC>:bn<CR>
" Move between windows easily
noremap <leader><up> :wincmd k<CR>
noremap <leader><down> :wincmd j<CR>
noremap <leader><left> :wincmd h<CR>
noremap <leader><right> :wincmd l<CR>
noremap <leader>k :wincmd k<CR>
noremap <leader>j :wincmd j<CR>
noremap <leader>h :wincmd h<CR>
noremap <leader>l :wincmd l<CR>
" Switch buffers using F5
nnoremap <F5> :buffers<CR>:buffer<Space>
" Set keyboard shortcut for paste toggle.
set pastetoggle=<F10>
map <F12> :call TrimWhiteSpace()<CR>
" Removes trailing spaces
func! TrimWhiteSpace()
%s/\s*$//
''
:endfunction
" Airline
"let g:airline_powerline_fonts=1
"let g:airline#extensions#tabline#enabled = 1
"let g:airline_theme='laederon'
" Clear search highlight with c-l
noremap <silent> <c-l> :nohls<cr><c-l>
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
map <space> /
map <c-space> ?
let c_space_errors = 1
" Fix tmux background color
if &term =~ '256color'
set t_ut=
endif
" Show line numbers
set number
" Enable filetype plugins
filetype plugin indent on
" Enable syntax highlighting
syntax on
" Turn backup off
set nobackup
set nowb
set noswapfile
" this turns off physical line wrapping (ie: automatic insertion of newlines)
set textwidth=0 wrapmargin=0
" Enable auto-indent
set ai
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set ai "Auto indent
set si "Smart indent
" Ignore case while searching
set ignorecase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
" Return to the last edit position when opening files.
augroup vimrcEx
autocmd!
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
" Ensure cursor is at the top of the file, if editing a git commit message:
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
" Remember info about open buffers on close
set viminfo^=%
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
" Always show the status line
set laststatus=2
" Format the status line
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
" Delete trailing white space on save, useful for (Python)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
" in case you forgot to sudo
cnoremap w!! %!sudo tee > /dev/null %
" Set the cursorline
set cursorline
"hi cursorline gui=none
augroup CursorlineOnlyInActiveWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
" Enhanced vim tweaks
silent! source ~/.vimrc-extra

View File

@@ -0,0 +1,142 @@
" Vim color file
"
" Name: xoria256.vim
" Version: 1.5
" Maintainer: Dmitriy Y. Zotikov (xio) <xio@ungrund.org>
"
" Should work in recent 256 color terminals. 88-color terms like urxvt are
" NOT supported.
"
" Don't forget to install 'ncurses-term' and set TERM to xterm-256color or
" similar value.
"
" Color numbers (0-255) see:
" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
"
" For a specific filetype highlighting rules issue :syntax list when a file of
" that type is opened.
" Initialization {{{
if &t_Co != 256 && ! has("gui_running")
echomsg ""
echomsg "err: please use GUI or a 256-color terminal (so that t_Co=256 could be set)"
echomsg ""
finish
endif
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "xoria256"
"}}}
" Colours {{{1
"" General {{{2
hi Normal ctermfg=252 guifg=#d0d0d0 ctermbg=234 guibg=#1c1c1c cterm=none gui=none
hi Cursor ctermbg=214 guibg=#ffaf00
hi CursorColumn ctermbg=238 guibg=#444444
hi CursorLine ctermbg=237 guibg=#3a3a3a cterm=none gui=none
hi Error ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
hi ErrorMsg ctermfg=15 guifg=#ffffff ctermbg=1 guibg=#800000
hi FoldColumn ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
hi Folded ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
hi IncSearch ctermfg=0 guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
hi LineNr ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212
hi MatchParen ctermfg=188 guifg=#dfdfdf ctermbg=68 guibg=#5f87df cterm=bold gui=bold
" TODO
" hi MoreMsg
hi NonText ctermfg=247 guifg=#9e9e9e ctermbg=233 guibg=#121212 cterm=bold gui=bold
hi Pmenu ctermfg=0 guifg=#000000 ctermbg=250 guibg=#bcbcbc
hi PmenuSel ctermfg=255 guifg=#eeeeee ctermbg=243 guibg=#767676
hi PmenuSbar ctermbg=252 guibg=#d0d0d0
hi PmenuThumb ctermfg=243 guifg=#767676
hi Search ctermfg=0 guifg=#000000 ctermbg=149 guibg=#afdf5f
hi SignColumn ctermfg=248 guifg=#a8a8a8
hi SpecialKey ctermfg=77 guifg=#5fdf5f
hi SpellBad ctermfg=160 guifg=fg ctermbg=bg cterm=underline guisp=#df0000
hi SpellCap ctermfg=189 guifg=#dfdfff ctermbg=bg guibg=bg cterm=underline gui=underline
hi SpellRare ctermfg=168 guifg=#df5f87 ctermbg=bg guibg=bg cterm=underline gui=underline
hi SpellLocal ctermfg=98 guifg=#875fdf ctermbg=bg guibg=bg cterm=underline gui=underline
hi StatusLine ctermfg=15 guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
hi TabLine ctermfg=fg guifg=fg ctermbg=242 guibg=#666666 cterm=none gui=none
hi TabLineFill ctermfg=fg guifg=fg ctermbg=237 guibg=#3a3a3a cterm=none gui=none
" FIXME
hi Title ctermfg=225 guifg=#ffdfff
hi Todo ctermfg=0 guifg=#000000 ctermbg=184 guibg=#dfdf00
hi Underlined ctermfg=39 guifg=#00afff cterm=underline gui=underline
hi VertSplit ctermfg=237 guifg=#3a3a3a ctermbg=237 guibg=#3a3a3a cterm=none gui=none
" hi VIsualNOS ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff cterm=none gui=none
" hi Visual ctermfg=24 guifg=#005f87 ctermbg=153 guibg=#afdfff
hi Visual ctermfg=255 guifg=#eeeeee ctermbg=96 guibg=#875f87
" hi Visual ctermfg=255 guifg=#eeeeee ctermbg=24 guibg=#005f87
hi VisualNOS ctermfg=255 guifg=#eeeeee ctermbg=60 guibg=#5f5f87
hi WildMenu ctermfg=0 guifg=#000000 ctermbg=150 guibg=#afdf87 cterm=bold gui=bold
"" Syntax highlighting {{{2
hi Comment ctermfg=244 guifg=#808080
hi Constant ctermfg=229 guifg=#ffffaf
hi Identifier ctermfg=182 guifg=#dfafdf cterm=none
hi Ignore ctermfg=238 guifg=#444444
hi Number ctermfg=180 guifg=#dfaf87
hi PreProc ctermfg=150 guifg=#afdf87
hi Special ctermfg=174 guifg=#df8787
hi Statement ctermfg=110 guifg=#87afdf cterm=none gui=none
hi Type ctermfg=146 guifg=#afafdf cterm=none gui=none
"" Special {{{2
""" .diff {{{3
hi diffAdded ctermfg=150 guifg=#afdf87
hi diffRemoved ctermfg=174 guifg=#df8787
""" vimdiff {{{3
hi diffAdd ctermfg=bg guifg=bg ctermbg=151 guibg=#afdfaf
"hi diffDelete ctermfg=bg guifg=bg ctermbg=186 guibg=#dfdf87 cterm=none gui=none
hi diffDelete ctermfg=bg guifg=bg ctermbg=246 guibg=#949494 cterm=none gui=none
hi diffChange ctermfg=bg guifg=bg ctermbg=181 guibg=#dfafaf
hi diffText ctermfg=bg guifg=bg ctermbg=174 guibg=#df8787 cterm=none gui=none
""" HTML {{{3
" hi htmlTag ctermfg=146 guifg=#afafdf
" hi htmlEndTag ctermfg=146 guifg=#afafdf
hi htmlTag ctermfg=244
hi htmlEndTag ctermfg=244
hi htmlArg ctermfg=182 guifg=#dfafdf
hi htmlValue ctermfg=187 guifg=#dfdfaf
hi htmlTitle ctermfg=254 ctermbg=95
" hi htmlArg ctermfg=146
" hi htmlTagName ctermfg=146
" hi htmlString ctermfg=187
""" django {{{3
hi djangoVarBlock ctermfg=180
hi djangoTagBlock ctermfg=150
hi djangoStatement ctermfg=146
hi djangoFilter ctermfg=174
""" python {{{3
hi pythonExceptions ctermfg=174
""" NERDTree {{{3
hi Directory ctermfg=110 guifg=#87afdf
hi treeCWD ctermfg=180 guifg=#dfaf87
hi treeClosable ctermfg=174 guifg=#df8787
hi treeOpenable ctermfg=150 guifg=#afdf87
hi treePart ctermfg=244 guifg=#808080
hi treeDirSlash ctermfg=244 guifg=#808080
hi treeLink ctermfg=182 guifg=#dfafdf
""" VimDebug {{{3
" FIXME
" you may want to set SignColumn highlight in your .vimrc
" :help sign
" :help SignColumn
" hi currentLine term=reverse cterm=reverse gui=reverse
" hi breakPoint term=NONE cterm=NONE gui=NONE
" hi empty term=NONE cterm=NONE gui=NONE
" sign define currentLine linehl=currentLine
" sign define breakPoint linehl=breakPoint text=>>
" sign define both linehl=currentLine text=>>
" sign define empty linehl=empty

View File

@@ -0,0 +1,147 @@
###### Prompt
prompt='%F{35}%* [%j] [%m:%F{75}%f%F{69}%c%f%F{35}] %F{black}%K{red}%#%f%k '
##### History
# Set history file
HISTFILE=~/.zhistory
# Set history size
HISTSIZE=10000
# Set the number of lines in $HISTFILE
SAVEHIST="${HISTSIZE}"
# Enable history search with up and down arrows
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
##### Aliases
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias back='cd $OLDPWD'
alias c='clear'
alias cd..='cd ..'
alias cp='cp -iv'
alias chmod="chmod -c"
alias chown="chown -c"
alias e="vim -O "
alias E="vim -o "
alias egrep='egrep --colour=auto'
alias extip='curl icanhazip.com'
alias grep='grep --color=auto'
alias l.='ls -lhFa --time-style=long-iso --color=auto'
alias ll='ls'
alias ln='ln -iv'
alias ls='ls -lhF --color=auto --human-readable --time-style=long-iso --classify'
alias lsmount='mount |column -t'
alias mkdir='mkdir -pv'
alias mv='mv -iv'
alias ports='netstat -tulanp'
alias h='history -i'
alias history='history -i'
alias j='jobs -l'
alias rm='rm -iv'
alias rmdir='rmdir -v'
alias speedtest='curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -'
alias ssha='eval $(ssh-agent) && ssh-add'
alias svim='sudo vim'
alias tn=' tmux new -s'
alias wget='wget -c'
if command -v colordiff > /dev/null 2>&1; then
alias diff="colordiff -Nuar"
else
alias diff="diff -Nuar"
fi
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
# Safetynets
# do not delete / or prompt if deleting more than 3 files at a time #
alias rm='rm -I --preserve-root'
# Parenting changing perms on / #
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
# package management
alias update='sudo apt-get update'
alias upgrade='sudo apt-get update && sudo apt-get dist-upgrade'
alias install='sudo apt-get install'
##### Functions
# Easily extract archives
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjvf $1 ;;
*.tar.gz) tar xzvf $1 ;;
*.bz2) bzip2 -d $1 ;;
*.rar) unrar2dir $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip2dir $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*.ace) unace x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
reload () {
exec "${SHELL}" "$@"
}
##### shopt
# save timestamp of command and duration
setopt extended_history
# Add commands as they are typed, don't wait until shell exit
setopt inc_append_history
# when trimming history, lose oldest duplicates first
setopt hist_expire_dups_first
# Do not write events to history that are duplicates of previous events
setopt hist_ignore_dups
# remove command line from history list when first character on the line is a space
setopt hist_ignore_space
# When searching history don't display results already cycled through twice
setopt hist_find_no_dups
# don't execute, just expand history
setopt hist_verify
# Stop annoying error when using asterisk in shell commands (i.e. scp server:*.txt .)
setopt nonomatch
# extended globbing, awesome!
setopt extendedGlob
# Turn on command substitution in the prompt (and parameter expansion and arithmetic expansion).
setopt promptsubst