add general linux conf

This commit is contained in:
2022-02-28 14:53:40 +00:00
parent ddd53f3c41
commit 42eacc8844
6 changed files with 340 additions and 0 deletions

23
linux/.bash_aliases Normal file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
if ls --color &> /dev/null; then
alias ll='ls -kahlF --color=always'
alias l='ls -CF --color=always'
else
alias ll='ls -kahlFG'
alias l='ls -CFG'
fi
alias cd..='cd ..'
alias mkdir='mkdir -pv'
if git --version &> /dev/null; then
alias git-root='cd "$(git rev-parse --show-toplevel)"'
fi
if hugo version &> /dev/null; then
alias hubu='hugo -v --cleanDestinationDir --gc --minify'
fi
if git --verison ; then
alias git-root='cd "$(git rev-parse --show-toplevel)"'
fi

145
linux/.bashrc Normal file
View File

@@ -0,0 +1,145 @@
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
append_path() {
for chkpth ; do
if [[ ! $PATH = *"$chkpth"* && -d "$chkpth" ]] ; then
PATH="$PATH":"$chkpth"
fi
done
}
prepend_path() {
for chkpth ; do
if [[ ! $PATH = *"$chkpth"* && -d "$chkpth" ]] ; then
PATH="$chkpth":"$PATH"
fi
done
}
append_path '/usr/local/bin/busybox'
export HSTR_CONFIG=hicolor,raw-history-view # get more colors
export HISTCONTROL=ignoreboth:erasedups # no duplicate entries
export HISTFILESIZE=2500000
export HISTSIZE=250000
# see: https://github.com/dvorka/hstr/issues/277
export PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'history -a; history -n'
# type -P forces a PATH search, skipping builtins and so on
if type -P hstr >/dev/null; then
# hstr exists
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
# if this is interactive shell, then bind 'kill last command' to Ctrl-x k
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi
fi
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# append to the history file, don't overwrite it
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
shopt -s globstar
# 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|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fidavid
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\] '
PS1='${debian_chroot:+($debian_chroot)}\[\e[1;31m\]\u\[\e[1;33m\]@\[\e[1;36m\]\h \[\e[1;33m\]\w \[\e[1;35m\]\$ \[\e[0m\]'
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w '
fi
if [[ -f /usr/lib/git-core/git-sh-prompt ]] ; then . /usr/lib/git-core/git-sh-prompt ; fi
if [[ $(type -t __git_ps1) == "function" ]] ; then
PS1='\[\033[32m\]$(__git_ps1 "(%s)")\[\033[00m\]'$PS1
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 --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

7
linux/.gitconfig Normal file
View File

@@ -0,0 +1,7 @@
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
[user]
email = mark.schmitz@mailbox.org
name = Mark Schmitz
[color]
ui = auto

9
linux/.profile Normal file
View File

@@ -0,0 +1,9 @@
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n 2> /dev/null || true

25
linux/.tmux.conf Normal file
View File

@@ -0,0 +1,25 @@
# set -g default-terminal "tmux-256color"
# Start numbering windows at 1
set -g base-index 1
set-option -g history-limit 125000
set-option -g status-style fg="#cccccc",bg="#444444"
set-option -g message-style fg="#000000",bg="#bfbf40"
set-option -g pane-border-style fg="#777777"
set-option -g pane-active-border-style fg="#bfbf40"
set -g status-interval 1
set -g status-justify centre # center align window list
set -g status-left-length 20
set -g status-right-length 140
set -g status-left '#H • #[default]'
set -g status-right '#(tmux-mem-cpu-load --interval 1) • #(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") • %a %H:%M:%S #[default] %Y-%m-%d'
# Try screen256-color (https://github.com/tmux/tmux/issues/622):
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 6 \)'" 'set -g default-terminal "screen-256color"'
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 6 \)'" 'set -ga terminal-overrides ",screen-256color:Tc"'
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 6\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'set -g default-terminal "screen-256color"'

131
linux/.vimrc Normal file
View File

@@ -0,0 +1,131 @@
syntax enable " Turn on syntax highlighting
set hidden " Leave hidden buffers open
set history=100 "by default Vim saves your last 8 commands. We can handle more
" Enable filetype plugins
filetype plugin on
filetype indent on
"Always show current position
set ruler
" Height of the command bar
set cmdheight=1
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" 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\ \ Column:\ %c
set statusline=%t "tail of the filename
set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
set statusline+=%{&ff}] "file format
set statusline+=%h "help file flag
set statusline+=%m "modified flag
set statusline+=%r "read only flag
set statusline+=%y "filetype
set statusline+=%= "left/right separator
set statusline+=%c, "cursor column
set statusline+=%l/%L "cursor line/total lines
set statusline+=\ %P "percent through file
" https://stackoverflow.com/a/10416234
set statusline=
set statusline+=%7*\[%n] "buffernr
set statusline+=%1*\ %<%F\ "File+path
set statusline+=%2*\ %y\ "FileType
set statusline+=%3*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding
set statusline+=%3*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
set statusline+=%4*\ %{&ff}\ "FileFormat (dos/unix..)
set statusline+=%5*\ %{&spelllang}\%{HighlightSearch()}\ "Spellanguage & Highlight on?
set statusline+=%8*\ %=\ row:%l/%L\ (%03p%%)\ "Rownumber/total (%)
set statusline+=%9*\ col:%03c\ "Colnr
set statusline+=%0*\ \ %m%r%w\ %P\ \ "Modified? Readonly? Top/bot.
hi User1 ctermfg=15 ctermbg=88 guifg=#ffdad8 guibg=#880c0e "File+path
hi User2 ctermfg=0 ctermbg=173 guifg=#000000 guibg=#F4905C "FileType
hi User3 ctermfg=0 ctermbg=186 guifg=#292b00 guibg=#f4f597 "Encoding
hi User4 ctermfg=0 ctermbg=150 guifg=#112605 guibg=#aefe7B "FileFormat (dos/unix..)
hi User5 ctermfg=0 ctermbg=114 guifg=#051d00 guibg=#7dcc7d "Spellanguage & Highlight on?
hi User7 ctermfg=15 ctermbg=88 guifg=#ffffff guibg=#880c0e gui=bold cterm=bold "buffernr
hi User8 ctermfg=15 ctermbg=62 guifg=#ffffff guibg=#5b7fbb "Rownumber/total (%)
hi User9 ctermfg=15 ctermbg=90 guifg=#ffffff guibg=#810085 "Colnr
hi User0 ctermfg=7 ctermbg=8 guifg=#ffffff guibg=#094afe "Modified? Readonly? Top/bot.
hi StatusLine ctermfg=237 ctermbg=255
function! HighlightSearch()
if &hls
return 'H'
else
return ''
endif
endfunction
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
endif
return ''
endfunction